Permalink
Browse files

Merge pull request #23 from chaione/master

Some improvements (supply arch flag, dry run & verbose config, lazy fetch release notes)
  • Loading branch information...
2 parents 4598bb2 + ce4a7c1 commit a9a72333315487c1492e31be7c74b4d5031c9c8c @lukeredpath committed Sep 2, 2011
Showing with 34 additions and 11 deletions.
  1. +17 −6 lib/beta_builder.rb
  2. +3 −2 lib/beta_builder/archived_build.rb
  3. +14 −3 lib/beta_builder/deployment_strategies/testflight.rb
View
@@ -18,31 +18,42 @@ def initialize(namespace = :beta, &block)
:workspace_path => nil,
:scheme => nil,
:app_name => nil,
+ :arch => nil,
:xcode4_archive_mode => false,
- :skip_clean => false
+ :skip_clean => false,
+ :verbose => false,
+ :dry_run => false
)
@namespace = namespace
yield @configuration if block_given?
define
end
-
+
def xcodebuild(*args)
# we're using tee as we still want to see our build output on screen
system("#{@configuration.xcodebuild_path} #{args.join(" ")} | tee build.output")
end
-
+
class Configuration < OpenStruct
+ def release_notes_text
+ return release_notes.call if release_notes.is_a? Proc
+ release_notes
+ end
def build_arguments
+ args = ""
if workspace_path
raise "A scheme is required if building from a workspace" unless scheme
- "-workspace '#{workspace_path}' -scheme '#{scheme}' -configuration '#{configuration}'"
+ args << "-workspace '#{workspace_path}' -scheme '#{scheme}' -configuration '#{configuration}'"
else
args = "-target '#{target}' -configuration '#{configuration}' -sdk iphoneos"
args << " -project #{project_file_path}" if project_file_path
- args
end
+
+ args << " -arch \"#{arch}\"" unless arch.nil?
+
+ args
end
-
+
def archive_name
app_name || target
end
@@ -70,15 +70,16 @@ def save_to(path)
private
def write_plist_to(path)
+ version = metadata["CFBundleShortVersionString"] || metadata["CFBundleVersion"]
plist = {
"ApplicationProperties" => {
"ApplicationPath" => File.join("Applications", @configuration.app_file_name),
"CFBundleIdentifier" => metadata["CFBundleIdentifier"],
- "CFBundleShortVersionString" => metadata["CFBundleShortVersionString"],
+ "CFBundleShortVersionString" => version,
"IconPaths" => metadata["CFBundleIconFiles"].map { |file| File.join("Applications", @configuration.app_file_name, file) }
},
"ArchiveVersion" => 1.0,
- "Comment" => @configuration.release_notes,
+ "Comment" => @configuration.release_notes_text,
"CreationDate" => Time.now,
"Name" => @configuration.archive_name,
"SchemeName" => @configuration.scheme
@@ -11,21 +11,31 @@ class TestFlight < Strategy
def extended_configuration_for_strategy
proc do
def generate_release_notes(&block)
- self.release_notes = yield if block_given?
+ self.release_notes = block if block
end
end
end
def deploy
+ release_notes = get_notes
payload = {
:api_token => @configuration.api_token,
:team_token => @configuration.team_token,
:file => File.new(@configuration.ipa_path, 'rb'),
- :notes => get_notes,
+ :notes => release_notes,
:distribution_lists => (@configuration.distribution_lists || []).join(","),
:notify => @configuration.notify || false
}
puts "Uploading build to TestFlight..."
+ if @configuration.verbose
+ puts "ipa path: #{@configuration.ipa_path}"
+ puts "release notes: #{release_notes}"
+ end
+
+ if @configuration.dry_run
+ puts '** Dry Run - No action here! **'
+ return
+ end
begin
response = RestClient.post(ENDPOINT, payload, :accept => :json)
@@ -43,7 +53,8 @@ def deploy
private
def get_notes
- @configuration.release_notes || get_notes_using_editor || get_notes_using_prompt
+ notes = @configuration.release_notes_text
+ notes || get_notes_using_editor || get_notes_using_prompt
end
def get_notes_using_editor

0 comments on commit a9a7233

Please sign in to comment.