xcodebuild-rb 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,144 @@
1
+ require 'spec_helper'
2
+
3
+ describe XcodeBuild::OutputTranslator do
4
+ let(:delegate) { mock('delegate', :respond_to? => true) }
5
+ let(:translator) { XcodeBuild::OutputTranslator.new(delegate, ignore_global_translations: true) }
6
+ let(:translation) { translator.translations[0] }
7
+
8
+ before do
9
+ translator.use_translation XcodeBuild::Translations::Cleaning
10
+
11
+ delegate_should_respond_to(:beginning_translation_of_line)
12
+ delegate.stub(:beginning_translation_of_line).and_return(true)
13
+
14
+ translator.should have(1).translations
15
+ end
16
+
17
+ context "before it detects that a build has started" do
18
+ it "reports that it is not cleaning" do
19
+ translation.should_not be_cleaning
20
+ end
21
+
22
+ it "notifies the delegate of the start of a clean with the default configuration" do
23
+ delegate.should_receive(:clean_started).with(
24
+ target: "ExampleProject",
25
+ project: "ExampleProject",
26
+ configuration: "Release",
27
+ default: true
28
+ )
29
+ translator << "=== CLEAN NATIVE TARGET ExampleProject OF PROJECT ExampleProject WITH THE DEFAULT CONFIGURATION (Release) ==="
30
+ end
31
+
32
+ it "notifies the delegate of the start of a clean with a non-default configuration" do
33
+ delegate.should_receive(:clean_started).with(
34
+ target: "ExampleProject",
35
+ project: "ExampleProject",
36
+ configuration: "Debug",
37
+ default: false
38
+ )
39
+ translator << "=== CLEAN NATIVE TARGET ExampleProject OF PROJECT ExampleProject WITH THE CONFIGURATION Debug ==="
40
+ end
41
+
42
+ it "treats :clean_started as a required delegate message and raise if it doesn't respond" do
43
+ delegate_should_not_respond_to(:clean_started)
44
+ -> {
45
+ translator << "=== CLEAN NATIVE TARGET ExampleProject OF PROJECT ExampleProject WITH THE CONFIGURATION Debug ==="
46
+
47
+ }.should raise_error(XcodeBuild::OutputTranslator::MissingDelegateMethodError)
48
+ end
49
+ end
50
+
51
+ context "once a clean start has been detected" do
52
+ before do
53
+ translation.stub(:cleaning?).and_return(true)
54
+ end
55
+
56
+ it "notifies the delegate of a single clean step" do
57
+ delegate.should_receive(:clean_step).with(
58
+ type: "Clean.Remove",
59
+ arguments: ["clean", "build/Release-iphoneos/ExampleProject.app"]
60
+ )
61
+ translator << "\n"
62
+ translator << "Clean.Remove clean build/Release-iphoneos/ExampleProject.app"
63
+ end
64
+
65
+ it "notifies the delegate when the clean failed" do
66
+ delegate.should_receive(:clean_failed)
67
+ translator << "\n\n\n"
68
+ translator << "** CLEAN FAILED **"
69
+ end
70
+
71
+ it "treats :clean_failed as a required delegate message and raise if it doesn't respond" do
72
+ delegate_should_not_respond_to(:clean_failed)
73
+ -> {
74
+ translator << "** CLEAN FAILED **"
75
+
76
+ }.should raise_error(XcodeBuild::OutputTranslator::MissingDelegateMethodError)
77
+ end
78
+
79
+ it "notifies the delegate when the clean succeeded" do
80
+ delegate.should_receive(:clean_succeeded)
81
+ translator << "\n\n\n"
82
+ translator << "** CLEAN SUCCEEDED **"
83
+ end
84
+
85
+ it "treats :clean_succeeded as a required delegate message and raise if it doesn't respond" do
86
+ delegate_should_not_respond_to(:clean_succeeded)
87
+ -> {
88
+ translator << "** CLEAN SUCCEEDED **"
89
+
90
+ }.should raise_error(XcodeBuild::OutputTranslator::MissingDelegateMethodError)
91
+ end
92
+
93
+ it "notifies the delegate of clean step failures" do
94
+ delegate.should_receive(:clean_step_failed).with(
95
+ type: "Clean.Remove",
96
+ arguments: ["clean", "build/Release-iphoneos/ExampleProject.app"]
97
+ )
98
+ translator << "The following build commands failed:"
99
+ translator << "\tClean.Remove clean build/Release-iphoneos/ExampleProject.app"
100
+ translator << "(1 failure)"
101
+ end
102
+
103
+ it "treats :clean_step_failed as an optional delegate message" do
104
+ delegate_should_not_respond_to(:clean_step_failed)
105
+ delegate.should_not_receive(:clean_step_failed)
106
+ translator << "The following build commands failed:"
107
+ translator << "\tClean.Remove clean build/Release-iphoneos/ExampleProject.app"
108
+ translator << "(1 failure)"
109
+ end
110
+
111
+ it "notifies the delegate of errors for different clean steps" do
112
+ delegate.should_receive(:clean_error_detected).with(
113
+ message: "Error Domain=NSCocoaErrorDomain Code=513 ExampleProject couldn't be removed"
114
+ )
115
+
116
+ translator << "Clean.Remove clean build/Release-iphoneos/ExampleProject.app"
117
+ translator << "error: Error Domain=NSCocoaErrorDomain Code=513 ExampleProject couldn't be removed"
118
+ translator << "Command builtin-rm failed with exit code -1"
119
+ translator << ""
120
+ end
121
+
122
+ it "notifies the delegate of multiple errors for the same clean step" do
123
+ delegate.should_receive(:clean_error_detected).with(
124
+ message: "Error Domain=NSCocoaErrorDomain Code=513 ExampleProject couldn't be removed"
125
+ ).twice
126
+
127
+ translator << "Clean.Remove clean build/Release-iphoneos/ExampleProject.app"
128
+ translator << "error: Error Domain=NSCocoaErrorDomain Code=513 ExampleProject couldn't be removed"
129
+ translator << "error: Error Domain=NSCocoaErrorDomain Code=513 ExampleProject couldn't be removed"
130
+ translator << "Command builtin-rm failed with exit code -1"
131
+ translator << ""
132
+ end
133
+
134
+ it "treats :clean_error_detected as an optional delegate message" do
135
+ delegate_should_not_respond_to(:clean_error_detected)
136
+ delegate.should_not_receive(:clean_error_detected)
137
+
138
+ translator << "Clean.Remove clean build/Release-iphoneos/ExampleProject.app"
139
+ translator << "error: Error Domain=NSCocoaErrorDomain Code=513 ExampleProject couldn't be removed"
140
+ translator << "Command builtin-rm failed with exit code -1"
141
+ translator << ""
142
+ end
143
+ end
144
+ end
metadata ADDED
@@ -0,0 +1,164 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: xcodebuild-rb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Luke Redpath
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-01-30 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: state_machine
16
+ requirement: &2154406900 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 1.1.2
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2154406900
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &2154406500 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2154406500
36
+ - !ruby/object:Gem::Dependency
37
+ name: rake
38
+ requirement: &2154405960 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 0.9.2.2
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2154405960
47
+ - !ruby/object:Gem::Dependency
48
+ name: rdoc
49
+ requirement: &2154405460 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2154405460
58
+ - !ruby/object:Gem::Dependency
59
+ name: guard-rspec
60
+ requirement: &2154405080 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2154405080
69
+ - !ruby/object:Gem::Dependency
70
+ name: growl
71
+ requirement: &2154404620 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2154404620
80
+ - !ruby/object:Gem::Dependency
81
+ name: timecop
82
+ requirement: &2154404200 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2154404200
91
+ - !ruby/object:Gem::Dependency
92
+ name: chronic
93
+ requirement: &2154403780 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *2154403780
102
+ description:
103
+ email: luke@lukeredpath.co.uk
104
+ executables:
105
+ - rbxcb
106
+ extensions: []
107
+ extra_rdoc_files:
108
+ - README.md
109
+ files:
110
+ - LICENSE
111
+ - README.md
112
+ - bin/rbxcb
113
+ - spec/build_task_spec.rb
114
+ - spec/output_translator_spec.rb
115
+ - spec/reporting/build_reporting_spec.rb
116
+ - spec/reporting/clean_reporting_spec.rb
117
+ - spec/spec_helper.rb
118
+ - spec/translations/building_translations_spec.rb
119
+ - spec/translations/cleaning_translations_spec.rb
120
+ - lib/xcode_build/build_action.rb
121
+ - lib/xcode_build/build_step.rb
122
+ - lib/xcode_build/formatters/progress_formatter.rb
123
+ - lib/xcode_build/formatters.rb
124
+ - lib/xcode_build/output_translator.rb
125
+ - lib/xcode_build/reporter.rb
126
+ - lib/xcode_build/reporting/build_reporting.rb
127
+ - lib/xcode_build/reporting/clean_reporting.rb
128
+ - lib/xcode_build/tasks/build_task.rb
129
+ - lib/xcode_build/translations/building.rb
130
+ - lib/xcode_build/translations/cleaning.rb
131
+ - lib/xcode_build/translations.rb
132
+ - lib/xcode_build/utilities/colorize.rb
133
+ - lib/xcode_build.rb
134
+ - lib/xcodebuild.rb
135
+ homepage: http://github.com/lukeredpath/xcodebuild-rb
136
+ licenses: []
137
+ post_install_message:
138
+ rdoc_options:
139
+ - --main
140
+ - README.md
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ segments:
150
+ - 0
151
+ hash: -953845023481219688
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ requirements: []
159
+ rubyforge_project:
160
+ rubygems_version: 1.8.11
161
+ signing_key:
162
+ specification_version: 3
163
+ summary: Build Xcode projects using Rake
164
+ test_files: []