xcoder 0.1.14 → 0.1.15
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/lib/xcode/builder.rb +1 -1
- data/lib/xcode/builder/base_builder.rb +10 -2
- data/lib/xcode/deploy/testflight.rb +60 -0
- data/lib/xcode/shell.rb +2 -2
- data/lib/xcode/shell/command.rb +1 -1
- data/lib/xcode/version.rb +1 -1
- data/spec/builder_spec.rb +15 -14
- data/spec/deploy_testflight_spec.rb +27 -0
- metadata +15 -13
- data/lib/xcode/testflight.rb +0 -59
data/lib/xcode/builder.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'xcode/shell'
|
2
2
|
require 'xcode/provisioning_profile'
|
3
3
|
require 'xcode/test/parsers/ocunit_parser.rb'
|
4
|
-
require 'xcode/testflight'
|
4
|
+
require 'xcode/deploy/testflight'
|
5
5
|
require 'xcode/builder/base_builder.rb'
|
6
6
|
require 'xcode/builder/project_target_config_builder.rb'
|
7
7
|
require 'xcode/builder/scheme_builder.rb'
|
@@ -78,11 +78,19 @@ module Xcode
|
|
78
78
|
report
|
79
79
|
end
|
80
80
|
|
81
|
+
#
|
82
|
+
# Upload to testflight
|
83
|
+
#
|
84
|
+
# The testflight object is yielded so further configuration can be performed before uploading
|
85
|
+
#
|
86
|
+
# @param api_token the API token for your testflight account
|
87
|
+
# @param team_token the token for the team you want to deploy to
|
88
|
+
#
|
81
89
|
def testflight(api_token, team_token)
|
82
90
|
raise "Can't find #{ipa_path}, do you need to call builder.package?" unless File.exists? ipa_path
|
83
|
-
raise "Can't
|
91
|
+
raise "Can't find #{dsym_zip_path}, do you need to call builder.package?" unless File.exists? dsym_zip_path
|
84
92
|
|
85
|
-
testflight = Xcode::Testflight.new(api_token, team_token)
|
93
|
+
testflight = Xcode::Deploy::Testflight.new(api_token, team_token)
|
86
94
|
yield(testflight) if block_given?
|
87
95
|
testflight.upload(ipa_path, dsym_zip_path)
|
88
96
|
end
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module Xcode
|
5
|
+
module Deploy
|
6
|
+
class Testflight
|
7
|
+
attr_accessor :api_token, :team_token, :notify, :proxy, :notes, :lists
|
8
|
+
|
9
|
+
def initialize(api_token, team_token)
|
10
|
+
@api_token = api_token
|
11
|
+
@team_token = team_token
|
12
|
+
@notify = true
|
13
|
+
@notes = nil
|
14
|
+
@lists = []
|
15
|
+
@proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
|
16
|
+
end
|
17
|
+
|
18
|
+
def upload(ipa_path, dsymzip_path=nil)
|
19
|
+
puts "Uploading to Testflight..."
|
20
|
+
|
21
|
+
# RestClient.proxy = @proxy || ENV['http_proxy'] || ENV['HTTP_PROXY']
|
22
|
+
# RestClient.log = '/tmp/restclient.log'
|
23
|
+
#
|
24
|
+
# response = RestClient.post('http://testflightapp.com/api/builds.json',
|
25
|
+
# :file => File.new(ipa_path),
|
26
|
+
# :dsym => File.new(dsymzip_path),
|
27
|
+
# :api_token => @api_token,
|
28
|
+
# :team_token => @team_token,
|
29
|
+
# :notes => @notes,
|
30
|
+
# :notify => @notify ? 'True' : 'False',
|
31
|
+
# :distribution_lists => @lists.join(',')
|
32
|
+
# )
|
33
|
+
#
|
34
|
+
# json = JSON.parse(response)
|
35
|
+
# puts " + Done, got: #{json.inspect}"
|
36
|
+
# json
|
37
|
+
|
38
|
+
cmd = Xcode::Shell::Command.new 'curl'
|
39
|
+
cmd << "--proxy #{@proxy}" unless @proxy.nil? or @proxy==''
|
40
|
+
cmd << "-X POST http://testflightapp.com/api/builds.json"
|
41
|
+
cmd << "-F file=@\"#{ipa_path}\""
|
42
|
+
cmd << "-F dsym=@\"#{dsymzip_path}\"" unless dsymzip_path.nil?
|
43
|
+
cmd << "-F api_token='#{@api_token}'"
|
44
|
+
cmd << "-F team_token='#{@team_token}'"
|
45
|
+
cmd << "-F notes=\"#{@notes}\"" unless @notes.nil?
|
46
|
+
cmd << "-F notify=#{@notify ? 'True' : 'False'}"
|
47
|
+
cmd << "-F distribution_lists='#{@lists.join(',')}'" unless @lists.count==0
|
48
|
+
|
49
|
+
response = Xcode::Shell.execute(cmd)
|
50
|
+
|
51
|
+
json = JSON.parse(response.join(''))
|
52
|
+
puts " + Done, got: #{json.inspect}"
|
53
|
+
|
54
|
+
yield(json) if block_given?
|
55
|
+
|
56
|
+
json
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/lib/xcode/shell.rb
CHANGED
@@ -5,9 +5,9 @@ module Xcode
|
|
5
5
|
|
6
6
|
class ExecutionError < StandardError; end
|
7
7
|
|
8
|
-
def self.execute(
|
8
|
+
def self.execute(cmd, show_output=true)
|
9
9
|
out = []
|
10
|
-
cmd =
|
10
|
+
cmd = cmd.to_s
|
11
11
|
|
12
12
|
puts "EXECUTE: #{cmd}"
|
13
13
|
IO.popen (cmd) do |f|
|
data/lib/xcode/shell/command.rb
CHANGED
data/lib/xcode/version.rb
CHANGED
data/spec/builder_spec.rb
CHANGED
@@ -46,30 +46,31 @@ describe Xcode::Builder do
|
|
46
46
|
|
47
47
|
describe "#testflight" do
|
48
48
|
|
49
|
-
let(:testflight_parameters) do
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
49
|
+
# let(:testflight_parameters) do
|
50
|
+
# ['curl',
|
51
|
+
# "--proxy http://proxyhost:8080",
|
52
|
+
# "-X POST http://testflightapp.com/api/builds.json",
|
53
|
+
# "-F file=@\"#{subject.ipa_path}\"",
|
54
|
+
# "-F dsym=@\"#{subject.dsym_zip_path}\"",
|
55
|
+
# "-F api_token='api_token'",
|
56
|
+
# "-F team_token='team_token'",
|
57
|
+
# "-F notes=\"some notes\"",
|
58
|
+
# "-F notify=True",
|
59
|
+
# "-F distribution_lists='List1,List2'"]
|
60
|
+
# end
|
61
61
|
|
62
62
|
it "should upload ipa and dsym to testflight" do
|
63
63
|
subject.build.package
|
64
64
|
|
65
|
-
|
66
|
-
|
65
|
+
result = subject.testflight("api_token", "team_token") do |tf|
|
66
|
+
tf.should_receive(:upload).with(subject.ipa_path, subject.dsym_zip_path).and_return('result')
|
67
67
|
tf.proxy = "http://proxyhost:8080"
|
68
68
|
tf.notes = "some notes"
|
69
69
|
tf.lists << "List1"
|
70
70
|
tf.lists << "List2"
|
71
71
|
end
|
72
72
|
|
73
|
+
result.should == 'result'
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe Xcode::Deploy::Testflight do
|
4
|
+
|
5
|
+
let(:testflight) { Xcode::Deploy::Testflight.new 'api token', 'team token' }
|
6
|
+
|
7
|
+
it "should be configured with api and team token" do
|
8
|
+
testflight.api_token.should == 'api token'
|
9
|
+
testflight.team_token.should == 'team token'
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should call curl with correct bulld paths" do
|
13
|
+
Xcode::Shell.should_receive(:execute) do |arg|
|
14
|
+
arg.is_a? Xcode::Shell::Command
|
15
|
+
arg.cmd.should == 'curl'
|
16
|
+
arg.args.should include('-F file=@"ipa path"')
|
17
|
+
arg.args.should include('-F dsym=@"dsym path"')
|
18
|
+
arg.args.should include("-F api_token='api token'")
|
19
|
+
arg.args.should include("-F team_token='team token'")
|
20
|
+
|
21
|
+
['{"response":"ok"}']
|
22
|
+
end
|
23
|
+
response = testflight.upload('ipa path', 'dsym path')
|
24
|
+
response['response'].should == 'ok'
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcoder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-12-05 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
17
|
-
requirement: &
|
17
|
+
requirement: &70353485685920 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70353485685920
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: plist
|
28
|
-
requirement: &
|
28
|
+
requirement: &70353473165820 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70353473165820
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: nokogiri
|
39
|
-
requirement: &
|
39
|
+
requirement: &70353473165400 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70353473165400
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: builder
|
50
|
-
requirement: &
|
50
|
+
requirement: &70353473164980 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70353473164980
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rest-client
|
61
|
-
requirement: &
|
61
|
+
requirement: &70353473164560 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ! '>='
|
@@ -66,7 +66,7 @@ dependencies:
|
|
66
66
|
version: '0'
|
67
67
|
type: :runtime
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70353473164560
|
70
70
|
description: Provides a ruby based object-model for parsing project structures and
|
71
71
|
invoking builds
|
72
72
|
email:
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/xcode/core_ext/fixnum.rb
|
106
106
|
- lib/xcode/core_ext/hash.rb
|
107
107
|
- lib/xcode/core_ext/string.rb
|
108
|
+
- lib/xcode/deploy/testflight.rb
|
108
109
|
- lib/xcode/file_reference.rb
|
109
110
|
- lib/xcode/group.rb
|
110
111
|
- lib/xcode/info_plist.rb
|
@@ -127,7 +128,6 @@ files:
|
|
127
128
|
- lib/xcode/test/report.rb
|
128
129
|
- lib/xcode/test/report/suite_result.rb
|
129
130
|
- lib/xcode/test/report/test_result.rb
|
130
|
-
- lib/xcode/testflight.rb
|
131
131
|
- lib/xcode/variant_group.rb
|
132
132
|
- lib/xcode/version.rb
|
133
133
|
- lib/xcode/workspace.rb
|
@@ -165,6 +165,7 @@ files:
|
|
165
165
|
- spec/builder_spec.rb
|
166
166
|
- spec/configuration_list_spec.rb
|
167
167
|
- spec/configuration_spec.rb
|
168
|
+
- spec/deploy_testflight_spec.rb
|
168
169
|
- spec/group_spec.rb
|
169
170
|
- spec/integration/builder_spec.rb
|
170
171
|
- spec/integration/cedar_install_spec.rb
|
@@ -239,6 +240,7 @@ test_files:
|
|
239
240
|
- spec/builder_spec.rb
|
240
241
|
- spec/configuration_list_spec.rb
|
241
242
|
- spec/configuration_spec.rb
|
243
|
+
- spec/deploy_testflight_spec.rb
|
242
244
|
- spec/group_spec.rb
|
243
245
|
- spec/integration/builder_spec.rb
|
244
246
|
- spec/integration/cedar_install_spec.rb
|
data/lib/xcode/testflight.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'rest-client'
|
2
|
-
require 'json'
|
3
|
-
|
4
|
-
module Xcode
|
5
|
-
class Testflight
|
6
|
-
attr_accessor :api_token, :team_token, :notify, :proxy, :notes, :lists
|
7
|
-
|
8
|
-
def initialize(api_token, team_token)
|
9
|
-
@api_token = api_token
|
10
|
-
@team_token = team_token
|
11
|
-
@notify = true
|
12
|
-
@notes = nil
|
13
|
-
@lists = []
|
14
|
-
@proxy = ENV['http_proxy'] || ENV['HTTP_PROXY']
|
15
|
-
end
|
16
|
-
|
17
|
-
def upload(ipa_path, dsymzip_path=nil)
|
18
|
-
puts "Uploading to Testflight..."
|
19
|
-
|
20
|
-
# RestClient.proxy = @proxy || ENV['http_proxy'] || ENV['HTTP_PROXY']
|
21
|
-
# RestClient.log = '/tmp/restclient.log'
|
22
|
-
#
|
23
|
-
# response = RestClient.post('http://testflightapp.com/api/builds.json',
|
24
|
-
# :file => File.new(ipa_path),
|
25
|
-
# :dsym => File.new(dsymzip_path),
|
26
|
-
# :api_token => @api_token,
|
27
|
-
# :team_token => @team_token,
|
28
|
-
# :notes => @notes,
|
29
|
-
# :notify => @notify ? 'True' : 'False',
|
30
|
-
# :distribution_lists => @lists.join(',')
|
31
|
-
# )
|
32
|
-
#
|
33
|
-
# json = JSON.parse(response)
|
34
|
-
# puts " + Done, got: #{json.inspect}"
|
35
|
-
# json
|
36
|
-
|
37
|
-
cmd = []
|
38
|
-
cmd << 'curl'
|
39
|
-
cmd << "--proxy #{@proxy}" unless @proxy.nil? or @proxy==''
|
40
|
-
cmd << "-X POST http://testflightapp.com/api/builds.json"
|
41
|
-
cmd << "-F file=@\"#{ipa_path}\""
|
42
|
-
cmd << "-F dsym=@\"#{dsymzip_path}\"" unless dsymzip_path.nil?
|
43
|
-
cmd << "-F api_token='#{@api_token}'"
|
44
|
-
cmd << "-F team_token='#{@team_token}'"
|
45
|
-
cmd << "-F notes=\"#{@notes}\"" unless @notes.nil?
|
46
|
-
cmd << "-F notify=#{@notify ? 'True' : 'False'}"
|
47
|
-
cmd << "-F distribution_lists='#{@lists.join(',')}'" unless @lists.count==0
|
48
|
-
|
49
|
-
response = Xcode::Shell.execute(cmd)
|
50
|
-
|
51
|
-
json = JSON.parse(response.join(''))
|
52
|
-
puts " + Done, got: #{json.inspect}"
|
53
|
-
|
54
|
-
yield(json) if block_given?
|
55
|
-
|
56
|
-
json
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|