motion-testflight 1.2 → 1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,9 +29,15 @@ SDK and be submitted to the TestFlight platform.
29
29
 
30
30
  Motion::Project::App.setup do |app|
31
31
  # ...
32
- app.testflight.sdk = 'vendor/TestFlight'
33
- app.testflight.api_token = '<insert your API token here>'
34
- app.testflight.team_token = '<insert your team token here>'
32
+ app.development do
33
+ # ...
34
+ app.testflight do
35
+ app.testflight.sdk = 'vendor/TestFlight'
36
+ app.testflight.api_token = '<insert your API token here>'
37
+ app.testflight.team_token = '<insert your team token here>'
38
+ app.testflight.notify = true # default is false
39
+ end
40
+ end
35
41
  end
36
42
 
37
43
  You can retrieve the values for +api_token+ and +team_token+ in your TestFlight account page.
@@ -27,7 +27,7 @@ unless defined?(Motion::Project::Config)
27
27
  end
28
28
 
29
29
  class TestFlightConfig
30
- attr_accessor :sdk, :api_token, :team_token, :distribution_lists
30
+ attr_accessor :sdk, :api_token, :team_token, :distribution_lists, :notify
31
31
 
32
32
  def initialize(config)
33
33
  @config = config
@@ -75,16 +75,29 @@ EOF
75
75
  end
76
76
 
77
77
  module Motion; module Project; class Config
78
+
79
+ attr_accessor :testflight_mode
80
+
78
81
  variable :testflight
79
82
 
80
83
  def testflight
81
84
  @testflight ||= TestFlightConfig.new(self)
85
+ yield @testflight if block_given? && testflight?
86
+ @testflight
82
87
  end
88
+
89
+ def testflight?
90
+ @testflight_mode == true
91
+ end
92
+
83
93
  end; end; end
84
94
 
85
95
  namespace 'testflight' do
86
96
  desc "Submit an archive to TestFlight"
87
- task :submit => 'archive' do
97
+ task :submit do
98
+
99
+ App.config_without_setup.testflight_mode = true
100
+
88
101
  # Retrieve configuration settings.
89
102
  prefs = App.config.testflight
90
103
  App.fail "A value for app.testflight.api_token is mandatory" unless prefs.api_token
@@ -92,6 +105,8 @@ namespace 'testflight' do
92
105
  distribution_lists = (prefs.distribution_lists ? prefs.distribution_lists.join(',') : nil)
93
106
  notes = ENV['notes']
94
107
  App.fail "Submission notes must be provided via the `notes' environment variable. Example: rake testflight notes='w00t'" unless notes
108
+
109
+ Rake::Task["archive"].invoke
95
110
 
96
111
  # An archived version of the .dSYM bundle is needed.
97
112
  app_dsym = App.config.app_bundle('iPhoneOS').sub(/\.app$/, '.dSYM')
@@ -102,12 +117,44 @@ namespace 'testflight' do
102
117
  end
103
118
  end
104
119
 
105
- curl = "/usr/bin/curl http://testflightapp.com/api/builds.json -F file=@\"#{App.config.archive}\" -F dsym=@\"#{app_dsym_zip}\" -F api_token='#{prefs.api_token}' -F team_token='#{prefs.team_token}' -F notes=\"#{notes}\" -F notify=True"
120
+ curl = "/usr/bin/curl http://testflightapp.com/api/builds.json -F file=@\"#{App.config.archive}\" -F dsym=@\"#{app_dsym_zip}\" -F api_token='#{prefs.api_token}' -F team_token='#{prefs.team_token}' -F notes=\"#{notes}\" -F notify=#{prefs.notify ? "True" : "False"}"
106
121
  curl << " -F distribution_lists='#{distribution_lists}'" if distribution_lists
107
122
  App.info 'Run', curl
108
123
  sh curl
109
124
  end
