xcoder 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/xcode/builder.rb +36 -18
- data/lib/xcode/keychain.rb +47 -0
- data/lib/xcode/version.rb +1 -1
- data/spec/keychain_spec.rb +26 -0
- metadata +12 -12
data/lib/xcode/builder.rb
CHANGED
@@ -4,6 +4,11 @@ require 'xcode/test/ocunit_report_parser.rb'
|
|
4
4
|
require 'xcode/testflight'
|
5
5
|
|
6
6
|
module Xcode
|
7
|
+
|
8
|
+
#
|
9
|
+
# This class tries to pull various bits of Xcoder together to provide a higher-level API for common
|
10
|
+
# project build tasks.
|
11
|
+
#
|
7
12
|
class Builder
|
8
13
|
attr_accessor :profile, :identity, :build_path, :keychain, :sdk
|
9
14
|
|
@@ -20,24 +25,12 @@ module Xcode
|
|
20
25
|
@build_path = "#{File.dirname(@target.project.path)}/build/"
|
21
26
|
end
|
22
27
|
|
23
|
-
def install_profile
|
24
|
-
return nil if @profile.nil?
|
25
|
-
# TODO: remove other profiles for the same app?
|
26
|
-
p = ProvisioningProfile.new(@profile)
|
27
|
-
|
28
|
-
ProvisioningProfile.installed_profiles.each do |installed|
|
29
|
-
if installed.identifiers==p.identifiers and installed.uuid==p.uuid
|
30
|
-
installed.uninstall
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
p.install
|
35
|
-
p
|
36
|
-
end
|
37
28
|
|
38
29
|
def build(sdk=@sdk)
|
39
30
|
cmd = build_command(@sdk)
|
40
|
-
|
31
|
+
with_keychain do
|
32
|
+
Xcode::Shell.execute(cmd)
|
33
|
+
end
|
41
34
|
self
|
42
35
|
end
|
43
36
|
|
@@ -78,7 +71,7 @@ module Xcode
|
|
78
71
|
cmd << "-project \"#{@target.project.path}\""
|
79
72
|
cmd << "-sdk #{@sdk}" unless @sdk.nil?
|
80
73
|
|
81
|
-
cmd << "-scheme #{@scheme.name}" unless @scheme.nil?
|
74
|
+
cmd << "-scheme \"#{@scheme.name}\"" unless @scheme.nil?
|
82
75
|
cmd << "-target \"#{@target.name}\"" if @scheme.nil?
|
83
76
|
cmd << "-configuration \"#{@config.name}\"" if @scheme.nil?
|
84
77
|
|
@@ -137,7 +130,9 @@ module Xcode
|
|
137
130
|
cmd << "--embed \"#{@profile}\""
|
138
131
|
end
|
139
132
|
|
140
|
-
|
133
|
+
with_keychain do
|
134
|
+
Xcode::Shell.execute(cmd)
|
135
|
+
end
|
141
136
|
|
142
137
|
# package dSYM
|
143
138
|
cmd = []
|
@@ -184,6 +179,29 @@ module Xcode
|
|
184
179
|
|
185
180
|
private
|
186
181
|
|
182
|
+
def with_keychain(&block)
|
183
|
+
if @keychain.nil?
|
184
|
+
yield
|
185
|
+
else
|
186
|
+
Xcode::Keychains.with_keychain_in_search_path @keychain, &block
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
def install_profile
|
191
|
+
return nil if @profile.nil?
|
192
|
+
# TODO: remove other profiles for the same app?
|
193
|
+
p = ProvisioningProfile.new(@profile)
|
194
|
+
|
195
|
+
ProvisioningProfile.installed_profiles.each do |installed|
|
196
|
+
if installed.identifiers==p.identifiers and installed.uuid==p.uuid
|
197
|
+
installed.uninstall
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
p.install
|
202
|
+
p
|
203
|
+
end
|
204
|
+
|
187
205
|
def build_command(sdk=@sdk)
|
188
206
|
profile = install_profile
|
189
207
|
cmd = []
|
@@ -191,7 +209,7 @@ module Xcode
|
|
191
209
|
cmd << "-sdk #{sdk}" unless sdk.nil?
|
192
210
|
cmd << "-project \"#{@target.project.path}\""
|
193
211
|
|
194
|
-
cmd << "-scheme #{@scheme.name}" unless @scheme.nil?
|
212
|
+
cmd << "-scheme \"#{@scheme.name}\"" unless @scheme.nil?
|
195
213
|
cmd << "-target \"#{@target.name}\"" if @scheme.nil?
|
196
214
|
cmd << "-configuration \"#{@config.name}\"" if @scheme.nil?
|
197
215
|
|
data/lib/xcode/keychain.rb
CHANGED
@@ -1,4 +1,50 @@
|
|
1
1
|
module Xcode
|
2
|
+
|
3
|
+
module Keychains
|
4
|
+
|
5
|
+
#
|
6
|
+
# Yield when the keychain is in the search path and remove it when the block returns
|
7
|
+
#
|
8
|
+
def self.with_keychain_in_search_path(kc, &block)
|
9
|
+
keychains = self.search_path
|
10
|
+
begin
|
11
|
+
self.search_path = [kc] + keychains
|
12
|
+
yield
|
13
|
+
ensure
|
14
|
+
self.search_path = keychains
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
#
|
20
|
+
# Get the list of search keychains
|
21
|
+
#
|
22
|
+
# @return [Array<Xcode::Keychain>] the array of keychains the system currently searches
|
23
|
+
#
|
24
|
+
def self.search_path
|
25
|
+
`security list-keychain`.split.map do |keychain|
|
26
|
+
Xcode::Keychain.new keychain.strip.gsub(/\"/,'')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
#
|
31
|
+
# Set the keychains search path and order
|
32
|
+
#
|
33
|
+
# @param [Array<Xcode::Keychain>] the array of keychains for the system to search when signing
|
34
|
+
#
|
35
|
+
def self.search_path=(keychains)
|
36
|
+
search_list = keychains.map do |kc|
|
37
|
+
"\"#{kc.path}\""
|
38
|
+
end
|
39
|
+
|
40
|
+
cmd = []
|
41
|
+
cmd << "security"
|
42
|
+
cmd << "list-keychain"
|
43
|
+
cmd << "-s #{search_list.join(' ')}"
|
44
|
+
Xcode::Shell.execute(cmd)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
2
48
|
class Keychain
|
3
49
|
attr_accessor :name, :path
|
4
50
|
|
@@ -143,5 +189,6 @@ module Xcode
|
|
143
189
|
yield(kc) if block_given?
|
144
190
|
kc
|
145
191
|
end
|
192
|
+
|
146
193
|
end
|
147
194
|
end
|
data/lib/xcode/version.rb
CHANGED
data/spec/keychain_spec.rb
CHANGED
@@ -38,4 +38,30 @@ describe Xcode::Keychain do
|
|
38
38
|
kc = Xcode::Keychain.login
|
39
39
|
File.exists?(kc.path).should==true
|
40
40
|
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe Xcode::Keychains do
|
44
|
+
it "should read the current keychain search path" do
|
45
|
+
Xcode::Keychains.search_path[0].path.should=~/login.keychain/
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should update the keychain search path" do
|
49
|
+
keychains = Xcode::Keychains.search_path
|
50
|
+
test_keychain = Xcode::Keychain.new("#{File.dirname(__FILE__)}/Provisioning/Test.keychain")
|
51
|
+
begin
|
52
|
+
Xcode::Keychains.search_path = [test_keychain] + keychains
|
53
|
+
`security list-keychains`.include?(test_keychain.path).should be_true
|
54
|
+
ensure
|
55
|
+
Xcode::Keychains.search_path = keychains
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should add the keychain to the search path and then remove it" do
|
60
|
+
test_keychain = Xcode::Keychain.new("#{File.dirname(__FILE__)}/Provisioning/Test.keychain")
|
61
|
+
Xcode::Keychains.with_keychain_in_search_path test_keychain do
|
62
|
+
`security list-keychains`.include?(test_keychain.path).should be_true
|
63
|
+
end
|
64
|
+
|
65
|
+
`security list-keychains`.include?(test_keychain.path).should be_false
|
66
|
+
end
|
41
67
|
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.11
|
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-04-05 00:00:00.000000000Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: json
|
17
|
-
requirement: &
|
17
|
+
requirement: &70326152915240 !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: *70326152915240
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: plist
|
28
|
-
requirement: &
|
28
|
+
requirement: &70326152914820 !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: *70326152914820
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: nokogiri
|
39
|
-
requirement: &
|
39
|
+
requirement: &70326152914400 !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: *70326152914400
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: builder
|
50
|
-
requirement: &
|
50
|
+
requirement: &70326152913980 !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: *70326152913980
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rest-client
|
61
|
-
requirement: &
|
61
|
+
requirement: &70326152913560 !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: *70326152913560
|
70
70
|
description: Provides a ruby based object-model for parsing project structures and
|
71
71
|
invoking builds
|
72
72
|
email:
|