Module: Crafter
Constant Summary collapse
- ROOT =
File.('.', File.dirname(__FILE__))
Instance Attribute Summary collapse
-
#command_line_test_script ⇒ Object
readonly
Returns the value of attribute command_line_test_script.
-
#icon_versioning_script ⇒ Object
readonly
Returns the value of attribute icon_versioning_script.
Instance Method Summary collapse
- #add_git_ignore ⇒ Object
- #add_platform(platform_hash) ⇒ Object
- #configure(&block) ⇒ Object
- #duplicate_configurations(duplication_hash) ⇒ Object
- #find_target_configuration(name) ⇒ Object
- #process_build_settings ⇒ Object
- #process_configurations ⇒ Object
- #process_git ⇒ Object
- #process_optional ⇒ Object
- #process_options ⇒ Object
- #process_pods ⇒ Object
- #process_scripts ⇒ Object
- #project ⇒ Object
- #set_build_settings(build_settings, configuration: 'crafter_common') ⇒ Object
- #set_language_swift(is_swift) ⇒ Object
- #set_options(options) ⇒ Object
- #setup_project ⇒ Object
- #with(name, &block) ⇒ Object
Instance Attribute Details
#command_line_test_script ⇒ Object (readonly)
Returns the value of attribute command_line_test_script.
4 5 6 |
# File 'lib/config/default_scripts.rb', line 4 def command_line_test_script @command_line_test_script end |
#icon_versioning_script ⇒ Object (readonly)
Returns the value of attribute icon_versioning_script.
4 5 6 |
# File 'lib/config/default_scripts.rb', line 4 def icon_versioning_script @icon_versioning_script end |
Instance Method Details
#add_git_ignore ⇒ Object
47 48 49 |
# File 'lib/crafter.rb', line 47 def add_git_ignore @add_git_ignore = true end |
#add_platform(platform_hash) ⇒ Object
43 44 45 |
# File 'lib/crafter.rb', line 43 def add_platform(platform_hash) @platforms << platform_hash end |
#configure(&block) ⇒ Object
23 24 25 |
# File 'lib/crafter.rb', line 23 def configure(&block) instance_eval &block end |
#duplicate_configurations(duplication_hash) ⇒ Object
51 52 53 |
# File 'lib/crafter.rb', line 51 def duplicate_configurations(duplication_hash) @configuration = duplication_hash end |
#find_target_configuration(name) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/crafter.rb', line 35 def find_target_configuration(name) target = @targets[name] target ||= self.project.select_target_for_name name target_configuration = TargetConfiguration.new(name, target) @targets[name] = target_configuration target_configuration end |
#process_build_settings ⇒ Object
91 92 93 94 |
# File 'lib/crafter.rb', line 91 def process_build_settings puts 'set specified values for build settings' self.project.set_build_settings(@build_settings) end |
#process_configurations ⇒ Object
77 78 79 80 |
# File 'lib/crafter.rb', line 77 def process_configurations puts 'duplicating configurations' self.project.duplicate_configurations(@configuration) end |
#process_git ⇒ Object
96 97 98 99 |
# File 'lib/crafter.rb', line 96 def process_git puts 'preparing git ignore' GitHelper.new.generate_files end |
#process_optional ⇒ Object
82 83 84 |
# File 'lib/crafter.rb', line 82 def process_optional @targets.each { |_, v| v.process_optional } end |
#process_options ⇒ Object
86 87 88 89 |
# File 'lib/crafter.rb', line 86 def puts 'setting up variety of options' self.project.(@options) end |
#process_pods ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/crafter.rb', line 101 def process_pods puts 'preparing pod file' File.open('Podfile', File::WRONLY|File::CREAT|File::EXCL) do |f| if @language_swift f.puts "use_frameworks!" end @platforms.each do |hash| name = hash[:platform] deployment = hash[:deployment] if deployment f.puts "platform :#{name}, '#{deployment}'" else f.puts "platform #{name}" end end @targets.each { |_, v| v.write_pods(f) } end rescue Exception => e puts "Skipping pod generation - #{e}" end |
#process_scripts ⇒ Object
126 127 128 129 |
# File 'lib/crafter.rb', line 126 def process_scripts puts 'adding scripts' @targets.each { |_, v| v.process_scripts(self.project) } end |
#project ⇒ Object
31 32 33 |
# File 'lib/crafter.rb', line 31 def project @project ||= ProjectHelper.new end |
#set_build_settings(build_settings, configuration: 'crafter_common') ⇒ Object
59 60 61 |
# File 'lib/crafter.rb', line 59 def set_build_settings(build_settings, configuration: 'crafter_common') @build_settings[configuration] = build_settings end |
#set_language_swift(is_swift) ⇒ Object
63 64 65 |
# File 'lib/crafter.rb', line 63 def set_language_swift(is_swift) @language_swift = is_swift end |
#set_options(options) ⇒ Object
55 56 57 |
# File 'lib/crafter.rb', line 55 def () @options = end |
#setup_project ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/crafter.rb', line 67 def setup_project process_optional() process_configurations() if @configuration && !@configuration.empty? () if @options && !@options.empty? process_build_settings() if @build_settings && !@build_settings.empty? process_git() if @add_git_ignore process_pods() process_scripts() end |
#with(name, &block) ⇒ Object
27 28 29 |
# File 'lib/crafter.rb', line 27 def with(name, &block) self.find_target_configuration(name).instance_eval(&block) end |