-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds the ability to include a settings bundle in your app. The bundle is added by default, and includes CocoaPods attributions if CocoaPods is enabled.
- Loading branch information
Showing
12 changed files
with
122 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
module Liftoff | ||
class SettingsGenerator | ||
def initialize(config) | ||
@config = config | ||
end | ||
|
||
def generate | ||
if @config.enable_settings | ||
move_settings_bundle | ||
end | ||
end | ||
|
||
def move_settings_bundle | ||
FileManager.new.generate('Settings.bundle', 'Resources/Settings.bundle', @config) | ||
parent_group = xcode_project['Resources'] || xcode_project.main_group | ||
if (parent_group) | ||
file = parent_group.new_file('Settings.bundle') | ||
target.add_resources([file]) | ||
xcode_project.save | ||
end | ||
end | ||
|
||
private | ||
|
||
def available_targets | ||
xcode_project.targets.to_a.reject { |t| t.name.end_with?('Tests') } | ||
end | ||
|
||
def target | ||
@target ||= ObjectPicker.choose_item('target', available_targets) | ||
end | ||
|
||
def xcode_project | ||
@xcode_project ||= Xcodeproj::Project.open(project_file) | ||
end | ||
|
||
def project_file | ||
@project_file ||= ObjectPicker.choose_item('project', Dir.glob('*.xcodeproj')) | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
module Liftoff | ||
class StringRenderer | ||
def initialize(configuration) | ||
@configuration = configuration | ||
def initialize(config) | ||
@config = config | ||
end | ||
|
||
def render(string) | ||
ERB.new(string).result(@configuration.get_binding) | ||
ERB.new(string).result(@config.get_binding) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>PreferenceSpecifiers</key> | ||
<array> | ||
<% if use_cocoapods %> | ||
<dict> | ||
<key>Type</key> | ||
<string>PSGroupSpecifier</string> | ||
</dict> | ||
<dict> | ||
<key>File</key> | ||
<string>Acknowledgements</string> | ||
<key>Title</key> | ||
<string>Acknowledgements</string> | ||
<key>Type</key> | ||
<string>PSChildPaneSpecifier</string> | ||
</dict> | ||
<% end %> | ||
</array> | ||
<key>StringsTable</key> | ||
<string>Root</string> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/* A single strings file, whose title is specified in your preferences schema. The strings files provide the localized content to display to the user for each of your preferences. */ | ||
|
||
"Acknowledgements" = "Acknowledgements"; |