Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec = Gem::Specification.new do |s|

# Change these as appropriate
s.name = "betabuilder"
s.version = "0.7.4.1"
s.version = "0.7.4.18"
s.summary = "A set of Rake tasks and utilities for managing iOS ad-hoc builds"
s.author = "Luke Redpath"
s.email = "luke@lukeredpath.co.uk"
Expand Down
6 changes: 3 additions & 3 deletions betabuilder.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

Gem::Specification.new do |s|
s.name = "betabuilder"
s.version = "0.7.4.1"
s.version = "0.7.4.18"

s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Luke Redpath"]
s.date = "2012-05-16"
s.date = "2013-08-27"
s.email = "luke@lukeredpath.co.uk"
s.extra_rdoc_files = ["README.md", "LICENSE", "CHANGES.md"]
s.files = ["CHANGES.md", "LICENSE", "README.md", "lib/beta_builder", "lib/beta_builder/archived_build.rb", "lib/beta_builder/build_output_parser.rb", "lib/beta_builder/deployment_strategies", "lib/beta_builder/deployment_strategies/testflight.rb", "lib/beta_builder/deployment_strategies/web.rb", "lib/beta_builder/deployment_strategies.rb", "lib/beta_builder.rb", "lib/betabuilder.rb"]
s.homepage = "http://github.com/lukeredpath/betabuilder"
s.rdoc_options = ["--main", "README.md"]
s.require_paths = ["lib"]
s.rubygems_version = "1.8.11"
s.rubygems_version = "1.8.23"
s.summary = "A set of Rake tasks and utilities for managing iOS ad-hoc builds"

if s.respond_to? :specification_version then
Expand Down
33 changes: 25 additions & 8 deletions lib/beta_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ def build_arguments
args = ""
if workspace_path
raise "A scheme is required if building from a workspace" unless scheme
args << "-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 = "-target \"#{target}\" -configuration '#{configuration}' -sdk iphoneos"
args << " -project \"#{project_file_path}\"" if project_file_path
end

args << " -arch \"#{arch}\"" unless arch.nil?
Expand Down Expand Up @@ -75,15 +75,23 @@ def ipa_name
"#{target}.ipa"
end
end

def built_app_path

def dsym_name
"#{app_file_name}.dSYM"
end

def built_path
if build_dir == :derived
"#{derived_build_dir_from_build_output}/#{configuration}-iphoneos/#{app_file_name}"
"#{derived_build_dir_from_build_output}/#{configuration}-iphoneos/"
else
"#{build_dir}/#{configuration}-iphoneos/#{app_file_name}"
"#{build_dir}/#{configuration}-iphoneos/"
end
end

def built_app_path
"#{built_path}/#{app_file_name}"
end

def derived_build_dir_from_build_output
output = BuildOutputParser.new(File.read("build.output"))
output.build_output_dir
Expand All @@ -92,6 +100,10 @@ def derived_build_dir_from_build_output
def built_app_dsym_path
"#{built_app_path}.dSYM"
end

def built_app_zipped_dsym_path
"#{built_app_path}.dSYM.zip"
end

def dist_path
File.join("pkg/dist")
Expand All @@ -117,7 +129,9 @@ def define
namespace(@namespace) do
desc "Build the beta release of the app"
task :build => :clean do
xcodebuild @configuration.build_arguments, "build"
arch_args = ""
arch_args << "VALID_ARCHS=\"#{@configuration.arch}\"" unless @configuration.arch.nil?
xcodebuild @configuration.build_arguments, "build", arch_args
end

task :clean do
Expand All @@ -138,6 +152,9 @@ def define
Dir.chdir("pkg") do
system("zip -r '#{@configuration.ipa_name}' Payload")
end
Dir.chdir(@configuration.built_path) do
system("ditto -c -k --sequesterRsrc --keepParent #{@configuration.dsym_name} #{@configuration.dsym_name}.zip")
end
FileUtils.mkdir('pkg/dist')
FileUtils.mv("pkg/#{@configuration.ipa_name}", "pkg/dist")
end
Expand Down
2 changes: 1 addition & 1 deletion lib/beta_builder/archived_build.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def write_plist_to(path)
"ApplicationPath" => File.join("Applications", @configuration.app_file_name),
"CFBundleIdentifier" => metadata["CFBundleIdentifier"],
"CFBundleShortVersionString" => version,
"IconPaths" => metadata["CFBundleIconFiles"].map { |file| File.join("Applications", @configuration.app_file_name, file) }
"IconPaths" => metadata["CFBundleIcons"]["CFBundlePrimaryIcon"]["CFBundleIconFiles"].map { |file| File.join("Applications", @configuration.app_file_name, file) }
},
"ArchiveVersion" => 1.0,
"Comment" => @configuration.release_notes_text,
Expand Down
9 changes: 6 additions & 3 deletions lib/beta_builder/deployment_strategies/testflight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def generate_release_notes(&block)
end
end
end

def deploy
release_notes = get_notes
payload = {
Expand All @@ -25,12 +25,14 @@ def deploy
:notes => release_notes,
:distribution_lists => (@configuration.distribution_lists || []).join(","),
:notify => @configuration.notify || false,
:replace => @configuration.replace || false
:replace => @configuration.replace || false,
:dsym => File.new(@configuration.built_app_zipped_dsym_path, 'rb')
}
puts "Uploading build to TestFlight..."
if @configuration.verbose
puts "ipa path: #{@configuration.ipa_path}"
puts "release notes: #{release_notes}"
puts "payload = ", payload
end

if @configuration.dry_run
Expand All @@ -40,6 +42,7 @@ def deploy

begin
response = RestClient.post(ENDPOINT, payload, :accept => :json)
puts "response = ", response
rescue => e
response = e.response
end
Expand Down Expand Up @@ -67,7 +70,7 @@ def get_notes_using_editor
system("#{editor} #{filepath}")
@configuration.release_notes = File.read(filepath)
ensure
rm_rf(dir)
FileUtils.rm_rf(dir)
end
end

Expand Down