xcoder 0.1.2 → 0.1.3

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.
@@ -12,6 +12,25 @@ describe Xcode::BuildPhase do
12
12
  let(:first_build_file) { "main.m" }
13
13
  let(:second_build_file) { "AppDelegate.m" }
14
14
 
15
+ describe "#files" do
16
+ it "should return the correct number of build files" do
17
+ subject.files.count.should == 2
18
+ end
19
+
20
+ it "should return BuildFiles with references to their files" do
21
+ subject.files.each do |file|
22
+ file.file_ref.should be_kind_of Xcode::FileReference
23
+ end
24
+ end
25
+ end
26
+
27
+ describe "#file" do
28
+ it "should return the build file specified from the file name" do
29
+ subject.file('main.m').should_not be_nil
30
+ subject.file('main.m').file_ref.path.should == 'main.m'
31
+ end
32
+ end
33
+
15
34
  describe "#build_files" do
16
35
  it "should return the correct number of build files" do
17
36
  subject.build_files.count.should == 2
@@ -37,6 +56,15 @@ describe Xcode::BuildPhase do
37
56
  subject.build_file('NewFile.m').should_not be_nil
38
57
  end
39
58
  end
59
+
60
+ describe "#add_build_file_without_arc" do
61
+ it "should add the specified file to the build phase with the correct parameters" do
62
+ source_file = project.groups.create_file 'ArcLessSource.m'
63
+ subject.add_build_file_without_arc source_file
64
+ subject.build_file('ArcLessSource.m').should_not be_nil
65
+ subject.file('ArcLessSource.m').settings.should == { 'COMPILER_FLAGS' => "-fno-objc-arc" }
66
+ end
67
+ end
40
68
  end
41
69
 
42
70
 
data/spec/builder_spec.rb CHANGED
@@ -43,8 +43,9 @@ describe Xcode::Builder do
43
43
  end
44
44
 
45
45
  it "should upload ipa and dsym to testflight" do
46
- Xcode::Shell.should_receive(:execute).with(testflight_parameters).and_return(['{}'])
46
+ subject.build.package
47
47
 
48
+ Xcode::Shell.should_receive(:execute).with(testflight_parameters).and_return(['{}'])
48
49
  subject.testflight("api_token", "team_token") do |tf|
49
50
  tf.proxy = "http://proxyhost:8080"
50
51
  tf.notes = "some notes"
data/spec/group_spec.rb CHANGED
@@ -34,7 +34,7 @@ describe Xcode::Group do
34
34
  end
35
35
  end
36
36
 
37
- describe "#add_group" do
37
+ describe "#create_group" do
38
38
  it "should return the group" do
39
39
  subject.create_group('TestGroup').should_not be_nil
40
40
  end
@@ -50,7 +50,19 @@ describe Xcode::Group do
50
50
  subgroup.identifier.should == found_subgroup.identifier
51
51
  end
52
52
  end
53
+ end
54
+
55
+ describe "#remove!" do
53
56
 
57
+ let!(:subject) { project.group('created/groups/to') }
58
+ let!(:group_losing_a_child) { project.group('created/groups') }
59
+ let!(:remove_grandchild) { project.group('created/groups/to/here') }
60
+
61
+ it "should remove the group and all the children" do
62
+ subject.supergroup.remove!
63
+ group_losing_a_child.groups.should be_empty
64
+ end
65
+
54
66
  end
55
67
 
56
68
  describe "Files" do
@@ -86,6 +98,47 @@ describe Xcode::Group do
86
98
  end
87
99
  end
88
100
 
101
+ describe "#create_system_framework" do
102
+
103
+ let(:framework_name) { 'CFNetwork' }
104
+ let(:full_framework_name) { 'CFNetwork.framework' }
105
+
106
+ before(:each) do
107
+ subject.create_system_framework framework_name
108
+ end
109
+
110
+ it "should create the framework within the group" do
111
+ subject.file(full_framework_name).should_not be_nil
112
+ end
113
+
114
+ it "should not create the framework again if it exists" do
115
+ subject.exists?(full_framework_name).should be_true
116
+ subject.create_system_framework framework_name
117
+ subject.file(full_framework_name).count.should == 1
118
+ end
119
+
120
+ end
121
+
122
+ describe "#create_system_library" do
123
+
124
+ let(:library_name) { 'libz.dylib' }
125
+
126
+ it "should create the system library within the group" do
127
+ subject.create_system_library library_name
128
+ end
129
+
130
+ it "should create a system library with the correct path" do
131
+ subject.create_system_library(library_name).path.should == "usr/lib/libz.dylib"
132
+ end
133
+
134
+ it "should not create a system library twice" do
135
+ subject.create_system_library library_name
136
+ subject.create_system_library library_name
137
+ subject.file(library_name).count.should == 1
138
+ end
139
+
140
+ end
141
+
89
142
  end
