hudson 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Changelog.md +3 -0
- data/Gemfile.lock +11 -43
- data/README.md +3 -151
- data/Rakefile +0 -77
- data/bin/hudson +2 -10
- data/hudson.gemspec +2 -12
- data/lib/hudson.rb +1 -8
- data/lib/hudson/version.rb +1 -1
- metadata +8 -203
- data/features/default_host.feature +0 -19
- data/features/development.feature +0 -14
- data/features/launch_server.feature +0 -17
- data/features/listing_jobs.feature +0 -34
- data/features/manage_jobs.feature +0 -207
- data/features/manage_slave_nodes.feature +0 -80
- data/features/step_definitions/common_steps.rb +0 -197
- data/features/step_definitions/fixture_project_steps.rb +0 -8
- data/features/step_definitions/hudson_steps.rb +0 -104
- data/features/step_definitions/scm_steps.rb +0 -12
- data/features/support/common.rb +0 -37
- data/features/support/env.rb +0 -14
- data/features/support/hooks.rb +0 -16
- data/features/support/hudson_helpers.rb +0 -6
- data/features/support/matchers.rb +0 -10
- data/lib/hudson/api.rb +0 -219
- data/lib/hudson/cli.rb +0 -253
- data/lib/hudson/cli/formatting.rb +0 -53
- data/lib/hudson/config.rb +0 -27
- data/lib/hudson/core_ext/hash.rb +0 -9
- data/lib/hudson/core_ext/object/blank.rb +0 -77
- data/lib/hudson/hudson-cli.jar +0 -0
- data/lib/hudson/installation.rb +0 -136
- data/lib/hudson/job_config_builder.rb +0 -287
- data/lib/hudson/project_scm.rb +0 -22
- data/lib/hudson/remote.rb +0 -11
- data/spec/fixtures/ec2_global.config.xml +0 -103
- data/spec/fixtures/rails.multi.config.xml +0 -82
- data/spec/fixtures/rails.single.config.triggers.xml +0 -84
- data/spec/fixtures/rails.single.config.xml +0 -80
- data/spec/fixtures/ruby.multi-ruby-multi-labels.config.xml +0 -84
- data/spec/fixtures/ruby.multi.config.xml +0 -77
- data/spec/fixtures/ruby.single.config.xml +0 -58
- data/spec/fixtures/therubyracer.config.xml +0 -77
- data/spec/hash_key_cleaner_spec.rb +0 -25
- data/spec/job_config_builder_spec.rb +0 -137
- data/spec/spec_helper.rb +0 -15
@@ -1,19 +0,0 @@
|
|
1
|
-
Feature: Display default host information
|
2
|
-
|
3
|
-
Scenario: Display default host information if it is setup
|
4
|
-
Given I run local executable "hudson" with arguments "list --host localhost --port 3010"
|
5
|
-
When I run local executable "hudson" with arguments "default_host"
|
6
|
-
Then I should see exactly
|
7
|
-
"""
|
8
|
-
http://localhost:3010
|
9
|
-
"""
|
10
|
-
|
11
|
-
Scenario: Display warning if never used Hudson.rb before
|
12
|
-
When I run local executable "hudson" with arguments "default_host"
|
13
|
-
Then I should see exactly
|
14
|
-
"""
|
15
|
-
ERROR: Either use --host or add remote servers.
|
16
|
-
"""
|
17
|
-
|
18
|
-
|
19
|
-
|
@@ -1,14 +0,0 @@
|
|
1
|
-
Feature: Development processes of hudson itself (rake tasks)
|
2
|
-
|
3
|
-
As a Newgem maintainer or contributor
|
4
|
-
I want rake tasks to maintain and release the gem
|
5
|
-
So that I can spend time on the tests and code, and not excessive time on maintenance processes
|
6
|
-
|
7
|
-
Scenario: Generate RubyGem
|
8
|
-
Given this project is active project folder
|
9
|
-
When I invoke task "rake clean" so that I start with nothing
|
10
|
-
And I invoke task "rake build"
|
11
|
-
Then file with name matching "pkg/hudson-*.gem" is created
|
12
|
-
And file with name matching "hudson.gemspec" is created
|
13
|
-
And the file "hudson.gemspec" is a valid gemspec
|
14
|
-
|
@@ -1,17 +0,0 @@
|
|
1
|
-
Feature: Running a Hudson Server
|
2
|
-
As a hudson server administrator
|
3
|
-
I want to be able to easily control a hudson server
|
4
|
-
In order to spend my time on how the process operates, not how to start stop and control it.
|
5
|
-
|
6
|
-
Scenario: Start a Hudson Server (hudson server)
|
7
|
-
Given env variable $HOME set to project path "home"
|
8
|
-
And "home/.hudson" folder is deleted
|
9
|
-
And hudson is using a stock warfile
|
10
|
-
And there is nothing listening on port 5001
|
11
|
-
And there is nothing listening on port 5002
|
12
|
-
And I cleanup any hudson processes with control port 5002
|
13
|
-
When I run hudson server with arguments "--port 5001 --control 5002 --daemon --logfile=server.log"
|
14
|
-
Then I should see a hudson server on port 5001
|
15
|
-
And folder "home/.hudson/server" is created
|
16
|
-
And folder "home/.hudson/server/javatmp" is created
|
17
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
Feature: Listing jobs
|
2
|
-
I want to see the status of jobs on servers I'm interested in
|
3
|
-
|
4
|
-
Scenario: List jobs on a non-existent server (hudson list)
|
5
|
-
When I run local executable "hudson" with arguments "list --host localhost --port 9999"
|
6
|
-
Then I should see exactly
|
7
|
-
"""
|
8
|
-
No connection available to the server.
|
9
|
-
"""
|
10
|
-
|
11
|
-
Scenario: List jobs on a server with no jobs (hudson list)
|
12
|
-
Given I have a Hudson server running
|
13
|
-
And the Hudson server has no current jobs
|
14
|
-
When I run local executable "hudson" with arguments "list --host localhost --port 3010"
|
15
|
-
Then I should see exactly
|
16
|
-
"""
|
17
|
-
http://localhost:3010: no jobs
|
18
|
-
"""
|
19
|
-
|
20
|
-
Scenario: List jobs on a server with jobs (hudson list)
|
21
|
-
Given I have a Hudson server running
|
22
|
-
And the Hudson server has no current jobs
|
23
|
-
And I am in the "ruby" project folder
|
24
|
-
And the project uses "git" scm
|
25
|
-
When I run local executable "hudson" with arguments "create . --host localhost --port 3010"
|
26
|
-
When I run local executable "hudson" with arguments "list"
|
27
|
-
Then I should see exactly
|
28
|
-
"""
|
29
|
-
http://localhost:3010:
|
30
|
-
* ruby
|
31
|
-
|
32
|
-
"""
|
33
|
-
|
34
|
-
|
@@ -1,207 +0,0 @@
|
|
1
|
-
Feature: Create and manage jobs
|
2
|
-
In order to reduce cost of getting a new project up onto Hudson
|
3
|
-
As a project developer
|
4
|
-
I want to add a new project to Hudson as a job
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given I have a Hudson server running
|
8
|
-
And the Hudson server has no current jobs
|
9
|
-
|
10
|
-
Scenario: Setup hudson job for git scm (hudson create)
|
11
|
-
Given I am in the "ruby" project folder
|
12
|
-
And the project uses "git" scm
|
13
|
-
When I run local executable "hudson" with arguments "create . --host localhost --port 3010"
|
14
|
-
Then I should see exactly
|
15
|
-
"""
|
16
|
-
Added ruby project 'ruby' to Hudson.
|
17
|
-
Triggering initial build...
|
18
|
-
Trigger additional builds via:
|
19
|
-
URL: http://localhost:3010/job/ruby/build
|
20
|
-
CLI: hudson build ruby
|
21
|
-
"""
|
22
|
-
When I run local executable "hudson" with arguments "list --host localhost --port 3010"
|
23
|
-
Then I should see "ruby"
|
24
|
-
|
25
|
-
Scenario: Create job via $HUDSON_HOST and $HUDSON_PORT (hudson create)
|
26
|
-
Given I am in the "ruby" project folder
|
27
|
-
And the project uses "git" scm
|
28
|
-
And env variable $HUDSON_HOST set to "localhost"
|
29
|
-
And env variable $HUDSON_PORT set to "3010"
|
30
|
-
When I run local executable "hudson" with arguments "create ."
|
31
|
-
Then I should see "http://localhost:3010/job/ruby/build"
|
32
|
-
When I run local executable "hudson" with arguments "list"
|
33
|
-
Then I should see "ruby"
|
34
|
-
|
35
|
-
Scenario: Don't trigger initial job build (hudson create --no-build)
|
36
|
-
Given I am in the "ruby" project folder
|
37
|
-
And the project uses "git" scm
|
38
|
-
When I run local executable "hudson" with arguments "create . --no-build --host localhost --port 3010"
|
39
|
-
Then I should see exactly
|
40
|
-
"""
|
41
|
-
Added ruby project 'ruby' to Hudson.
|
42
|
-
Trigger builds via:
|
43
|
-
URL: http://localhost:3010/job/ruby/build
|
44
|
-
CLI: hudson build ruby
|
45
|
-
"""
|
46
|
-
|
47
|
-
Scenario: Setup hudson job with explicit scm url/branches (hudson create --scm URI --scm-branches='master,other')
|
48
|
-
Given I am in the "ruby" project folder
|
49
|
-
And the project uses "git" scm
|
50
|
-
When I run local executable "hudson" with arguments "create . --scm git://localhost/myapp.git --scm-branches 'master,other' --host localhost --port 3010"
|
51
|
-
Then I should see "Added ruby project 'ruby' to Hudson."
|
52
|
-
And the job "ruby" config "scm" should be:
|
53
|
-
"""
|
54
|
-
<scm class="hudson.plugins.git.GitSCM">
|
55
|
-
<configVersion>1</configVersion>
|
56
|
-
<remoteRepositories>
|
57
|
-
<org.spearce.jgit.transport.RemoteConfig>
|
58
|
-
<string>origin</string>
|
59
|
-
<int>5</int>
|
60
|
-
<string>fetch</string>
|
61
|
-
<string>+refs/heads/*:refs/remotes/origin/*</string>
|
62
|
-
<string>receivepack</string>
|
63
|
-
<string>git-upload-pack</string>
|
64
|
-
<string>uploadpack</string>
|
65
|
-
<string>git-upload-pack</string>
|
66
|
-
<string>url</string>
|
67
|
-
<string>git://localhost/myapp.git</string>
|
68
|
-
<string>tagopt</string>
|
69
|
-
<string></string>
|
70
|
-
</org.spearce.jgit.transport.RemoteConfig>
|
71
|
-
</remoteRepositories>
|
72
|
-
<branches>
|
73
|
-
<hudson.plugins.git.BranchSpec>
|
74
|
-
<name>master</name>
|
75
|
-
</hudson.plugins.git.BranchSpec>
|
76
|
-
<hudson.plugins.git.BranchSpec>
|
77
|
-
<name>other</name>
|
78
|
-
</hudson.plugins.git.BranchSpec>
|
79
|
-
</branches>
|
80
|
-
<localBranch></localBranch>
|
81
|
-
<mergeOptions />
|
82
|
-
<recursiveSubmodules>false</recursiveSubmodules>
|
83
|
-
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
|
84
|
-
<authorOrCommitter>false</authorOrCommitter>
|
85
|
-
<clean>false</clean>
|
86
|
-
<wipeOutWorkspace>false</wipeOutWorkspace>
|
87
|
-
<buildChooser class="hudson.plugins.git.util.DefaultBuildChooser" />
|
88
|
-
<gitTool>Default</gitTool>
|
89
|
-
<submoduleCfg class="list" />
|
90
|
-
<relativeTargetDir></relativeTargetDir>
|
91
|
-
<excludedRegions></excludedRegions>
|
92
|
-
<excludedUsers></excludedUsers>
|
93
|
-
</scm>
|
94
|
-
"""
|
95
|
-
|
96
|
-
Scenario: Setup hudson job with multiple rubies (hudson create --rubies '1.8.7,rbx-head,jruby')
|
97
|
-
Given I am in the "ruby" project folder
|
98
|
-
And the project uses "git" scm
|
99
|
-
When I run local executable "hudson" with arguments "create . --rubies '1.8.7,rbx-head,jruby' --host localhost --port 3010"
|
100
|
-
Then I should see "Added ruby project 'ruby' to Hudson."
|
101
|
-
And the job "ruby" config "axes" should be:
|
102
|
-
"""
|
103
|
-
<axes>
|
104
|
-
<hudson.matrix.TextAxis>
|
105
|
-
<name>RUBY_VERSION</name>
|
106
|
-
<values>
|
107
|
-
<string>1.8.7</string>
|
108
|
-
<string>rbx-head</string>
|
109
|
-
<string>jruby</string>
|
110
|
-
</values>
|
111
|
-
</hudson.matrix.TextAxis>
|
112
|
-
</axes>
|
113
|
-
"""
|
114
|
-
|
115
|
-
Scenario: Setup hudson job with multiple rubies and multiple nodes (hudson create --rubies.. --node_labels..)
|
116
|
-
Given I am in the "ruby" project folder
|
117
|
-
And the project uses "git" scm
|
118
|
-
When I run local executable "hudson" with arguments "create . --rubies '1.8.7,rbx-head,jruby' --node-labels '1.8.7,ubuntu' --host localhost --port 3010"
|
119
|
-
Then I should see "Added ruby project 'ruby' to Hudson."
|
120
|
-
And the job "ruby" config "axes" should be:
|
121
|
-
"""
|
122
|
-
<axes>
|
123
|
-
<hudson.matrix.TextAxis>
|
124
|
-
<name>RUBY_VERSION</name>
|
125
|
-
<values>
|
126
|
-
<string>1.8.7</string>
|
127
|
-
<string>rbx-head</string>
|
128
|
-
<string>jruby</string>
|
129
|
-
</values>
|
130
|
-
</hudson.matrix.TextAxis>
|
131
|
-
<hudson.matrix.LabelAxis>
|
132
|
-
<name>label</name>
|
133
|
-
<values>
|
134
|
-
<string>1.8.7</string>
|
135
|
-
<string>ubuntu</string>
|
136
|
-
</values>
|
137
|
-
</hudson.matrix.LabelAxis>
|
138
|
-
</axes>
|
139
|
-
"""
|
140
|
-
|
141
|
-
Scenario: Setup hudson job for a specific node label (hudson create --assigned_node)
|
142
|
-
Given I am in the "ruby" project folder
|
143
|
-
And the project uses "git" scm
|
144
|
-
When I run local executable "hudson" with arguments "create . --assigned_node my_node --host localhost --port 3010"
|
145
|
-
Then I should see "Added ruby project 'ruby' to Hudson."
|
146
|
-
|
147
|
-
Scenario: Select 'rails3' project type (hudson create --template rails3)
|
148
|
-
Given I am in the "rails-3" project folder
|
149
|
-
And the project uses "git" scm
|
150
|
-
When I run local executable "hudson" with arguments "create . --template rails3 --host localhost --port 3010"
|
151
|
-
Then I should see "Added rails3 project 'rails-3' to Hudson."
|
152
|
-
|
153
|
-
Scenario: Create job without default steps (hudson create --no-template)
|
154
|
-
Given I am in the "non-bundler" project folder
|
155
|
-
And the project uses "git" scm
|
156
|
-
When I run local executable "hudson" with arguments "create . --no-template --host localhost --port 3010"
|
157
|
-
Then I should see "Added project 'non-bundler' to Hudson."
|
158
|
-
And the job "non-bundler" config "builders" should be:
|
159
|
-
"""
|
160
|
-
<builders>
|
161
|
-
<hudson.tasks.Shell>
|
162
|
-
<command>echo "THERE ARE NO STEPS! Except this one..."</command>
|
163
|
-
</hudson.tasks.Shell>
|
164
|
-
</builders>
|
165
|
-
"""
|
166
|
-
|
167
|
-
Scenario: Reject projects that don't use bundler (hudson create)
|
168
|
-
Given I am in the "non-bundler" project folder
|
169
|
-
And the project uses "git" scm
|
170
|
-
When I run local executable "hudson" with arguments "create . --host localhost --port 3010"
|
171
|
-
Then I should see "Ruby/Rails projects without a Gemfile are currently unsupported."
|
172
|
-
|
173
|
-
Scenario: Attempt to create project without scm (hudson create)
|
174
|
-
Given I am in the "ruby" project folder
|
175
|
-
When I run local executable "hudson" with arguments "create . --host localhost --port 3010"
|
176
|
-
Then I should see "Cannot determine project SCM. Currently supported:"
|
177
|
-
|
178
|
-
Scenario: Recreate a job (hudson create --override)
|
179
|
-
Given I am in the "ruby" project folder
|
180
|
-
When I create a job
|
181
|
-
Then I should see "Added ruby project 'ruby' to Hudson."
|
182
|
-
When I recreate a job
|
183
|
-
Then I should see "Added ruby project 'ruby' to Hudson."
|
184
|
-
|
185
|
-
Scenario: Trigger a job build (hudson build)
|
186
|
-
Given I am in the "ruby" project folder
|
187
|
-
When I create a job
|
188
|
-
When I run local executable "hudson" with arguments "build"
|
189
|
-
Then I should see "Build for 'ruby' running now..."
|
190
|
-
|
191
|
-
Scenario: Trigger a job build on invaild project (hudson build)
|
192
|
-
Given I am in the "ruby" project folder
|
193
|
-
When I run local executable "hudson" with arguments "build . --host localhost --port 3010"
|
194
|
-
Then I should see "ERROR: No job 'ruby' on server."
|
195
|
-
|
196
|
-
Scenario: Remove a job (hudson remove)
|
197
|
-
Given I am in the "ruby" project folder
|
198
|
-
When I create a job
|
199
|
-
Then I should see "Added ruby project 'ruby' to Hudson."
|
200
|
-
When I run local executable "hudson" with arguments "remove ."
|
201
|
-
Then I should see "Removed project 'ruby' from Hudson."
|
202
|
-
|
203
|
-
Scenario: Remove a job that doesn't exist gives error (hudson remove)
|
204
|
-
Given I am in the "ruby" project folder
|
205
|
-
When I run local executable "hudson" with arguments "remove . --host localhost --port 3010"
|
206
|
-
Then I should see "ERROR: Failed to delete project 'ruby'."
|
207
|
-
|
@@ -1,80 +0,0 @@
|
|
1
|
-
Feature: Adding slave nodes
|
2
|
-
In order to have different environments for different projects
|
3
|
-
As a developer
|
4
|
-
I want to add new slave nodes to my Hudson instance
|
5
|
-
|
6
|
-
Background:
|
7
|
-
Given I have a Hudson server running
|
8
|
-
And the Hudson server has no slaves
|
9
|
-
When I run local executable "hudson" with arguments "nodes --host localhost --port 3010"
|
10
|
-
Then I should see exactly
|
11
|
-
"""
|
12
|
-
master
|
13
|
-
"""
|
14
|
-
|
15
|
-
Scenario: Add slave via API (hudson nodes)
|
16
|
-
When I create a new node with the following options on "http://localhost:3010":
|
17
|
-
| name | Slave 1 |
|
18
|
-
| label | app1 app2 app3 |
|
19
|
-
| slave_host | foo1.bar.com |
|
20
|
-
| slave_user | hudson |
|
21
|
-
When I run local executable "hudson" with arguments "nodes"
|
22
|
-
Then I should see exactly
|
23
|
-
"""
|
24
|
-
master
|
25
|
-
Slave 1
|
26
|
-
"""
|
27
|
-
|
28
|
-
Scenario: Add slave via CLI with name defaulted to URL (hudson add_node)
|
29
|
-
When I run local executable "hudson" with arguments "add_node foo1.bar.com --slave-user deploy --labels 'app1,app2'"
|
30
|
-
Then I should see exactly
|
31
|
-
"""
|
32
|
-
Added slave node 'foo1.bar.com' to foo1.bar.com
|
33
|
-
"""
|
34
|
-
When I run local executable "hudson" with arguments "add_node foo1.bar.com --slave-user deploy --labels 'app1,app2'"
|
35
|
-
Then I should see exactly
|
36
|
-
"""
|
37
|
-
Slave called 'foo1.bar.com' already exists
|
38
|
-
ERROR: Failed to add slave node foo1.bar.com
|
39
|
-
"""
|
40
|
-
When I run local executable "hudson" with arguments "nodes"
|
41
|
-
Then I should see exactly
|
42
|
-
"""
|
43
|
-
master
|
44
|
-
foo1.bar.com
|
45
|
-
"""
|
46
|
-
|
47
|
-
Scenario: Add a local Vagrant/VirtualBox VM as a slave (hudson add_node --vagrant)
|
48
|
-
Given I am in the "rails-3" project folder
|
49
|
-
When I run local executable "hudson" with arguments "add_node localhost --name rails-3 --vagrant --labels 'app1,app2'"
|
50
|
-
Then I should see exactly
|
51
|
-
"""
|
52
|
-
Added slave node 'rails-3' to localhost
|
53
|
-
"""
|
54
|
-
When I run local executable "hudson" with arguments "nodes"
|
55
|
-
Then I should see exactly
|
56
|
-
"""
|
57
|
-
master
|
58
|
-
rails-3
|
59
|
-
"""
|
60
|
-
And the Hudson config "slaves" should be:
|
61
|
-
"""
|
62
|
-
<slaves>
|
63
|
-
<slave>
|
64
|
-
<name>rails-3</name>
|
65
|
-
<description>Automatically created by Hudson.rb</description>
|
66
|
-
<remoteFS>/vagrant/tmp/hudson-slave/</remoteFS>
|
67
|
-
<numExecutors>2</numExecutors>
|
68
|
-
<mode>EXCLUSIVE</mode>
|
69
|
-
<retentionStrategy class="hudson.slaves.RetentionStrategy$Always" />
|
70
|
-
<launcher class="hudson.plugins.sshslaves.SSHLauncher">
|
71
|
-
<host>localhost</host>
|
72
|
-
<port>2222</port>
|
73
|
-
<username>vagrant</username>
|
74
|
-
<privatekey>/Library/Ruby/Gems/1.8/gems/vagrant-0.6.7/keys/vagrant</privatekey>
|
75
|
-
</launcher>
|
76
|
-
<label>app1 app2</label>
|
77
|
-
<nodeProperties />
|
78
|
-
</slave>
|
79
|
-
</slaves>
|
80
|
-
"""
|
@@ -1,197 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
Given /^hudson is using a stock warfile$/ do
|
4
|
-
ENV['HUDSON_STOCK'] = File.expand_path(File.dirname(__FILE__) + '/../../fixtures/hudson')
|
5
|
-
end
|
6
|
-
|
7
|
-
Given /^this project is active project folder/ do
|
8
|
-
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
9
|
-
end
|
10
|
-
|
11
|
-
Given /^env variable \$([\w_]+) set to( project path|) "(.*)"/ do |env_var, path, value|
|
12
|
-
in_project_folder {
|
13
|
-
value = File.expand_path(value)
|
14
|
-
} unless path.empty?
|
15
|
-
ENV[env_var] = value
|
16
|
-
end
|
17
|
-
|
18
|
-
Given /"(.*)" folder is deleted/ do |folder|
|
19
|
-
in_project_folder { FileUtils.rm_rf folder }
|
20
|
-
end
|
21
|
-
|
22
|
-
When /^I invoke "(.*)" generator with arguments "(.*)"$/ do |generator, arguments|
|
23
|
-
@stdout = StringIO.new
|
24
|
-
in_project_folder do
|
25
|
-
if Object.const_defined?("APP_ROOT")
|
26
|
-
APP_ROOT.replace(FileUtils.pwd)
|
27
|
-
else
|
28
|
-
APP_ROOT = FileUtils.pwd
|
29
|
-
end
|
30
|
-
run_generator(generator, arguments.split(' '), SOURCES, :stdout => @stdout)
|
31
|
-
end
|
32
|
-
File.open(File.join(@tmp_root, "generator.out"), "w") do |f|
|
33
|
-
@stdout.rewind
|
34
|
-
f << @stdout.read
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
When /^I run executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
39
|
-
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
40
|
-
in_project_folder do
|
41
|
-
system "#{executable.inspect} #{arguments} > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
When /^I run project executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
46
|
-
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
47
|
-
in_project_folder do
|
48
|
-
system "ruby #{executable.inspect} #{arguments} > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
When /^I run local executable "(.*)" with arguments "(.*)"/ do |executable, arguments|
|
53
|
-
@stdout = File.expand_path(File.join(@tmp_root, "executable.out"))
|
54
|
-
executable = File.expand_path(File.join(File.dirname(__FILE__), "/../../bin", executable))
|
55
|
-
in_project_folder do
|
56
|
-
system "ruby #{executable.inspect} #{arguments} > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
When /^I invoke task "rake (.*)"/ do |task|
|
61
|
-
@stdout = File.expand_path(File.join(@tmp_root, "tests.out"))
|
62
|
-
in_project_folder do
|
63
|
-
system "rake #{task} --trace > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
Then /^folder "(.*)" (is|is not) created/ do |folder, is|
|
68
|
-
in_project_folder do
|
69
|
-
File.exists?(folder).should(is == 'is' ? be_true : be_false)
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
Then /^file "(.*)" (is|is not) created/ do |file, is|
|
74
|
-
in_project_folder do
|
75
|
-
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
Then /^file with name matching "(.*)" is created/ do |pattern|
|
80
|
-
in_project_folder do
|
81
|
-
Dir[pattern].should_not be_empty
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
Then /^file "(.*)" contents (does|does not) match \/(.*)\// do |file, does, regex|
|
86
|
-
in_project_folder do
|
87
|
-
actual_output = File.read(file)
|
88
|
-
(does == 'does') ?
|
89
|
-
actual_output.should(match(/#{regex}/)) :
|
90
|
-
actual_output.should_not(match(/#{regex}/))
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
Then /gem file "(.*)" and generated file "(.*)" should be the same/ do |gem_file, project_file|
|
95
|
-
File.exists?(gem_file).should be_true
|
96
|
-
File.exists?(project_file).should be_true
|
97
|
-
gem_file_contents = File.read(File.dirname(__FILE__) + "/../../#{gem_file}")
|
98
|
-
project_file_contents = File.read(File.join(@active_project_folder, project_file))
|
99
|
-
project_file_contents.should == gem_file_contents
|
100
|
-
end
|
101
|
-
|
102
|
-
Then /^(does|does not) invoke generator "(.*)"$/ do |does_invoke, generator|
|
103
|
-
actual_output = get_command_output
|
104
|
-
does_invoke == "does" ?
|
105
|
-
actual_output.should(match(/dependency\s+#{generator}/)) :
|
106
|
-
actual_output.should_not(match(/dependency\s+#{generator}/))
|
107
|
-
end
|
108
|
-
|
109
|
-
Then /help options "(.*)" and "(.*)" are displayed/ do |opt1, opt2|
|
110
|
-
actual_output = get_command_output
|
111
|
-
actual_output.should match(/#{opt1}/)
|
112
|
-
actual_output.should match(/#{opt2}/)
|
113
|
-
end
|
114
|
-
|
115
|
-
Then /^I should see "([^\"]*)"$/ do |text|
|
116
|
-
actual_output = get_command_output
|
117
|
-
actual_output.should contain(text)
|
118
|
-
end
|
119
|
-
|
120
|
-
Then /^I should not see "([^\"]*)"$/ do |text|
|
121
|
-
actual_output =
|
122
|
-
actual_output.should_not contain(text)
|
123
|
-
end
|
124
|
-
|
125
|
-
Then /^I should see$/ do |text|
|
126
|
-
actual_output = get_command_output
|
127
|
-
actual_output.should contain(text)
|
128
|
-
end
|
129
|
-
|
130
|
-
Then /^I should not see$/ do |text|
|
131
|
-
actual_output = get_command_output
|
132
|
-
actual_output.should_not contain(text)
|
133
|
-
end
|
134
|
-
|
135
|
-
Then /^I should see exactly$/ do |text|
|
136
|
-
actual_output = get_command_output
|
137
|
-
actual_output.should == text
|
138
|
-
end
|
139
|
-
|
140
|
-
Then /^I should see all (\d+) tests pass/ do |expected_test_count|
|
141
|
-
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
142
|
-
actual_output = get_command_output
|
143
|
-
actual_output.should match(expected)
|
144
|
-
end
|
145
|
-
|
146
|
-
Then /^I should see all (\d+) examples pass/ do |expected_test_count|
|
147
|
-
expected = %r{^#{expected_test_count} examples?, 0 failures}
|
148
|
-
actual_output = get_command_output
|
149
|
-
actual_output.should match(expected)
|
150
|
-
end
|
151
|
-
|
152
|
-
Then /^yaml file "(.*)" contains (\{.*\})/ do |file, yaml|
|
153
|
-
in_project_folder do
|
154
|
-
yaml = eval yaml
|
155
|
-
YAML.load(File.read(file)).should == yaml
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
|
-
Then /^Rakefile can display tasks successfully/ do
|
160
|
-
@stdout = File.expand_path(File.join(@tmp_root, "rakefile.out"))
|
161
|
-
in_project_folder do
|
162
|
-
system "rake -T > #{@stdout.inspect} 2> #{@stdout.inspect}"
|
163
|
-
end
|
164
|
-
actual_output = get_command_output
|
165
|
-
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
166
|
-
end
|
167
|
-
|
168
|
-
Then /^task "rake (.*)" is executed successfully/ do |task|
|
169
|
-
@stdout.should_not be_nil
|
170
|
-
actual_output = get_command_output
|
171
|
-
actual_output.should_not match(/^Don't know how to build task '#{task}'/)
|
172
|
-
actual_output.should_not match(/Error/i)
|
173
|
-
end
|
174
|
-
|
175
|
-
Then /^gem spec key "(.*)" contains \/(.*)\// do |key, regex|
|
176
|
-
in_project_folder do
|
177
|
-
gem_file = Dir["pkg/*.gem"].first
|
178
|
-
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
179
|
-
spec_value = gem_spec.send(key.to_sym)
|
180
|
-
spec_value.to_s.should match(/#{regex}/)
|
181
|
-
end
|
182
|
-
end
|
183
|
-
|
184
|
-
Then /^the file "([^\"]*)" is a valid gemspec$/ do |filename|
|
185
|
-
spec = eval(File.read(filename))
|
186
|
-
spec.validate
|
187
|
-
end
|
188
|
-
|
189
|
-
When /^I create a new node with the following options on "http:\/\/(.+?):(\d+)":$/ do |host, port, table|
|
190
|
-
options = table.raw.inject({}) do |options, (key, value)|
|
191
|
-
options[(key.to_sym rescue key) || key] = value
|
192
|
-
options
|
193
|
-
end
|
194
|
-
|
195
|
-
Hudson::Api.setup_base_url(:host => host, :port => port.to_i)
|
196
|
-
Hudson::Api.add_node(options)
|
197
|
-
end
|