hudson 0.3.0.beta.3 → 0.3.0.beta.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/Rakefile +1 -1
- data/hudson.gemspec +4 -4
- data/lib/hudson.rb +1 -1
- data/lib/hudson/api.rb +3 -1
- data/lib/hudson/cli.rb +0 -1
- data/lib/hudson/job_config_builder.rb +6 -2
- data/spec/fixtures/rails.multi.config.xml +11 -11
- data/spec/fixtures/rails.single.config.xml +14 -12
- data/spec/job_config_builder_spec.rb +23 -1
- data/spec/spec_helper.rb +3 -7
- metadata +5 -6
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_dependency("hpricot")
|
27
27
|
s.add_development_dependency("rake", ["~> 0.8.7"])
|
28
28
|
s.add_development_dependency("cucumber", ["~> 0.9.0"])
|
29
|
-
s.add_development_dependency("rspec", ["~> 2.0.0
|
29
|
+
s.add_development_dependency("rspec", ["~> 2.0.0"])
|
30
30
|
s.add_development_dependency("json", ["~>1.4.0"])
|
31
31
|
s.add_development_dependency("awesome_print")
|
32
32
|
end
|
data/hudson.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{hudson}
|
5
|
-
s.version = "0.3.0.beta.
|
5
|
+
s.version = "0.3.0.beta.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Charles Lowell", "Dr Nic Williams"]
|
@@ -31,7 +31,7 @@ Gem::Specification.new do |s|
|
|
31
31
|
s.add_runtime_dependency(%q<hpricot>, [">= 0"])
|
32
32
|
s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
|
33
33
|
s.add_development_dependency(%q<cucumber>, ["~> 0.9.0"])
|
34
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.0.0
|
34
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0"])
|
35
35
|
s.add_development_dependency(%q<json>, ["~> 1.4.0"])
|
36
36
|
s.add_development_dependency(%q<awesome_print>, [">= 0"])
|
37
37
|
else
|
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
|
|
43
43
|
s.add_dependency(%q<hpricot>, [">= 0"])
|
44
44
|
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
45
45
|
s.add_dependency(%q<cucumber>, ["~> 0.9.0"])
|
46
|
-
s.add_dependency(%q<rspec>, ["~> 2.0.0
|
46
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
47
47
|
s.add_dependency(%q<json>, ["~> 1.4.0"])
|
48
48
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
49
49
|
end
|
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
|
|
56
56
|
s.add_dependency(%q<hpricot>, [">= 0"])
|
57
57
|
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
58
58
|
s.add_dependency(%q<cucumber>, ["~> 0.9.0"])
|
59
|
-
s.add_dependency(%q<rspec>, ["~> 2.0.0
|
59
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0"])
|
60
60
|
s.add_dependency(%q<json>, ["~> 1.4.0"])
|
61
61
|
s.add_dependency(%q<awesome_print>, [">= 0"])
|
62
62
|
end
|
data/lib/hudson.rb
CHANGED
data/lib/hudson/api.rb
CHANGED
@@ -3,6 +3,8 @@ require 'cgi'
|
|
3
3
|
require 'uri'
|
4
4
|
require 'json'
|
5
5
|
|
6
|
+
require 'hudson/config'
|
7
|
+
|
6
8
|
module Hudson
|
7
9
|
module Api
|
8
10
|
include HTTParty
|
@@ -73,7 +75,7 @@ module Hudson
|
|
73
75
|
default_options = Hash.new("")
|
74
76
|
default_options.merge!(
|
75
77
|
:slave_port => 22,
|
76
|
-
:master_key => "/home/hudson/.ssh/
|
78
|
+
:master_key => "/home/hudson/.ssh/id_rsa", # FIXME - hardcoded master username assumption
|
77
79
|
:remote_fs => "/data/hudson-slave/",
|
78
80
|
:description => "Automatically created by Hudson.rb",
|
79
81
|
:executors => 2,
|
data/lib/hudson/cli.rb
CHANGED
@@ -4,6 +4,7 @@ module Hudson
|
|
4
4
|
class JobConfigBuilder
|
5
5
|
attr_accessor :scm, :git_branches
|
6
6
|
attr_accessor :job_type, :matrix_project
|
7
|
+
attr_accessor :assigned_node
|
7
8
|
|
8
9
|
def initialize(options = nil, &block)
|
9
10
|
if options.is_a?(Symbol)
|
@@ -25,6 +26,7 @@ module Hudson
|
|
25
26
|
b.keepDependencies false
|
26
27
|
b.properties
|
27
28
|
build_scm b
|
29
|
+
b.assignedNode assigned_node if assigned_node
|
28
30
|
b.canRoam true
|
29
31
|
b.disabled false
|
30
32
|
b.blockBuildWhenUpstreamBuilding false
|
@@ -106,7 +108,7 @@ module Hudson
|
|
106
108
|
def build_steps(b)
|
107
109
|
b.builders do
|
108
110
|
if job_type == "rails"
|
109
|
-
build_ruby_step b, <<-RUBY.gsub(/^
|
111
|
+
build_ruby_step b, <<-RUBY.gsub(/^ /, '')
|
110
112
|
unless File.exist?("config/database.yml")
|
111
113
|
require 'fileutils'
|
112
114
|
example = Dir["config/database*"].first
|
@@ -133,7 +135,9 @@ module Hudson
|
|
133
135
|
# </hudson.plugins.ruby.Ruby>
|
134
136
|
def build_ruby_step(b, command)
|
135
137
|
b.tag! "hudson.plugins.ruby.Ruby" do
|
136
|
-
b.command
|
138
|
+
b.command do
|
139
|
+
b << command.to_xs.gsub(%r{"}, '"').gsub(%r{'}, ''')
|
140
|
+
end
|
137
141
|
end
|
138
142
|
end
|
139
143
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<?xml version='1.0' encoding='UTF-8'?>
|
2
2
|
<matrix-project>
|
3
3
|
<actions/>
|
4
|
-
<description
|
4
|
+
<description/>
|
5
5
|
<keepDependencies>false</keepDependencies>
|
6
6
|
<properties/>
|
7
7
|
<scm class="hudson.plugins.git.GitSCM">
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<string>url</string>
|
20
20
|
<string>git@codebasehq.com:mocra/dash/web-app.git</string>
|
21
21
|
<string>tagopt</string>
|
22
|
-
<string
|
22
|
+
<string/>
|
23
23
|
</org.spearce.jgit.transport.RemoteConfig>
|
24
24
|
</remoteRepositories>
|
25
25
|
<branches>
|
@@ -59,25 +59,25 @@ end</command>
|
|
59
59
|
</hudson.plugins.ruby.Ruby>
|
60
60
|
<hudson.plugins.rake.Rake>
|
61
61
|
<rakeInstallation>(Default)</rakeInstallation>
|
62
|
-
<rakeFile
|
63
|
-
<rakeLibDir
|
64
|
-
<rakeWorkingDir
|
62
|
+
<rakeFile/>
|
63
|
+
<rakeLibDir/>
|
64
|
+
<rakeWorkingDir/>
|
65
65
|
<tasks>db:schema:load</tasks>
|
66
66
|
<silent>false</silent>
|
67
67
|
</hudson.plugins.rake.Rake>
|
68
68
|
<hudson.plugins.rake.Rake>
|
69
69
|
<rakeInstallation>(Default)</rakeInstallation>
|
70
|
-
<rakeFile
|
71
|
-
<rakeLibDir
|
72
|
-
<rakeWorkingDir
|
70
|
+
<rakeFile/>
|
71
|
+
<rakeLibDir/>
|
72
|
+
<rakeWorkingDir/>
|
73
73
|
<tasks>features</tasks>
|
74
74
|
<silent>false</silent>
|
75
75
|
</hudson.plugins.rake.Rake>
|
76
76
|
<hudson.plugins.rake.Rake>
|
77
77
|
<rakeInstallation>(Default)</rakeInstallation>
|
78
|
-
<rakeFile
|
79
|
-
<rakeLibDir
|
80
|
-
<rakeWorkingDir
|
78
|
+
<rakeFile/>
|
79
|
+
<rakeLibDir/>
|
80
|
+
<rakeWorkingDir/>
|
81
81
|
<tasks>spec</tasks>
|
82
82
|
<silent>false</silent>
|
83
83
|
</hudson.plugins.rake.Rake>
|
@@ -45,38 +45,40 @@
|
|
45
45
|
<concurrentBuild>false</concurrentBuild>
|
46
46
|
<builders>
|
47
47
|
<hudson.plugins.ruby.Ruby>
|
48
|
-
<command>
|
48
|
+
<command>
|
49
|
+
unless File.exist?("config/database.yml")
|
49
50
|
require 'fileutils'
|
50
51
|
example = Dir["config/database*"].first
|
51
52
|
puts "Using #{example} for config/database.yml"
|
52
53
|
FileUtils.cp example, "config/database.yml"
|
53
|
-
end
|
54
|
+
end
|
55
|
+
</command>
|
54
56
|
</hudson.plugins.ruby.Ruby>
|
55
57
|
<hudson.plugins.rake.Rake>
|
56
58
|
<rakeInstallation>(Default)</rakeInstallation>
|
57
|
-
<rakeFile
|
58
|
-
<rakeLibDir
|
59
|
-
<rakeWorkingDir
|
59
|
+
<rakeFile/>
|
60
|
+
<rakeLibDir/>
|
61
|
+
<rakeWorkingDir/>
|
60
62
|
<tasks>db:schema:load</tasks>
|
61
63
|
<silent>false</silent>
|
62
64
|
</hudson.plugins.rake.Rake>
|
63
65
|
<hudson.plugins.rake.Rake>
|
64
66
|
<rakeInstallation>(Default)</rakeInstallation>
|
65
|
-
<rakeFile
|
66
|
-
<rakeLibDir
|
67
|
-
<rakeWorkingDir
|
67
|
+
<rakeFile/>
|
68
|
+
<rakeLibDir/>
|
69
|
+
<rakeWorkingDir/>
|
68
70
|
<tasks>features</tasks>
|
69
71
|
<silent>false</silent>
|
70
72
|
</hudson.plugins.rake.Rake>
|
71
73
|
<hudson.plugins.rake.Rake>
|
72
74
|
<rakeInstallation>(Default)</rakeInstallation>
|
73
|
-
<rakeFile
|
74
|
-
<rakeLibDir
|
75
|
-
<rakeWorkingDir
|
75
|
+
<rakeFile/>
|
76
|
+
<rakeLibDir/>
|
77
|
+
<rakeWorkingDir/>
|
76
78
|
<tasks>spec</tasks>
|
77
79
|
<silent>false</silent>
|
78
80
|
</hudson.plugins.rake.Rake>
|
79
81
|
</builders>
|
80
82
|
<publishers/>
|
81
83
|
<buildWrappers/>
|
82
|
-
</project>
|
84
|
+
</project>
|
@@ -15,7 +15,7 @@ describe Hudson::JobConfigBuilder do
|
|
15
15
|
config_xml.should == @config.to_xml
|
16
16
|
end
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
describe "rubygem job; single axis; block syntax" do
|
20
20
|
before do
|
21
21
|
@config = Hudson::JobConfigBuilder.new(:rubygem) do |c|
|
@@ -27,4 +27,26 @@ describe Hudson::JobConfigBuilder do
|
|
27
27
|
config_xml.should == @config.to_xml
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
describe "assigned slave nodes for slave usage" do
|
32
|
+
before do
|
33
|
+
@config = Hudson::JobConfigBuilder.new(:rails) do |c|
|
34
|
+
c.assigned_node = "my-slave"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
it "builds config.xml" do
|
38
|
+
Hpricot.XML(@config.to_xml).search("assignedNode").size.should == 1
|
39
|
+
Hpricot.XML(@config.to_xml).search("assignedNode").text.should == "my-slave"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "no specific slave nodes" do
|
44
|
+
before do
|
45
|
+
@config = Hudson::JobConfigBuilder.new(:rails) do |c|
|
46
|
+
end
|
47
|
+
end
|
48
|
+
it "builds config.xml" do
|
49
|
+
Hpricot.XML(@config.to_xml).search("assignedNode").size.should == 0
|
50
|
+
end
|
51
|
+
end
|
30
52
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
rescue LoadError
|
4
|
-
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
-
gem 'rspec'
|
6
|
-
require 'rspec'
|
7
|
-
end
|
1
|
+
require "bundler"
|
2
|
+
Bundler.setup
|
8
3
|
|
9
4
|
$:.unshift(File.dirname(__FILE__) + '/../lib')
|
10
5
|
require 'hudson'
|
6
|
+
require 'hpricot'
|
11
7
|
|
12
8
|
module ConfigFixtureLoaders
|
13
9
|
def config_xml(name, variation = nil)
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hudson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 62196379
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
9
|
- 0
|
10
10
|
- beta
|
11
|
-
-
|
12
|
-
version: 0.3.0.beta.
|
11
|
+
- 4
|
12
|
+
version: 0.3.0.beta.4
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Charles Lowell
|
@@ -153,13 +153,12 @@ dependencies:
|
|
153
153
|
requirements:
|
154
154
|
- - ~>
|
155
155
|
- !ruby/object:Gem::Version
|
156
|
-
hash:
|
156
|
+
hash: 15
|
157
157
|
segments:
|
158
158
|
- 2
|
159
159
|
- 0
|
160
160
|
- 0
|
161
|
-
|
162
|
-
version: 2.0.0.beta
|
161
|
+
version: 2.0.0
|
163
162
|
type: :development
|
164
163
|
prerelease: false
|
165
164
|
name: rspec
|