90
143
 
91
144
  end
@@ -21,71 +21,46 @@ describe "Cedar", :integration => true do
21
21
  target.name = 'Specs'
22
22
  target.product_name = 'Specs'
23
23
 
24
- # @todo create the following files within the project file
25
-
26
- # E21EB9D614E357CF0058122A /* Specs.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Specs.app; sourceTree = BUILT_PRODUCTS_DIR; };
27
- # Adding an application needs to set the productReference in the target
28
- # productReference = E21EB9D614E357CF0058122A /* Specs.app */;
29
-
30
24
  application_file = target.create_product_reference 'Specs'
31
25
 
32
26
  # Create the Specs group
33
27
 
34
- specs_group = project.groups.create_group('Specs')
35
- supporting_group = specs_group.create_group('Supporting Files')
36
-
28
+ supporting_group = project.group('Specs/SupportingFiles')
29
+
30
+ # Create the Source File and add it to the sources build phase
37
31
 
38
- # E21EB9E114E357CF0058122A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
39
32
  main_source = supporting_group.create_file 'name' => 'main.m', 'path' => 'Specs/main.m'
40
33
 
41
34
  target.create_build_phase :sources do |source|
42
35
  source.add_build_file main_source
43
36
  end
44
-
45
- # E21EB9DD14E357CF0058122A /* Specs-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Specs-Info.plist"; sourceTree = "<group>"; };
46
-
37
+
38
+ # Create the InfoPlist file and add it to the Resrouces build phase
39
+
47
40
  supporting_group.create_file 'name' => 'Specs-Info.plist', 'path' => 'Specs/Specs-Info.plist'
48
-
49
- # E2B8B9F214E395B400D08897 /* InfoPlist.strings */ = {
50
- # isa = PBXVariantGroup;
51
- # children = (
52
- # E2B8B9F314E395B400D08897 /* en */,
53
- # );
54
- # name = InfoPlist.strings;
55
- # path = Specs/en.lproj;
56
- # sourceTree = "<group>";
57
- # };
58
-
41
+
59
42
  infoplist_file = supporting_group.create_infoplist 'name' => 'InfoPlist.strings', 'path' => 'Specs'
60
43
  infoplist_file.create_file 'name' => 'en', 'path' => 'en.lproj/InfoPlist.strings'
61
44
 
62
- # E21EB9DF14E357CF0058122A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
63
- # infofile = supporting_group.create_file 'name' => 'en', 'path' => 'en.lproj/InfoPlist.strings'
64
-
65
45
  target.create_build_phase :resources do |resources|
66
46
  resources.add_build_file infoplist_file
67
47
  end
68
48
 
69
- # E21EB9E314E357CF0058122A /* Specs-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Specs-Prefix.pch"; sourceTree = "<group>"; };
70
49
  prefix_file = supporting_group.create_file 'name' => 'Specs-Prefix.pch', 'path' => 'Specs/Specs-Prefix.pch'
71
-
72
- # E21EB9D814E357CF0058122A /* UIKit.framework in Frameworks */,
73
- # 7165D454146B4EA100DE2F0E /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
74
- # E21EB9D914E357CF0058122A /* Foundation.framework in Frameworks */,
75
- # E21EB9DA14E357CF0058122A /* CoreGraphics.framework in Frameworks */,
76
-
77
- # E21EB9EE14E359840058122A /* Cedar-iPhone.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "Cedar-iPhone.framework"; path = "Vendor/Frameworks/Cedar-iPhone.framework"; sourceTree = "<group>"; };
78
- cedar_framework = target.project.frameworks_group.create_framework 'name' => 'Cedar-iPhone.framework', 'path' => 'Vendor/Frameworks/Cedar-iPhone.framework', 'sourceTree' => '<group>'
79
50
 
80
- # @todo this is dumb to have the first being called. There must be a more clear way
51
+ # Create the custom framework and add it to the frameworks build phase
52
+
53
+ cedar_framework = target.project.frameworks_group.create_framework 'name' => 'Cedar-iPhone.framework', 'path' => 'Vendor/Frameworks/Cedar-iPhone.framework', 'sourceTree' => '<group>'
81
54
 
82
55
  target.create_build_phase :framework do |frameworks|
83
56
  frameworks.add_build_file cedar_framework
84
- frameworks.add_build_file target.project.frameworks_group.file('UIKit.framework').first
85
- frameworks.add_build_file target.project.frameworks_group.file('Foundation.framework').first
86
- frameworks.add_build_file target.project.frameworks_group.file('CoreGraphics.framework').first
57
+ frameworks.add_build_file project.file('Frameworks/UIKit.framework')
58
+ frameworks.add_build_file project.file('Frameworks/Foundation.framework')
59
+ frameworks.add_build_file project.file('Frameworks/CoreGraphics.framework')
87
60
  end
