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
- #build_number_from_podspec ⇒ Object
- #built_app_long_version_suffix ⇒ Object
- #built_app_path ⇒ Object
- #deploy_using(strategy_name, &block) ⇒ Object
- #increment_pod_number ⇒ Object
- #ipa_name ⇒ Object
- #ipa_path ⇒ Object
- #next_build_number ⇒ Object
- #release_notes_text ⇒ Object
- #release_using(strategy_name, &block) ⇒ Object
- #timestamp_plist ⇒ Object
Instance Method Details
#app_bundle_path ⇒ Object
143 144 145 |
# File 'lib/xcode_builder/configuration.rb', line 143 def app_bundle_path "#{package_destination_path}/#{app_name}.app" end |
#app_file_name ⇒ Object
38 39 40 41 |
# File 'lib/xcode_builder/configuration.rb', line 38 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" end |
#build_arguments ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/xcode_builder/configuration.rb', line 13 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}'" unless target == nil args << "-scheme '#{scheme}'" unless scheme == nil args << "-project '#{project_file_path}'" if project_file_path end # args << "-sdk #{sdk}" args << "-configuration '#{configuration}'" args << "BUILD_DIR=\"#{File. build_dir}\"" if xcodebuild_extra_args args.concat xcodebuild_extra_args if xcodebuild_extra_args.is_a? Array args << "#{xcodebuild_extra_args}" if xcodebuild_extra_args.is_a? String end args end |
#build_number ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/xcode_builder/configuration.rb', line 43 def build_number # we have a podspec file, so try to get the version out of that if (podspec_file != nil) && (File.exists? podspec_file) then # get hte version out of the pod file return build_number_from_podspec end return nil end |
#build_number_from_podspec ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/xcode_builder/configuration.rb', line 52 def build_number_from_podspec file = File.open(podspec_file, "r") begin version_line = file.gets end while version_line.eql? "\n" if match = version_line.match(/\s*version\s*=\s*["'](.*)["']\s*/i) version = match.captures end return version[0] end |
#built_app_long_version_suffix ⇒ Object
127 128 129 130 131 132 133 |
# File 'lib/xcode_builder/configuration.rb', line 127 def built_app_long_version_suffix if build_number == nil then "" else "-#{build_number}" end end |
#built_app_path ⇒ Object
135 136 137 |
# File 'lib/xcode_builder/configuration.rb', line 135 def built_app_path File.join("#{build_dir}", "#{configuration}-#{sdk}", "#{app_file_name}") end |
#deploy_using(strategy_name, &block) ⇒ Object
147 148 149 150 151 152 153 154 |
# File 'lib/xcode_builder/configuration.rb', line 147 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 |
#increment_pod_number ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/xcode_builder/configuration.rb', line 77 def increment_pod_number if !increment_plist_version then return false end if podspec_file == nil then return false end # keep the old build number around old_build_number = build_number # bump the spec version and save it spec_content = File.open(podspec_file, "r").read old_version = "version = '#{old_build_number}'" new_version = "version = '#{next_build_number}'" spec_content = spec_content.sub old_version, new_version File.open(podspec_file, "w") {|f| f.write spec_content } true end |
#ipa_name ⇒ Object
122 123 124 125 |
# File 'lib/xcode_builder/configuration.rb', line 122 def ipa_name prefix = app_name == nil ? target : app_name "#{prefix}#{built_app_long_version_suffix}.ipa" end |
#ipa_path ⇒ Object
139 140 141 |
# File 'lib/xcode_builder/configuration.rb', line 139 def ipa_path File.join(File.(package_destination_path), ipa_name) end |
#next_build_number ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/xcode_builder/configuration.rb', line 64 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
8 9 10 11 |
# File 'lib/xcode_builder/configuration.rb', line 8 def release_notes_text return release_notes.call if release_notes.is_a? Proc release_notes end |
#release_using(strategy_name, &block) ⇒ Object
156 157 158 159 160 161 162 163 164 |
# File 'lib/xcode_builder/configuration.rb', line 156 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 |
#timestamp_plist ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/xcode_builder/configuration.rb', line 103 def if info_plist == nil then return false end Array(info_plist).each {|current_plist| # read the plist and extract data plist = CFPropertyList::List.new(:file => File.(current_plist)) data = CFPropertyList.native_types(plist.value) # re inject new version number into the data data["CFBundleVersion"] = DateTime.now.strftime("%Y-%m-%d %k:%M") # recreate the plist and save it plist.value = CFPropertyList.guess(data) plist.save(current_plist, CFPropertyList::List::FORMAT_XML) } end |