thrust 0.0.0

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 ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ project_root = Dir.pwd
3
+ thrust_root = File.dirname(__FILE__)
4
+
5
+ FileUtils.cp(thrust_root + '/../lib/tasks/main.rake', project_root + '/Rakefile')
6
+ FileUtils.cp(thrust_root + '/../lib/example.yml', project_root + '/thrust.example.yml')
data/lib/example.yml ADDED
@@ -0,0 +1,28 @@
1
+ # rename this file to thrust.yml
2
+ project_name: My Great Project
3
+ app_name: My Great Project
4
+ identity: iOS Signing Identity # be sure to escape semicolons
5
+
6
+ specs:
7
+ configuration: Release # or whichever iOS configuration you want to run specs under
8
+ target: Specs # Name of the spec build target
9
+ sdk: 6.1 # SDK version to build/run the specs with
10
+
11
+ api_token: your testflight token here
12
+ # Add testflight distrobution lists here. Rake tasks are built for all keys directly
13
+ # under distribution.
14
+ distributions:
15
+ # builds rake testflight:devs task to deploy to the distrobution list. To create a second
16
+ # deploy task, uncomment and modify the structure below.
17
+ devs: # http://testflightapp.com/dashboard/team/edit
18
+ team: TestFlight Team Name
19
+ token: TestFlight Team Token
20
+ default_list: Default Distribution List to Permission for the build
21
+ configuration: iOS configuration to build with e.g. Debug, Release, etc.
22
+
23
+ # builds rake testflight:foo
24
+ # foo:
25
+ # team: Foos
26
+ # token: somethingthatlookslikeyourapitoken
27
+ # default_list: Foo People
28
+ # configuration: Release
@@ -0,0 +1,218 @@
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 ADDED
File without changes
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thrust
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Michael McCormick
9
+ - Johnathon Britz
10
+ - Jonathan Barnes
11
+ - Andrew Kitchen
12
+ - Tyler Schultz
13
+ - Wiley Kestner
14
+ - Brandon Liu
15
+ - Jeff Hui
16
+ - Philip Kuryloski
17
+ autorequire:
18
+ bindir: bin
19
+ cert_chain: []
20
+ date: 2013-06-05 00:00:00.000000000 Z
21
+ dependencies: []
22
+ description: ''
23
+ email: mc+jbritz@pivotallabs.com
24
+ executables:
25
+ - thrust
26
+ extensions: []
27
+ extra_rdoc_files: []
28
+ files:
29
+ - lib/thrust.rb
30
+ - lib/tasks/main.rake
31
+ - lib/example.yml
32
+ - bin/thrust
33
+ homepage: http://github.com/dipolesource/thrust
34
+ licenses: []
35
+ post_install_message:
36
+ rdoc_options: []
37
+ require_paths:
38
+ - lib
39
+ required_ruby_version: !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 1.8.25
54
+ signing_key:
55
+ specification_version: 3
56
+ summary: iOS raketasks
57
+ test_files: []