thrust 0.0.0 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/thrust +24 -3
- data/lib/{example.yml → config/example.yml} +2 -1
- data/lib/tasks/cedar.rake +39 -0
- data/lib/tasks/testflight.rake +63 -0
- data/lib/thrust_config.rb +129 -0
- metadata +6 -5
- data/lib/tasks/main.rake +0 -218
- data/lib/thrust.rb +0 -0
data/bin/thrust
CHANGED
@@ -1,6 +1,27 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
require 'fileutils'
|
2
3
|
project_root = Dir.pwd
|
3
|
-
thrust_root = File.dirname(__FILE__)
|
4
|
+
thrust_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
if (!Dir.exists?(File.join(project_root, 'thrust', 'lib', 'tasks')))
|
7
|
+
Dir.mkdir(File.join(project_root, 'thrust'))
|
8
|
+
Dir.mkdir(File.join(project_root, 'thrust', 'lib'))
|
9
|
+
Dir.mkdir(File.join(project_root, 'thrust', 'lib', 'tasks'))
|
10
|
+
end
|
11
|
+
|
12
|
+
FileUtils.cp(Dir.glob(File.join(thrust_root, 'lib', 'tasks', '*.rake')), File.join(project_root, 'thrust', 'lib', 'tasks'))
|
13
|
+
FileUtils.cp(File.join(thrust_root, 'lib', 'thrust_config.rb'), File.join(project_root, 'thrust', 'lib'))
|
14
|
+
FileUtils.cp(File.join(thrust_root, 'lib', 'config', 'example.yml'), File.join(project_root, 'thrust.example.yml'))
|
15
|
+
|
16
|
+
rakefile = File.join(project_root, 'Rakefile')
|
17
|
+
if (File.exists?(rakefile))
|
18
|
+
puts "You have an existing rakefile to add thrust tasks you should import its tasks:"
|
19
|
+
puts "Dir.glob('thrust/lib/tasks/*.rake').each { |r| import r }"
|
20
|
+
else
|
21
|
+
File.open(rakefile, 'w') do |f|
|
22
|
+
f.puts "Dir.glob('thrust/lib/tasks/*.rake').each { |r| import r }"
|
23
|
+
end
|
24
|
+
puts "a Rakefile was created for you type 'rake -T' to see a list of tasks"
|
25
|
+
end
|
26
|
+
|
27
|
+
puts "Rename #{project_root}/thrust.example.yml to #{project_root}/thrust.yml and edit it for your project."
|
@@ -1,12 +1,13 @@
|
|
1
1
|
# rename this file to thrust.yml
|
2
2
|
project_name: My Great Project
|
3
3
|
app_name: My Great Project
|
4
|
-
identity: iOS Signing Identity
|
4
|
+
identity: iOS Signing Identity
|
5
5
|
|
6
6
|
specs:
|
7
7
|
configuration: Release # or whichever iOS configuration you want to run specs under
|
8
8
|
target: Specs # Name of the spec build target
|
9
9
|
sdk: 6.1 # SDK version to build/run the specs with
|
10
|
+
binary: 'Specs/bin/ios-sim' # or 'Specs/bin/waxim'
|
10
11
|
|
11
12
|
api_token: your testflight token here
|
12
13
|
# Add testflight distrobution lists here. Rake tasks are built for all keys directly
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'tmpdir'
|
3
|
+
|
4
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'thrust_config'))
|
5
|
+
|
6
|
+
@thrust = ThrustConfig.new(Dir.getwd, File.join(Dir.getwd, 'thrust.yml'))
|
7
|
+
|
8
|
+
task :default => [:trim, :specs]
|
9
|
+
|
10
|
+
desc 'Trim whitespace'
|
11
|
+
task :trim do
|
12
|
+
@thrust.system_or_exit %Q[git status --short | awk '{if ($1 != "D" && $1 != "R") print $2}' | grep -e '.*\.[cmh]$' | xargs sed -i '' -e 's/ / /g;s/ *$//g;']
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Clean all targets'
|
16
|
+
task :clean do
|
17
|
+
@thrust.system_or_exit "xcodebuild -project #{@thrust.config['project_name']}.xcodeproj -alltargets -configuration 'AdHoc' -sdk iphoneos clean", @thrust.output_file("clean")
|
18
|
+
@thrust.system_or_exit "xcodebuild -project #{@thrust.config['project_name']}.xcodeproj -alltargets -configuration 'Debug' -sdk iphonesimulator clean", @thrust.output_file("clean")
|
19
|
+
@thrust.system_or_exit "xcodebuild -project #{@thrust.config['project_name']}.xcodeproj -alltargets -configuration 'Release' -sdk iphonesimulator clean", @thrust.output_file("clean")
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'Build specs'
|
23
|
+
task :build_specs do
|
24
|
+
@thrust.kill_simulator
|
25
|
+
@thrust.system_or_exit "xcodebuild -project #{@thrust.config['project_name']}.xcodeproj -target #{@thrust.spec_config['target']} -configuration #{@thrust.spec_config['configuration']} -sdk iphonesimulator build", @thrust.output_file("specs")
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Run specs'
|
29
|
+
task :specs => :build_specs do
|
30
|
+
binary = @thrust.spec_config['binary']
|
31
|
+
if binary =~ /waxim%/
|
32
|
+
@thrust.grep_cmd_for_failure(%Q[#{binary} -s #{@thrust.spec_config['sdk']} -f iphone -e CFFIXED_USER_HOME=#{Dir.tmpdir} -e CEDAR_HEADLESS_SPECS=1 -e CEDAR_REPORTER_CLASS=CDRDefaultReporter #{File.join(sim_dir, "#{@thrust.spec_config['target']}.app")}])
|
33
|
+
elsif binary =~ /ios-sim$/
|
34
|
+
@thrust.grep_cmd_for_failure(%Q[#{binary} launch #{File.join(@thrust.sim_dir, "#{@thrust.spec_config['target']}.app")} --sdk #{@thrust.spec_config['sdk']} --family iphone --retina --tall --setenv CFFIXED_USER_HOME=#{Dir.tmpdir} --setenv CEDAR_HEADLESS_SPECS=1 --setenv CEDAR_REPORTER_CLASS=CDRDefaultReporter])
|
35
|
+
else
|
36
|
+
puts "Uknown binary for running specs: '#{binary}'"
|
37
|
+
exit(1)
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'thrust_config'))
|
3
|
+
|
4
|
+
@thrust = ThrustConfig.new(Dir.getwd, File.join(Dir.getwd, 'thrust.yml'))
|
5
|
+
|
6
|
+
namespace :bump do
|
7
|
+
desc 'Bumps the build'
|
8
|
+
task :build do
|
9
|
+
@thrust.run_git_with_message 'Bumped build to $(agvtool what-version -terse)' do
|
10
|
+
@thrust.system_or_exit 'agvtool bump -all'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
namespace :version do
|
15
|
+
desc 'Bumps the major marketing version in (major.minor.patch)'
|
16
|
+
task :major do
|
17
|
+
@thrust.update_version(:major)
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'Bumps the minor marketing version in (major.minor.patch)'
|
21
|
+
task :minor do
|
22
|
+
@thrust.update_version(:minor)
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Bumps the patch marketing version in (major.minor.patch)'
|
26
|
+
task :patch do
|
27
|
+
@thrust.update_version(:patch)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Build custom configuration'
|
33
|
+
task :build_configuration, :configuration do |task_name, args|
|
34
|
+
build_prefix = @thrust.build_prefix_for(args[:configuration])
|
35
|
+
@thrust.system_or_exit "xcodebuild -project #{@thrust.config['project_name']}.xcodeproj -alltargets -configuration '#{args[:configuration]}' -sdk iphoneos clean", @thrust.output_file("clean")
|
36
|
+
@thrust.kill_simulator
|
37
|
+
@thrust.system_or_exit "xcodebuild -project #{@thrust.config['project_name']}.xcodeproj -target #{@thrust.config['app_name']} -configuration '#{args[:configuration]}' -sdk iphoneos build", @thrust.output_file(args[:configuration])
|
38
|
+
@thrust.system_or_exit "/usr/bin/xcrun -sdk iphoneos PackageApplication -v '#{build_prefix}.app' -o '#{build_prefix}.ipa' --sign '#{@thrust.config['identity']}'"
|
39
|
+
@thrust.system_or_exit "zip -r -T -y '#{build_prefix}.app.dSYM.zip' '#{build_prefix}.app.dSYM'"
|
40
|
+
end
|
41
|
+
|
42
|
+
namespace :testflight do
|
43
|
+
@thrust.config['distributions'].each do |task_name, info|
|
44
|
+
desc "Deploy build to testflight #{info['team']} team (use NOTIFY=false to prevent team notification)"
|
45
|
+
task task_name do
|
46
|
+
Rake::Task["testflight:deploy"].invoke(info['token'], info['default_list'], info['configuration'])
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
task :deploy, :team, :distribution_list, :configuration do |task, args|
|
51
|
+
build_prefix = @thrust.build_prefix_for(args[:configuration])
|
52
|
+
Rake::Task["bump:build"].invoke
|
53
|
+
Rake::Task["build_configuration"].invoke(args[:configuration])
|
54
|
+
@thrust.system_or_exit "curl http://testflightapp.com/api/builds.json\
|
55
|
+
-F file=@#{build_prefix}.ipa\
|
56
|
+
-F dsym=@#{build_prefix}.app.dSYM.zip\
|
57
|
+
-F api_token='#{@thrust.config['api_token']}'\
|
58
|
+
-F team_token='#{args[:team]}'\
|
59
|
+
-F notes='This build was uploaded via the upload API'\
|
60
|
+
-F notify=#{(ENV['NOTIFY'] || 'true').downcase.capitalize}\
|
61
|
+
#{"-F distribution_lists='#{args[:distribution_list]}'" if args[:distribution_list]}"
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
class ThrustConfig
|
2
|
+
attr_reader :project_root, :config, :spec_config, :build_dir
|
3
|
+
|
4
|
+
def initialize(proj_root, config_file)
|
5
|
+
@project_root = File.expand_path(proj_root)
|
6
|
+
@build_dir = File.join(project_root, 'build')
|
7
|
+
@config = YAML.load_file(config_file)
|
8
|
+
@spec_config = config['specs']
|
9
|
+
end
|
10
|
+
|
11
|
+
def build_prefix_for(configuration)
|
12
|
+
"#{build_dir}/#{configuration}-iphoneos/#{config['app_name']}"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Xcode 4.3 stores its /Developer inside /Applications/Xcode.app, Xcode 4.2 stored it in /Developer
|
16
|
+
def xcode_developer_dir
|
17
|
+
`xcode-select -print-path`.strip
|
18
|
+
end
|
19
|
+
|
20
|
+
def sim_dir
|
21
|
+
File.join(build_dir, spec_config['configuration'] + '-iphonesimulator')
|
22
|
+
end
|
23
|
+
|
24
|
+
def system_or_exit(cmd, stdout = nil)
|
25
|
+
puts "Executing #{cmd}"
|
26
|
+
cmd += " >#{stdout}" if stdout
|
27
|
+
system(cmd) or raise '******** Build failed ********'
|
28
|
+
end
|
29
|
+
|
30
|
+
def run(cmd)
|
31
|
+
puts "Executing #{cmd}"
|
32
|
+
`#{cmd}`
|
33
|
+
end
|
34
|
+
|
35
|
+
def grep_cmd_for_failure(cmd)
|
36
|
+
1.times do
|
37
|
+
puts "Executing #{cmd} and checking for FAILURE"
|
38
|
+
%x[#{cmd} > #{Dir.tmpdir}/cmd.out 2>&1]
|
39
|
+
status = $?
|
40
|
+
result = File.read("#{Dir.tmpdir}/cmd.out")
|
41
|
+
if status.success?
|
42
|
+
puts 'Results:'
|
43
|
+
puts result
|
44
|
+
if result.include?('FAILURE')
|
45
|
+
exit(1)
|
46
|
+
else
|
47
|
+
exit(0)
|
48
|
+
end
|
49
|
+
elsif status == 256
|
50
|
+
redo
|
51
|
+
else
|
52
|
+
puts "Failed to launch: #{status}"
|
53
|
+
exit(1)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def with_env_vars(env_vars)
|
59
|
+
old_values = {}
|
60
|
+
env_vars.each do |key,new_value|
|
61
|
+
old_values[key] = ENV[key]
|
62
|
+
ENV[key] = new_value
|
63
|
+
end
|
64
|
+
|
65
|
+
yield
|
66
|
+
|
67
|
+
env_vars.each_key do |key|
|
68
|
+
ENV[key] = old_values[key]
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def output_file(target)
|
73
|
+
output_dir = if ENV['IS_CI_BOX']
|
74
|
+
ENV['CC_BUILD_ARTIFACTS']
|
75
|
+
else
|
76
|
+
Dir.mkdir(build_dir) unless File.exists?(build_dir)
|
77
|
+
build_dir
|
78
|
+
end
|
79
|
+
|
80
|
+
output_file = File.join(output_dir, "#{target}.output")
|
81
|
+
puts "Output: #{output_file}"
|
82
|
+
output_file
|
83
|
+
end
|
84
|
+
|
85
|
+
def kill_simulator
|
86
|
+
system %q[killall -m -KILL "gdb"]
|
87
|
+
system %q[killall -m -KILL "otest"]
|
88
|
+
system %q[killall -m -KILL "iPhone Simulator"]
|
89
|
+
end
|
90
|
+
|
91
|
+
def update_version(release)
|
92
|
+
run_git_with_message('Changes version to $(agvtool what-marketing-version -terse)') do
|
93
|
+
version = run "agvtool what-marketing-version -terse | head -n1 |cut -f2 -d\="
|
94
|
+
puts "version !#{version}!"
|
95
|
+
build_regex = %r{^(?<major>\d+)(\.(?<minor>\d+))?(\.(?<patch>\d+))$}
|
96
|
+
if (match = build_regex.match(version))
|
97
|
+
puts "found match #{match.inspect}"
|
98
|
+
v = {:major => match[:major].to_i, :minor => match[:minor].to_i, :patch => match[:patch].to_i}
|
99
|
+
case(release)
|
100
|
+
when :major then new_build_version(v[:major] + 1, 0, 0)
|
101
|
+
when :minor then new_build_version(v[:major], v[:minor] + 1, 0)
|
102
|
+
when :patch then new_build_version(v[:major], v[:minor], v[:patch] + 1)
|
103
|
+
when :clear then new_build_version(v[:major], v[:minor], v[:patch])
|
104
|
+
end
|
105
|
+
else
|
106
|
+
raise "Unknown version #{version} it should match major.minor.patch"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def new_build_version(major, minor, patch)
|
112
|
+
version = [major, minor, patch].join(".")
|
113
|
+
system_or_exit "agvtool new-marketing-version \"#{version}\""
|
114
|
+
end
|
115
|
+
|
116
|
+
def run_git_with_message(message, &block)
|
117
|
+
if ENV['IGNORE_GIT']
|
118
|
+
puts 'WARNING NOT CHECKING FOR CLEAN WORKING DIRECTORY'
|
119
|
+
block.call
|
120
|
+
else
|
121
|
+
puts 'Checking for clean working tree...'
|
122
|
+
system_or_exit 'git diff-index --quiet HEAD'
|
123
|
+
puts 'Checking that the master branch is up to date...'
|
124
|
+
system_or_exit 'git fetch && git diff --quiet HEAD origin/master'
|
125
|
+
block.call
|
126
|
+
system_or_exit "git commit -am \"#{message}\" && git push origin head"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thrust
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -17,7 +17,7 @@ authors:
|
|
17
17
|
autorequire:
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
|
-
date: 2013-
|
20
|
+
date: 2013-07-24 00:00:00.000000000 Z
|
21
21
|
dependencies: []
|
22
22
|
description: ''
|
23
23
|
email: mc+jbritz@pivotallabs.com
|
@@ -26,9 +26,10 @@ executables:
|
|
26
26
|
extensions: []
|
27
27
|
extra_rdoc_files: []
|
28
28
|
files:
|
29
|
-
- lib/
|
30
|
-
- lib/tasks/
|
31
|
-
- lib/
|
29
|
+
- lib/thrust_config.rb
|
30
|
+
- lib/tasks/cedar.rake
|
31
|
+
- lib/tasks/testflight.rake
|
32
|
+
- lib/config/example.yml
|
32
33
|
- bin/thrust
|
33
34
|
homepage: http://github.com/dipolesource/thrust
|
34
35
|
licenses: []
|
data/lib/tasks/main.rake
DELETED
@@ -1,218 +0,0 @@
|
|
1
|
-
require 'yaml'
|
2
|
-
|
3
|
-
@thrust_config = YAML.load_file(Dir.pwd + '/thrust.yml')
|
4
|
-
@spec_config = @thrust_config['specs']
|
5
|
-
|
6
|
-
TESTFLIGHT_NOTIFICATION = ENV['NOTIFY'] || 'true'
|
7
|
-
|
8
|
-
PROJECT_ROOT = File.dirname(__FILE__)
|
9
|
-
BUILD_DIR = File.join(PROJECT_ROOT, "build")
|
10
|
-
|
11
|
-
def build_prefix_for(configuration)
|
12
|
-
"#{BUILD_DIR}/#{configuration}-iphoneos/#{@thrust_config['app_name']}"
|
13
|
-
end
|
14
|
-
|
15
|
-
def sdk_dir
|
16
|
-
"#{xcode_developer_dir}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{@spec_config['sdk']}.sdk"
|
17
|
-
end
|
18
|
-
|
19
|
-
# Xcode 4.3 stores its /Developer inside /Applications/Xcode.app, Xcode 4.2 stored it in /Developer
|
20
|
-
def xcode_developer_dir
|
21
|
-
`xcode-select -print-path`.strip
|
22
|
-
end
|
23
|
-
|
24
|
-
def build_dir(effective_platform_name)
|
25
|
-
File.join(BUILD_DIR, @spec_config['configuration'] + effective_platform_name)
|
26
|
-
end
|
27
|
-
|
28
|
-
def system_or_exit(cmd, stdout = nil)
|
29
|
-
puts "Executing #{cmd}"
|
30
|
-
cmd += " >#{stdout}" if stdout
|
31
|
-
system(cmd) or raise '******** Build failed ********'
|
32
|
-
end
|
33
|
-
|
34
|
-
def run(cmd)
|
35
|
-
puts "Executing #{cmd}"
|
36
|
-
`#{cmd}`
|
37
|
-
end
|
38
|
-
|
39
|
-
def grep_cmd_for_failure(cmd)
|
40
|
-
1.times do
|
41
|
-
puts "Executing #{cmd} and checking for FAILURE"
|
42
|
-
%x[#{cmd} > #{Dir.tmpdir}/cmd.out 2>&1]
|
43
|
-
status = $?
|
44
|
-
result = File.read("#{Dir.tmpdir}/cmd.out")
|
45
|
-
if status.success?
|
46
|
-
puts 'Results:'
|
47
|
-
puts result
|
48
|
-
if result.include?('FAILURE')
|
49
|
-
exit(1)
|
50
|
-
else
|
51
|
-
exit(0)
|
52
|
-
end
|
53
|
-
elsif status == 256
|
54
|
-
redo
|
55
|
-
else
|
56
|
-
puts "Failed to launch: #{status}"
|
57
|
-
exit(1)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def with_env_vars(env_vars)
|
63
|
-
old_values = {}
|
64
|
-
env_vars.each do |key,new_value|
|
65
|
-
old_values[key] = ENV[key]
|
66
|
-
ENV[key] = new_value
|
67
|
-
end
|
68
|
-
|
69
|
-
yield
|
70
|
-
|
71
|
-
env_vars.each_key do |key|
|
72
|
-
ENV[key] = old_values[key]
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
def output_file(target)
|
77
|
-
output_dir = if ENV['IS_CI_BOX']
|
78
|
-
ENV['CC_BUILD_ARTIFACTS']
|
79
|
-
else
|
80
|
-
Dir.mkdir(BUILD_DIR) unless File.exists?(BUILD_DIR)
|
81
|
-
BUILD_DIR
|
82
|
-
end
|
83
|
-
|
84
|
-
output_file = File.join(output_dir, "#{target}.output")
|
85
|
-
puts "Output: #{output_file}"
|
86
|
-
output_file
|
87
|
-
end
|
88
|
-
|
89
|
-
def kill_simulator
|
90
|
-
system %q[killall -m -KILL "gdb"]
|
91
|
-
system %q[killall -m -KILL "otest"]
|
92
|
-
system %q[killall -m -KILL "iPhone Simulator"]
|
93
|
-
end
|
94
|
-
|
95
|
-
task :default => [:trim, :specs]
|
96
|
-
|
97
|
-
desc 'Trim whitespace'
|
98
|
-
task :trim do
|
99
|
-
system_or_exit %Q[git status --short | awk '{if ($1 != "D" && $1 != "R") print $2}' | grep -e '.*\.[cmh]$' | xargs sed -i '' -e 's/ / /g;s/ *$//g;']
|
100
|
-
end
|
101
|
-
|
102
|
-
desc 'Clean all targets'
|
103
|
-
task :clean do
|
104
|
-
system_or_exit "xcodebuild -project #{@thrust_config['project_name']}.xcodeproj -alltargets -configuration 'AdHoc' -sdk iphoneos clean", output_file("clean")
|
105
|
-
system_or_exit "xcodebuild -project #{@thrust_config['project_name']}.xcodeproj -alltargets -configuration 'Debug' -sdk iphonesimulator clean", output_file("clean")
|
106
|
-
system_or_exit "xcodebuild -project #{@thrust_config['project_name']}.xcodeproj -alltargets -configuration 'Release' -sdk iphonesimulator clean", output_file("clean")
|
107
|
-
end
|
108
|
-
|
109
|
-
namespace :bump do
|
110
|
-
desc 'Bumps the build'
|
111
|
-
task :build do
|
112
|
-
run_git_with_message 'Bumped build to $(agvtool what-version -terse)' do
|
113
|
-
system_or_exit 'agvtool bump -all'
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
namespace :version do
|
118
|
-
desc 'Bumps the major marketing version in (major.minor.patch)'
|
119
|
-
task :major do
|
120
|
-
update_version(:major)
|
121
|
-
end
|
122
|
-
|
123
|
-
desc 'Bumps the minor marketing version in (major.minor.patch)'
|
124
|
-
task :minor do
|
125
|
-
update_version(:minor)
|
126
|
-
end
|
127
|
-
|
128
|
-
desc 'Bumps the patch marketing version in (major.minor.patch)'
|
129
|
-
task :patch do
|
130
|
-
update_version(:patch)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def update_version(release)
|
136
|
-
run_git_with_message('Changes version to $(agvtool what-marketing-version -terse)') do
|
137
|
-
version = run "agvtool what-marketing-version -terse | head -n1 |cut -f2 -d\="
|
138
|
-
puts "version !#{version}!"
|
139
|
-
build_regex = %r{^(?<major>\d+)(\.(?<minor>\d+))?(\.(?<patch>\d+))$}
|
140
|
-
if (match = build_regex.match(version))
|
141
|
-
puts "found match #{match.inspect}"
|
142
|
-
v = {:major => match[:major].to_i, :minor => match[:minor].to_i, :patch => match[:patch].to_i}
|
143
|
-
case(release)
|
144
|
-
when :major then new_build_version(v[:major] + 1, 0, 0)
|
145
|
-
when :minor then new_build_version(v[:major], v[:minor] + 1, 0)
|
146
|
-
when :patch then new_build_version(v[:major], v[:minor], v[:patch] + 1)
|
147
|
-
when :clear then new_build_version(v[:major], v[:minor], v[:patch])
|
148
|
-
end
|
149
|
-
else
|
150
|
-
raise "Unknown version #{version} it should match major.minor.patch"
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
def new_build_version(major, minor, patch)
|
156
|
-
version = [major, minor, patch].join(".")
|
157
|
-
system_or_exit "agvtool new-marketing-version \"#{version}\""
|
158
|
-
end
|
159
|
-
|
160
|
-
def run_git_with_message(message, &block)
|
161
|
-
if ENV['IGNORE_GIT']
|
162
|
-
puts 'WARNING NOT CHECKING FOR CLEAN WORKING DIRECTORY'
|
163
|
-
block.call
|
164
|
-
else
|
165
|
-
puts 'Checking for clean working tree...'
|
166
|
-
system_or_exit 'git diff-index --quiet HEAD'
|
167
|
-
puts 'Checking that the master branch is up to date...'
|
168
|
-
system_or_exit 'git fetch && git diff --quiet HEAD origin/master'
|
169
|
-
block.call
|
170
|
-
system_or_exit "git commit -am \"#{message}\" && git push origin head"
|
171
|
-
end
|
172
|
-
end
|
173
|
-
|
174
|
-
desc 'Build custom configuration'
|
175
|
-
task :build_configuration, :configuration do |task_name, args|
|
176
|
-
build_prefix = build_prefix_for(args[:configuration])
|
177
|
-
system_or_exit "xcodebuild -project #{@thrust_config['project_name']}.xcodeproj -alltargets -configuration '#{args[:configuration]}' -sdk iphoneos clean", output_file("clean")
|
178
|
-
kill_simulator
|
179
|
-
system_or_exit "xcodebuild -project #{@thrust_config['project_name']}.xcodeproj -target #{@thrust_config['app_name']} -configuration '#{args[:configuration]}' -sdk iphoneos build", output_file(args[:configuration])
|
180
|
-
system_or_exit "/usr/bin/xcrun -sdk iphoneos PackageApplication -v '#{build_prefix}.app' -o '#{build_prefix}.ipa' --sign '#{@thrust_config['identity']}'"
|
181
|
-
system_or_exit "zip -r -T -y '#{build_prefix}.app.dSYM.zip' '#{build_prefix}.app.dSYM'"
|
182
|
-
end
|
183
|
-
|
184
|
-
namespace :testflight do
|
185
|
-
@thrust_config['distributions'].each do |task_name, info|
|
186
|
-
desc "Deploy build to testflight #{info['team']} team (use NOTIFY=false to prevent team notification)"
|
187
|
-
task task_name do
|
188
|
-
Rake::Task["testflight:deploy"].invoke(info['token'], info['default_list'], info['configuration'])
|
189
|
-
end
|
190
|
-
end
|
191
|
-
|
192
|
-
task :deploy, :team, :distribution_list, :configuration do |task, args|
|
193
|
-
build_prefix = build_prefix_for(args[:configuration])
|
194
|
-
Rake::Task["bump:build"].invoke
|
195
|
-
Rake::Task["build_configuration"].invoke(args[:configuration])
|
196
|
-
system_or_exit "curl http://testflightapp.com/api/builds.json\
|
197
|
-
-F file=@#{build_prefix}.ipa\
|
198
|
-
-F dsym=@#{build_prefix}.app.dSYM.zip\
|
199
|
-
-F api_token='#{@thrust_config['api_token']}'\
|
200
|
-
-F team_token='#{args[:team]}'\
|
201
|
-
-F notes='This build was uploaded via the upload API'\
|
202
|
-
-F notify=#{TESTFLIGHT_NOTIFICATION.downcase.capitalize}\
|
203
|
-
#{"-F distribution_lists='#{args[:distribution_list]}'" if args[:distribution_list]}"
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
desc 'Build specs'
|
208
|
-
task :build_specs do
|
209
|
-
kill_simulator
|
210
|
-
system_or_exit "xcodebuild -project #{@thrust_config['project_name']}.xcodeproj -target #{@spec_config['target']} -configuration #{@spec_config['configuration']} -sdk iphonesimulator build", output_file("specs")
|
211
|
-
end
|
212
|
-
|
213
|
-
require 'tmpdir'
|
214
|
-
|
215
|
-
desc 'Run specs'
|
216
|
-
task :specs => :build_specs do
|
217
|
-
grep_cmd_for_failure(%Q[Specs/bin/ios-sim launch #{File.join(build_dir("-iphonesimulator"), "#{@spec_config['target']}.app")} --sdk #{@spec_config['sdk']} --family iphone --retina --tall --setenv CFFIXED_USER_HOME=#{Dir.tmpdir} --setenv CEDAR_HEADLESS_SPECS=1 --setenv CEDAR_REPORTER_CLASS=CDRDefaultReporter])
|
218
|
-
end
|
data/lib/thrust.rb
DELETED
File without changes
|