125
+
126
+ desc "Records if the device build is created in testflight mode, so some things can be cleaned up between mode switches"
127
+ task :record_mode do
128
+ testflight_mode = App.config_without_setup.testflight_mode ? "True" : "False"
129
+
130
+ platform = 'iPhoneOS'
131
+ bundle_path = App.config.app_bundle(platform)
132
+ build_dir = File.join(App.config.versionized_build_dir(platform))
133
+ FileUtils.mkdir_p(build_dir)
134
+ previous_testflight_mode_file = File.join(build_dir, '.testflight_mode')
135
+
136
+ previous_testflight_mode = "False"
137
+ if File.exist?(previous_testflight_mode_file)
138
+ previous_testflight_mode = File.read(previous_testflight_mode_file).strip
139
+ end
140
+ if previous_testflight_mode != testflight_mode
141
+ App.info "Testflight", "Cleaning executable, Info.plist, and PkgInfo for mode change (was: #{previous_testflight_mode}, now: #{testflight_mode})"
142
+ [
143
+ App.config.app_bundle_executable(platform), # main_exec
144
+ File.join(bundle_path, 'Info.plist'), # bundle_info_plist
145
+ File.join(bundle_path, 'PkgInfo') # bundle_pkginfo
146
+ ].each do |path|
147
+ rm_rf(path) if File.exist?(path)
148
+ end
149
+ end
150
+ File.open(previous_testflight_mode_file, 'w') do |f|
151
+ f.write testflight_mode
152
+ end
153
+ end
110
154
  end
111
155
 
112
156
  desc 'Same as testflight:submit'
113
157
  task 'testflight' => 'testflight:submit'
158
+
159
+ # record testflight mode before every device build
160
+ task 'build:device' => 'testflight:record_mode'
metadata CHANGED
@@ -1,67 +1,49 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: motion-testflight
3
- version: !ruby/object:Gem::Version
4
- hash: 11
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.3'
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 2
9
- version: "1.2"
10
6
  platform: ruby
11
- authors:
7
+ authors:
12
8
  - Laurent Sansonetti
13
9
  autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
-
17
- date: 2012-09-20 00:00:00 Z
12
+ date: 2012-10-11 00:00:00.000000000 Z
18
13
  dependencies: []
19
-
20
- description: motion-testflight allows RubyMotion projects to easily embed the TestFlight SDK and be submitted to the TestFlight platform.
14
+ description: motion-testflight allows RubyMotion projects to easily embed the TestFlight
15
+ SDK and be submitted to the TestFlight platform.
21
16
  email: lrz@hipbyte.com
22
17
  executables: []
23
-
24
18
  extensions: []
25
-
26
19
  extra_rdoc_files: []
27
-
28
- files:
20
+ files:
29
21
  - README.rdoc
30
22
  - LICENSE
31
23
  - lib/motion/project/testflight.rb
32
24
  - lib/motion-testflight.rb
33
25
  homepage: http://www.rubymotion.com
34
26
  licenses: []
35
-
36
27
  post_install_message:
37
28
  rdoc_options: []
38
-
39
- require_paths:
29
+ require_paths:
40
30
  - lib
41
- required_ruby_version: !ruby/object:Gem::Requirement
31
+ required_ruby_version: !ruby/object:Gem::Requirement
42
32
  none: false
43
- requirements:
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- hash: 3
47
- segments:
48
- - 0
49
- version: "0"
50
- required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ! '>='
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ required_rubygems_version: !ruby/object:Gem::Requirement
51
38
  none: false
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- hash: 3
56
- segments:
57
- - 0
58
- version: "0"
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
59
43
  requirements: []
60
-
61
44
  rubyforge_project:
62
- rubygems_version: 1.8.24
45
+ rubygems_version: 1.8.23
63
46
  signing_key:
64
47
  specification_version: 3
65
48
  summary: TestFlight integration for RubyMotion projects
66
49
  test_files: []
67
-