88
61
 
62
+ # Add the necessary configurations
63
+
89
64
  target.create_configurations :debug, :release do |config|
90
65
  config.set 'GCC_PREFIX_HEADER', 'Specs/Specs-Prefix.pch'
91
66
  config.set 'INFOPLIST_FILE', 'Specs/Specs-Info.plist'
@@ -3,23 +3,31 @@ require 'xcoder'
3
3
 
4
4
  describe Xcode::Keychain do
5
5
  it "should create a keychain" do
6
- kc = Xcode::Keychain.temp_keychain('Test.keychain') do |kc|
7
- puts kc.path
6
+ path = nil
7
+ kc = Xcode::Keychain.temp do |kc|
8
+ path = kc.path
8
9
  File.exists?(kc.path).should==true
9
10
  end
10
- File.exists?(Xcode::Keychain.new('Test.keychain').path).should==false
11
+ File.exists?(path).should==false
11
12
  end
12
13
 
13
14
  it "should import a certificate" do
14
- Xcode::Keychain.temp_keychain('Test2.keychain') do |kc|
15
+ Xcode::Keychain.temp do |kc|
15
16
  kc.import "#{File.dirname(__FILE__)}/Provisioning/TestUser.p12", 'testpassword'
16
17
  kc.identities.size.should==1
17
18
  kc.identities[0].should=="Test User"
18
19
  end
19
20
  end
20
21
 
22
+ it "should open an existing keychain" do
23
+ kc = Xcode::Keychain.new("#{File.dirname(__FILE__)}/Provisioning/Test.keychain")
24
+ kc.unlock 'testpassword'
25
+ kc.identities.size.should==1
26
+ kc.identities[0].should=="Test User"
27
+ end
28
+
21
29
  it "should fetch the login keychain" do
22
- kc = Xcode::Keychain.login_keychain
30
+ kc = Xcode::Keychain.login
23
31
  File.exists?(kc.path).should==true
24
32
  end
25
33
  end
data/spec/project_spec.rb CHANGED
@@ -146,4 +146,16 @@ describe Xcode::Project do
146
146
  end
147
147
  end
148
148
 
149
+ describe "#object_version" do
150
+ it "should return the correct version" do
151
+ project.object_version.should == 46
152
+ end
153
+ end
154
+
155
+ describe "#archive_version" do
156
+ it "should return the correct version" do
157
+ project.archive_version.should == 1
158
+ end
159
+ end
160
+
149
161
  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.2
4
+ version: 0.1.3
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-02-12 00:00:00.000000000Z
13
+ date: 2012-02-15 00:00:00.000000000Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: json
17
- requirement: &70112887595360 !ruby/object:Gem::Requirement
17
+ requirement: &70167770001540 !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: *70112887595360
25
+ version_requirements: *70167770001540
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: plist
28
- requirement: &70112887594940 !ruby/object:Gem::Requirement
28
+ requirement: &70167770001120 !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: *70112887594940
36
+ version_requirements: *70167770001120
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: nokogiri
39
- requirement: &70112887594520 !ruby/object:Gem::Requirement
39
+ requirement: &70167770000700 !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: *70112887594520
47
+ version_requirements: *70167770000700
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: builder
50
- requirement: &70112887594100 !ruby/object:Gem::Requirement
50
+ requirement: &70167770000280 !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: *70112887594100
58
+ version_requirements: *70167770000280
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rest-client
61
- requirement: &70112887593680 !ruby/object:Gem::Requirement
61
+ requirement: &70167769999860 !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: *70112887593680
69
+ version_requirements: *70167769999860
70
70
  description: Provides a ruby based object-model for parsing project structures and
71
71
  invoking builds
72
72
  email:
@@ -118,6 +118,7 @@ files:
118
118
  - lib/xcode/workspace.rb
119
119
  - lib/xcoder.rb
120
120
  - xcoder.gemspec
121
+ - spec/Provisioning/Test.keychain
121
122
  - spec/Provisioning/TestUser.p12
122
123
  - spec/TestProject/Buildfile
123
124
  - spec/TestProject/TestProject.xcodeproj/project.pbxproj
@@ -178,6 +179,7 @@ signing_key:
178
179
  specification_version: 3
179
180
  summary: Ruby wrapper around xcodebuild, xcrun, agvtool and pbxproj files
180
181
  test_files:
182
+ - spec/Provisioning/Test.keychain
181
183
  - spec/Provisioning/TestUser.p12
182
184
  - spec/TestProject/Buildfile
183
185
  - spec/TestProject/TestProject.xcodeproj/project.pbxproj
@@ -213,3 +215,4 @@ test_files:
213
215
  - spec/test_report_spec.rb
214
216
  - spec/workspace_spec.rb
215
217
  - spec/xcode_spec.rb
218
+ has_rdoc: