Class: XcodeBuilder::Configuration
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- XcodeBuilder::Configuration
- Defined in:
- lib/xcode_builder/configuration.rb
Instance Method Summary collapse
- #app_bundle_path ⇒ Object
- #app_file_name ⇒ Object
- #build_arguments ⇒ Object
- #build_number ⇒ Object
- #built_app_long_version_suffix ⇒ Object
- #built_app_path ⇒ Object
- #built_dsym_path ⇒ Object
- #deploy_using(strategy_name, &block) ⇒ Object
- #derived_build_dir ⇒ Object
- #derived_build_dir_from_build_output ⇒ Object
- #dsym_name ⇒ Object
- #dsym_path ⇒ Object
- #final_bundle_id ⇒ Object
- #info_plist_path ⇒ Object
- #ipa_name ⇒ Object
- #ipa_path ⇒ Object
- #next_build_number ⇒ Object
- #release_notes_text ⇒ Object
- #release_using(strategy_name, &block) ⇒ Object
- #zipped_package_name ⇒ Object
Instance Method Details
#app_bundle_path ⇒ Object
142 143 144 |
# File 'lib/xcode_builder/configuration.rb', line 142 def app_bundle_path "#{package_destination_path}/#{app_name}.#{app_extension}" end |
#app_file_name ⇒ Object
36 37 38 39 |
# File 'lib/xcode_builder/configuration.rb', line 36 def app_file_name raise ArgumentError, "app_name or target must be set in the BetaBuilder configuration block" if app_name.nil? "#{app_name}.#{app_extension}" end |
#build_arguments ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/xcode_builder/configuration.rb', line 12 def build_arguments args = [] if workspace_file_path raise "A scheme is required if building from a workspace" unless scheme args << "-workspace '#{workspace_file_path}'" args << "-scheme '#{scheme}'" else args << "-target '#{target}'" args << "-project '#{project_file_path}'" if project_file_path end args << "-sdk #{sdk}" args << "-configuration '#{configuration}'" args << "BUILD_DIR=#{File. build_dir}" unless build_dir == :derived if xcodebuild_extra_args args.concat xcodebuild_extra_args if xcodebuild_extra_args.is_a? Array args << "#{xcodebuild_extra_args}" if xcodears.is_a? String end args end |
#build_number ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/xcode_builder/configuration.rb', line 62 def build_number # no plist is found, return a nil version if (info_plist_path == nil) || (!File.exists? info_plist_path) then return nil end # read the plist and extract data plist = CFPropertyList::List.new(:file => info_plist_path) data = CFPropertyList.native_types(plist.value) data["CFBundleVersion"] end |
#built_app_long_version_suffix ⇒ Object
87 88 89 90 91 92 93 |
# File 'lib/xcode_builder/configuration.rb', line 87 def built_app_long_version_suffix if build_number == nil then "" else "-#{build_number}" end end |
#built_app_path ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/xcode_builder/configuration.rb', line 100 def built_app_path sdk_extension = if sdk.eql? "macosx" then "" else "-#{sdk}" end if build_dir == :derived File.join("#{derived_build_dir}", "#{configuration}#{sdk_extension}", "#{app_file_name}") else File.join("#{build_dir}", "#{configuration}#{sdk_extension}", "#{app_file_name}") end end |
#built_dsym_path ⇒ Object
109 110 111 |
# File 'lib/xcode_builder/configuration.rb', line 109 def built_dsym_path "#{built_app_path}.dSYM" end |
#deploy_using(strategy_name, &block) ⇒ Object
146 147 148 149 150 151 152 153 |
# File 'lib/xcode_builder/configuration.rb', line 146 def deploy_using(strategy_name, &block) if DeploymentStrategies.valid_strategy?(strategy_name.to_sym) self.deployment_strategy = DeploymentStrategies.build(strategy_name, self) self.deployment_strategy.configure(&block) else raise "Unknown deployment strategy '#{strategy_name}'." end end |
#derived_build_dir ⇒ Object
113 114 115 116 117 118 |
# File 'lib/xcode_builder/configuration.rb', line 113 def derived_build_dir workspace_name = Pathname.new(workspace_file_path).basename.to_s.split(".")[0] for dir in Dir[File.join(File.("~/Library/Developer/Xcode/DerivedData"), "#{workspace_name}-*")] return "#{dir}/Build/Products" if File.read( File.join(dir, "info.plist") ).match workspace_file_path end end |
#derived_build_dir_from_build_output ⇒ Object
121 122 123 124 |
# File 'lib/xcode_builder/configuration.rb', line 121 def derived_build_dir_from_build_output output = BuildOutputParser.new(File.read("build.output")) output.build_output_dir end |
#dsym_name ⇒ Object
134 135 136 |
# File 'lib/xcode_builder/configuration.rb', line 134 def dsym_name "#{app_name}#{built_app_long_version_suffix}.dSYM.zip" end |
#dsym_path ⇒ Object
138 139 140 |
# File 'lib/xcode_builder/configuration.rb', line 138 def dsym_path File.join(File.(package_destination_path), dsym_name) end |
#final_bundle_id ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/xcode_builder/configuration.rb', line 49 def final_bundle_id final_plist_path = "#{app_bundle_path}/Info.plist" # no plist is found, return a nil version if (final_plist_path == nil) || (!File.exists? final_plist_path) then return nil end # read the plist and extract data plist = CFPropertyList::List.new(:file => final_plist_path) data = CFPropertyList.native_types(plist.value) data["CFBundleIdentifier"] end |
#info_plist_path ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/xcode_builder/configuration.rb', line 41 def info_plist_path if info_plist != nil then File. info_plist else nil end end |
#ipa_name ⇒ Object
95 96 97 98 |
# File 'lib/xcode_builder/configuration.rb', line 95 def ipa_name prefix = app_name == nil ? target : app_name "#{prefix}#{built_app_long_version_suffix}.ipa" end |
#ipa_path ⇒ Object
130 131 132 |
# File 'lib/xcode_builder/configuration.rb', line 130 def ipa_path File.join(File.(package_destination_path), ipa_name) end |
#next_build_number ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/xcode_builder/configuration.rb', line 74 def next_build_number # if we don't have a current version, we don't have a next version :) if build_number == nil then return nil end # get a hold on the build number and increment it version_components = build_number.split(".") new_build_number = version_components.pop.to_i + 1 version_components.push new_build_number.to_s version_components.join "." end |
#release_notes_text ⇒ Object
7 8 9 10 |
# File 'lib/xcode_builder/configuration.rb', line 7 def release_notes_text return release_notes.call if release_notes.is_a? Proc release_notes end |
#release_using(strategy_name, &block) ⇒ Object
155 156 157 158 159 160 161 162 163 |
# File 'lib/xcode_builder/configuration.rb', line 155 def release_using(strategy_name, &block) if ReleaseStrategies.valid_strategy?(strategy_name.to_sym) self.release_strategy = ReleaseStrategies.build(strategy_name, self) self.release_strategy.configure(&block) self.release_strategy.prepare else raise "Unknown release strategy '#{strategy_name}'." end end |
#zipped_package_name ⇒ Object
126 127 128 |
# File 'lib/xcode_builder/configuration.rb', line 126 def zipped_package_name "#{app_name}#{built_app_long_version_suffix}.zip" end |