hudson 0.2.7 → 0.3.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +3 -0
- data/Gemfile.lock +65 -0
- data/README.md +27 -4
- data/Rakefile +12 -4
- data/features/create_jobs.feature +11 -0
- data/features/listing_jobs.feature +29 -0
- data/features/managing_remote_servers.feature +15 -10
- data/features/step_definitions/common_steps.rb +1 -1
- data/features/step_definitions/hudson_steps.rb +6 -6
- data/features/support/env.rb +1 -4
- data/features/support/matchers.rb +3 -5
- data/hudson.gemspec +22 -13
- data/lib/hudson.rb +2 -2
- data/lib/hudson/api.rb +28 -7
- data/lib/hudson/cli.rb +33 -23
- data/lib/hudson/cli/formatting.rb +1 -1
- data/lib/hudson/config.rb +27 -0
- data/lib/hudson/hudson-cli.jar +0 -0
- data/lib/hudson/hudson.war +0 -0
- data/lib/hudson/remote.rb +11 -0
- data/spec/spec_helper.rb +2 -2
- metadata +102 -45
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
hudson (0.3.0.beta.1)
|
5
|
+
activesupport (~> 3.0.0)
|
6
|
+
builder (~> 2.1.2)
|
7
|
+
hpricot
|
8
|
+
httparty (~> 0.5.2)
|
9
|
+
term-ansicolor (>= 1.0.4)
|
10
|
+
thor (= 0.14.2)
|
11
|
+
yajl-ruby (>= 0.7.6)
|
12
|
+
|
13
|
+
GEM
|
14
|
+
remote: http://rubygems.org/
|
15
|
+
specs:
|
16
|
+
activesupport (3.0.0)
|
17
|
+
awesome_print (0.2.1)
|
18
|
+
builder (2.1.2)
|
19
|
+
crack (0.1.6)
|
20
|
+
cucumber (0.9.0)
|
21
|
+
builder (~> 2.1.2)
|
22
|
+
diff-lcs (~> 1.1.2)
|
23
|
+
gherkin (~> 2.2.2)
|
24
|
+
json (~> 1.4.6)
|
25
|
+
term-ansicolor (~> 1.0.5)
|
26
|
+
diff-lcs (1.1.2)
|
27
|
+
gherkin (2.2.8)
|
28
|
+
json (~> 1.4.6)
|
29
|
+
term-ansicolor (~> 1.0.5)
|
30
|
+
hpricot (0.8.2)
|
31
|
+
httparty (0.5.2)
|
32
|
+
crack (= 0.1.6)
|
33
|
+
json (1.4.6)
|
34
|
+
rake (0.8.7)
|
35
|
+
rspec (2.0.0.rc)
|
36
|
+
rspec-core (= 2.0.0.rc)
|
37
|
+
rspec-expectations (= 2.0.0.rc)
|
38
|
+
rspec-mocks (= 2.0.0.rc)
|
39
|
+
rspec-core (2.0.0.rc)
|
40
|
+
rspec-expectations (2.0.0.rc)
|
41
|
+
diff-lcs (>= 1.1.2)
|
42
|
+
rspec-mocks (2.0.0.rc)
|
43
|
+
rspec-core (= 2.0.0.rc)
|
44
|
+
rspec-expectations (= 2.0.0.rc)
|
45
|
+
term-ansicolor (1.0.5)
|
46
|
+
thor (0.14.2)
|
47
|
+
yajl-ruby (0.7.8)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
activesupport (~> 3.0.0)
|
54
|
+
awesome_print
|
55
|
+
builder (~> 2.1.2)
|
56
|
+
cucumber (~> 0.9.0)
|
57
|
+
hpricot
|
58
|
+
httparty (~> 0.5.2)
|
59
|
+
hudson!
|
60
|
+
json (~> 1.4.0)
|
61
|
+
rake (~> 0.8.7)
|
62
|
+
rspec (~> 2.0.0.beta)
|
63
|
+
term-ansicolor (>= 1.0.4)
|
64
|
+
thor (= 0.14.2)
|
65
|
+
yajl-ruby (>= 0.7.6)
|
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
Hudson
|
2
2
|
======
|
3
3
|
|
4
|
-
Hudson is a sweet
|
5
|
-
to
|
6
|
-
|
7
|
-
|
4
|
+
Hudson is a sweet continuous integration platform. Hudson.rb makes it easy
|
5
|
+
to bundles all the things you need to easily run a hudson server from Ruby,
|
6
|
+
as well as talk to a running hudson servers from Ruby and the command line.
|
7
|
+
|
8
|
+
* Email: [http://groups.google.com/group/hudsonrb](http://groups.google.com/group/hudsonrb)
|
9
|
+
* IRC: [irc://irc.freenode.net/hudson.rb](irc://irc.freenode.net/hudson.rb)
|
8
10
|
|
9
11
|
Install
|
10
12
|
=======
|
@@ -58,6 +60,27 @@ To add Project (create a Job) on a Hudson server:
|
|
58
60
|
|
59
61
|
For all commands, if flags for `host:port` are not provided, it will use `$HUDSON_HOST` and `$HUDSON_PORT` if available.
|
60
62
|
|
63
|
+
Developer Instructions
|
64
|
+
======================
|
65
|
+
|
66
|
+
The dependencies for the gem and for developing the gem are managed by bundler.
|
67
|
+
|
68
|
+
gem install bundler
|
69
|
+
git clone http://github.com/cowboyd/hudson.rb.git
|
70
|
+
bundle install
|
71
|
+
|
72
|
+
The test suite is run with:
|
73
|
+
|
74
|
+
rake
|
75
|
+
|
76
|
+
This launches a Hudson server, runs cucumber features, and kills the Hudson server.
|
77
|
+
|
78
|
+
Alternately, manually launch the Hudson server, run features and close the Hudson server:
|
79
|
+
|
80
|
+
rake hudson:server:test
|
81
|
+
rake cucumber:ok
|
82
|
+
rake hudson:server:killtest
|
83
|
+
|
61
84
|
License
|
62
85
|
=======
|
63
86
|
|
data/Rakefile
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
1
4
|
$:.unshift('lib')
|
2
5
|
require 'hudson'
|
3
|
-
require 'rubygems'
|
4
6
|
|
5
7
|
Gem::Specification.new do |s|
|
6
8
|
$gemspec = s
|
@@ -20,11 +22,14 @@ Gem::Specification.new do |s|
|
|
20
22
|
s.add_dependency("yajl-ruby", [">= 0.7.6"])
|
21
23
|
s.add_dependency("httparty", ["~> 0.5.2"])
|
22
24
|
s.add_dependency("builder", ["~> 2.1.2"])
|
23
|
-
s.add_dependency("thor", ["= 0.
|
25
|
+
s.add_dependency("thor", ["= 0.14.2"])
|
26
|
+
s.add_dependency("activesupport", ["~> 3.0.0"])
|
24
27
|
s.add_dependency("hpricot")
|
25
|
-
s.add_development_dependency("
|
26
|
-
s.add_development_dependency("
|
28
|
+
s.add_development_dependency("rake", ["~> 0.8.7"])
|
29
|
+
s.add_development_dependency("cucumber", ["~> 0.9.0"])
|
30
|
+
s.add_development_dependency("rspec", ["~> 2.0.0.beta"])
|
27
31
|
s.add_development_dependency("json", ["~>1.4.0"])
|
32
|
+
s.add_development_dependency("awesome_print")
|
28
33
|
end
|
29
34
|
|
30
35
|
desc "Build gem"
|
@@ -44,6 +49,9 @@ task :clean do
|
|
44
49
|
sh "rm -rf *.gem"
|
45
50
|
end
|
46
51
|
|
52
|
+
require "rspec/core/rake_task"
|
53
|
+
RSpec::Core::RakeTask.new(:spec)
|
54
|
+
|
47
55
|
namespace :cucumber do
|
48
56
|
require 'cucumber/rake/task'
|
49
57
|
Cucumber::Rake::Task.new(:wip, 'Run features that are being worked on') do |t|
|
@@ -16,6 +16,17 @@ Feature: Create jobs
|
|
16
16
|
When I run local executable "hudson" with arguments "list --host localhost --port 3010"
|
17
17
|
Then I should see "ruby"
|
18
18
|
|
19
|
+
Scenario: Create job via $HUDSON_HOST and $HUDSON_PORT
|
20
|
+
Given I am in the "ruby" project folder
|
21
|
+
And the project uses "git" scm
|
22
|
+
And env variable $HUDSON_HOST set to "localhost"
|
23
|
+
And env variable $HUDSON_PORT set to "3010"
|
24
|
+
When I run local executable "hudson" with arguments "create ."
|
25
|
+
Then I should see "Added project 'ruby' to Hudson."
|
26
|
+
Then I should see "http://localhost:3010/job/ruby/build"
|
27
|
+
When I run local executable "hudson" with arguments "list"
|
28
|
+
Then I should see "ruby"
|
29
|
+
|
19
30
|
Scenario: Attempt to create project without scm
|
20
31
|
Given I am in the "ruby" project folder
|
21
32
|
When I run local executable "hudson" with arguments "create . --host localhost --port 3010"
|
@@ -0,0 +1,29 @@
|
|
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
|
5
|
+
When I run local executable "hudson" with arguments "list test --host localhost --port 9999"
|
6
|
+
Then I should see "localhost:9999 - no connection"
|
7
|
+
|
8
|
+
Scenario: List jobs on a server with no jobs
|
9
|
+
Given I have a Hudson server running
|
10
|
+
And the Hudson server has no current jobs
|
11
|
+
When I run local executable "hudson" with arguments "list test --host localhost --port 3010"
|
12
|
+
Then I should see "localhost:3010 - no jobs"
|
13
|
+
|
14
|
+
Scenario: List jobs on a server with jobs
|
15
|
+
Given I have a Hudson server running
|
16
|
+
And the Hudson server has no current jobs
|
17
|
+
And I am in the "ruby" project folder
|
18
|
+
And the project uses "git" scm
|
19
|
+
When I run local executable "hudson" with arguments "create . --host localhost --port 3010"
|
20
|
+
When I run local executable "hudson" with arguments "list"
|
21
|
+
Then I should see "localhost:3010 -"
|
22
|
+
Then I should see "ruby"
|
23
|
+
When I run local executable "hudson" with arguments "list --host localhost --port 3010"
|
24
|
+
Then I should see "localhost:3010 -"
|
25
|
+
Then I should see "ruby"
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
@@ -13,19 +13,24 @@ Feature: Managing remote servers
|
|
13
13
|
Then I should see "Either use --host or add remote servers."
|
14
14
|
|
15
15
|
Scenario: Add a remote server
|
16
|
-
When I run local executable "hudson" with arguments "
|
17
|
-
And I run local executable "hudson" with arguments "remotes add --host localhost --port 3011"
|
16
|
+
When I run local executable "hudson" with arguments "add_remote test --host localhost --port 3010"
|
18
17
|
And I run local executable "hudson" with arguments "list"
|
19
18
|
Then I should not see "Either use --host or add remote servers."
|
20
|
-
And I should see "localhost:3010 -"
|
21
|
-
|
22
|
-
|
19
|
+
And I should see "test [localhost:3010] - no jobs"
|
20
|
+
|
21
|
+
Scenario: Add a few remote servers
|
22
|
+
When I run local executable "hudson" with arguments "add_remote test --host localhost --port 3010"
|
23
|
+
And I run local executable "hudson" with arguments "add_remote another --host localhost --port 4000"
|
24
|
+
And I run local executable "hudson" with arguments "list"
|
25
|
+
Then I should not see "Either use --host or add remote servers."
|
26
|
+
And I should see "test [localhost:3010] - no jobs"
|
27
|
+
And I should see "another [localhost:3011] - no connection"
|
23
28
|
|
24
29
|
Scenario: Add a remote server and access by abbreviation
|
25
|
-
When I run local executable "hudson" with arguments "
|
26
|
-
|
30
|
+
When I run local executable "hudson" with arguments "add_remote test --host localhost --port 3010"
|
31
|
+
And I run local executable "hudson" with arguments "add_remote another --host another.host"
|
27
32
|
And I run local executable "hudson" with arguments "list --server local"
|
28
|
-
|
29
|
-
And I should see "
|
30
|
-
And I should not see "another
|
33
|
+
Then I should not see "Either use --host or add remote servers."
|
34
|
+
And I should see "test [localhost:3010] - no jobs"
|
35
|
+
And I should not see "another"
|
31
36
|
|
@@ -2,7 +2,7 @@ Given /^this project is active project folder/ do
|
|
2
2
|
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
3
3
|
end
|
4
4
|
|
5
|
-
Given /^env variable \$([\w_]+) set to( project path
|
5
|
+
Given /^env variable \$([\w_]+) set to( project path|) "(.*)"/ do |env_var, path, value|
|
6
6
|
in_project_folder {
|
7
7
|
value = File.expand_path(value)
|
8
8
|
} unless path.empty?
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Given /^I have a Hudson server running$/ do
|
2
|
-
unless
|
2
|
+
unless @hudson_port
|
3
3
|
port = 3010
|
4
4
|
begin
|
5
5
|
res = Net::HTTP.start("localhost", port) { |http| http.get('/api/json') }
|
@@ -7,22 +7,22 @@ Given /^I have a Hudson server running$/ do
|
|
7
7
|
puts "\n\n\nERROR: To run tests, launch hudson in test mode: 'rake hudson:server:test'\n\n\n"
|
8
8
|
exit
|
9
9
|
end
|
10
|
-
|
11
|
-
|
10
|
+
@hudson_port = port.to_s
|
11
|
+
@hudson_host = 'localhost'
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
Given /^the Hudson server has no current jobs$/ do
|
16
|
-
if port =
|
16
|
+
if port = @hudson_port
|
17
17
|
require "open-uri"
|
18
18
|
require "yajl"
|
19
|
-
hudson_info = Yajl::Parser.new.parse(open("http
|
19
|
+
hudson_info = Yajl::Parser.new.parse(open("http://#{@hudson_host}:#{@hudson_port}/api/json"))
|
20
20
|
|
21
21
|
hudson_info['jobs'].each do |job|
|
22
22
|
job_url = job['url']
|
23
23
|
res = Net::HTTP.start("localhost", port) { |http| http.post("#{job_url}doDelete/api/json", {}) }
|
24
24
|
end
|
25
|
-
hudson_info = Yajl::Parser.new.parse(open("http
|
25
|
+
hudson_info = Yajl::Parser.new.parse(open("http://#{@hudson_host}:#{@hudson_port}/api/json"))
|
26
26
|
hudson_info['jobs'].should == []
|
27
27
|
else
|
28
28
|
puts "WARNING: Run 'I have a Hudson server running' step first."
|
data/features/support/env.rb
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
$:.unshift(File.expand_path(File.dirname(File.dirname(__FILE__) + "/../../lib/hudson.rb")))
|
2
2
|
require File.dirname(__FILE__) + "/../../lib/hudson.rb"
|
3
3
|
|
4
|
-
|
5
|
-
require 'cucumber'
|
6
|
-
gem 'rspec'
|
7
|
-
require 'spec'
|
4
|
+
require 'bundler/setup'
|
8
5
|
|
9
6
|
Before do
|
10
7
|
@tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
@@ -1,10 +1,8 @@
|
|
1
1
|
|
2
2
|
module Matchers
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
matcher.negative_failure_message = "expected #{given.inspect} not to contain #{expected.inspect}"
|
7
|
-
given.index expected
|
3
|
+
RSpec::Matchers.define :contain do |expected_text|
|
4
|
+
match do |text|
|
5
|
+
text.index expected_text
|
8
6
|
end
|
9
7
|
end
|
10
8
|
end
|
data/hudson.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{hudson}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.3.0.beta.1"
|
6
6
|
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
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"]
|
9
|
-
s.date = %q{2010-
|
9
|
+
s.date = %q{2010-10-11}
|
10
10
|
s.default_executable = %q{hudson}
|
11
11
|
s.description = %q{A suite of utilities for bringing continous integration to your projects (not the other way around) with hudson CI}
|
12
12
|
s.email = ["cowboyd@thefrontside.net", "drnicwilliams@gmail.com"]
|
13
13
|
s.executables = ["hudson"]
|
14
|
-
s.files = ["bin", "bin/hudson", "features", "features/create_jobs.feature", "features/development.feature", "features/fixtures", "features/fixtures/projects", "features/fixtures/projects/ruby", "features/fixtures/projects/ruby/Rakefile", "features/managing_remote_servers.feature", "features/server.feature", "features/step_definitions", "features/step_definitions/common_steps.rb", "features/step_definitions/fixture_project_steps.rb", "features/step_definitions/hudson_steps.rb", "features/step_definitions/scm_steps.rb", "features/support", "features/support/common.rb", "features/support/env.rb", "features/support/hooks.rb", "features/support/matchers.rb", "hudson.gemspec", "lib", "lib/hudson", "lib/hudson/api.rb", "lib/hudson/cli", "lib/hudson/cli/formatting.rb", "lib/hudson/cli.rb", "lib/hudson/hudson.war", "lib/hudson/job_config_builder.rb", "lib/hudson/plugins", "lib/hudson/plugins/git.hpi", "lib/hudson/plugins/github.hpi", "lib/hudson/plugins/greenballs.hpi", "lib/hudson/plugins/rake.hpi", "lib/hudson/plugins/ruby.hpi", "lib/hudson/project_scm.rb", "lib/hudson.rb", "Rakefile", "README.md", "spec", "spec/fixtures", "spec/fixtures/ec2_global.config.xml", "spec/fixtures/rails.multi.config.xml", "spec/fixtures/rails.single.config.xml", "spec/fixtures/rubygem.config.xml", "spec/fixtures/therubyracer.config.xml", "spec/job_config_builder_spec.rb", "spec/spec_helper.rb"]
|
14
|
+
s.files = ["bin", "bin/hudson", "features", "features/create_jobs.feature", "features/development.feature", "features/fixtures", "features/fixtures/projects", "features/fixtures/projects/ruby", "features/fixtures/projects/ruby/Rakefile", "features/listing_jobs.feature", "features/managing_remote_servers.feature", "features/server.feature", "features/step_definitions", "features/step_definitions/common_steps.rb", "features/step_definitions/fixture_project_steps.rb", "features/step_definitions/hudson_steps.rb", "features/step_definitions/scm_steps.rb", "features/support", "features/support/common.rb", "features/support/env.rb", "features/support/hooks.rb", "features/support/matchers.rb", "Gemfile", "Gemfile.lock", "hudson.gemspec", "lib", "lib/hudson", "lib/hudson/api.rb", "lib/hudson/cli", "lib/hudson/cli/formatting.rb", "lib/hudson/cli.rb", "lib/hudson/config.rb", "lib/hudson/hudson-cli.jar", "lib/hudson/hudson.war", "lib/hudson/job_config_builder.rb", "lib/hudson/plugins", "lib/hudson/plugins/git.hpi", "lib/hudson/plugins/github.hpi", "lib/hudson/plugins/greenballs.hpi", "lib/hudson/plugins/rake.hpi", "lib/hudson/plugins/ruby.hpi", "lib/hudson/project_scm.rb", "lib/hudson/remote.rb", "lib/hudson.rb", "Rakefile", "README.md", "spec", "spec/fixtures", "spec/fixtures/ec2_global.config.xml", "spec/fixtures/rails.multi.config.xml", "spec/fixtures/rails.single.config.xml", "spec/fixtures/rubygem.config.xml", "spec/fixtures/therubyracer.config.xml", "spec/job_config_builder_spec.rb", "spec/spec_helper.rb"]
|
15
15
|
s.homepage = %q{http://github.com/cowboyd/hudson.rb}
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{hudson}
|
@@ -27,31 +27,40 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_runtime_dependency(%q<yajl-ruby>, [">= 0.7.6"])
|
28
28
|
s.add_runtime_dependency(%q<httparty>, ["~> 0.5.2"])
|
29
29
|
s.add_runtime_dependency(%q<builder>, ["~> 2.1.2"])
|
30
|
-
s.add_runtime_dependency(%q<thor>, ["= 0.
|
30
|
+
s.add_runtime_dependency(%q<thor>, ["= 0.14.2"])
|
31
|
+
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
|
31
32
|
s.add_runtime_dependency(%q<hpricot>, [">= 0"])
|
32
|
-
s.add_development_dependency(%q<
|
33
|
-
s.add_development_dependency(%q<
|
33
|
+
s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
|
34
|
+
s.add_development_dependency(%q<cucumber>, ["~> 0.9.0"])
|
35
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.0.0.beta"])
|
34
36
|
s.add_development_dependency(%q<json>, ["~> 1.4.0"])
|
37
|
+
s.add_development_dependency(%q<awesome_print>, [">= 0"])
|
35
38
|
else
|
36
39
|
s.add_dependency(%q<term-ansicolor>, [">= 1.0.4"])
|
37
40
|
s.add_dependency(%q<yajl-ruby>, [">= 0.7.6"])
|
38
41
|
s.add_dependency(%q<httparty>, ["~> 0.5.2"])
|
39
42
|
s.add_dependency(%q<builder>, ["~> 2.1.2"])
|
40
|
-
s.add_dependency(%q<thor>, ["= 0.
|
43
|
+
s.add_dependency(%q<thor>, ["= 0.14.2"])
|
44
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
41
45
|
s.add_dependency(%q<hpricot>, [">= 0"])
|
42
|
-
s.add_dependency(%q<
|
43
|
-
s.add_dependency(%q<
|
46
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
47
|
+
s.add_dependency(%q<cucumber>, ["~> 0.9.0"])
|
48
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta"])
|
44
49
|
s.add_dependency(%q<json>, ["~> 1.4.0"])
|
50
|
+
s.add_dependency(%q<awesome_print>, [">= 0"])
|
45
51
|
end
|
46
52
|
else
|
47
53
|
s.add_dependency(%q<term-ansicolor>, [">= 1.0.4"])
|
48
54
|
s.add_dependency(%q<yajl-ruby>, [">= 0.7.6"])
|
49
55
|
s.add_dependency(%q<httparty>, ["~> 0.5.2"])
|
50
56
|
s.add_dependency(%q<builder>, ["~> 2.1.2"])
|
51
|
-
s.add_dependency(%q<thor>, ["= 0.
|
57
|
+
s.add_dependency(%q<thor>, ["= 0.14.2"])
|
58
|
+
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
|
52
59
|
s.add_dependency(%q<hpricot>, [">= 0"])
|
53
|
-
s.add_dependency(%q<
|
54
|
-
s.add_dependency(%q<
|
60
|
+
s.add_dependency(%q<rake>, ["~> 0.8.7"])
|
61
|
+
s.add_dependency(%q<cucumber>, ["~> 0.9.0"])
|
62
|
+
s.add_dependency(%q<rspec>, ["~> 2.0.0.beta"])
|
55
63
|
s.add_dependency(%q<json>, ["~> 1.4.0"])
|
64
|
+
s.add_dependency(%q<awesome_print>, [">= 0"])
|
56
65
|
end
|
57
66
|
end
|
data/lib/hudson.rb
CHANGED
data/lib/hudson/api.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'cgi'
|
3
|
+
require 'uri'
|
4
|
+
require 'json'
|
3
5
|
|
4
6
|
module Hudson
|
5
7
|
class Api
|
@@ -10,10 +12,14 @@ module Hudson
|
|
10
12
|
# http_proxy 'localhost', '8888'
|
11
13
|
|
12
14
|
def self.setup_base_url(options)
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
15
|
+
# Thor's HashWithIndifferentAccess is based on string keys which URI::HTTP.build ignores
|
16
|
+
options = options.inject({}) { |mem, (key, val)| mem[key.to_sym] = val; mem }
|
17
|
+
options[:host] ||= ENV['HUDSON_HOST']
|
18
|
+
options[:port] ||= ENV['HUDSON_PORT']
|
19
|
+
return false unless options[:host] || Hudson::Config.config["base_uri"]
|
20
|
+
uri = options[:host] ? URI::HTTP.build(options) : Hudson::Config.config["base_uri"]
|
21
|
+
base_uri uri.to_s
|
22
|
+
uri
|
17
23
|
end
|
18
24
|
|
19
25
|
# returns true if successfully create a new job on Hudson
|
@@ -22,6 +28,7 @@ module Hudson
|
|
22
28
|
:body => job_config.to_xml, :format => :xml, :headers => { 'content-type' => 'application/xml' }
|
23
29
|
}
|
24
30
|
if res.code == 200
|
31
|
+
cache_base_uri
|
25
32
|
true
|
26
33
|
else
|
27
34
|
require "hpricot"
|
@@ -32,12 +39,26 @@ module Hudson
|
|
32
39
|
end
|
33
40
|
|
34
41
|
def self.summary
|
35
|
-
|
42
|
+
begin
|
43
|
+
json = get "/api/json"
|
44
|
+
cache_base_uri
|
45
|
+
json
|
46
|
+
rescue Errno::ECONNREFUSED => e
|
47
|
+
false
|
48
|
+
end
|
36
49
|
end
|
37
50
|
|
38
|
-
# Return hash of job
|
51
|
+
# Return hash of job statuses
|
39
52
|
def self.job(name)
|
40
|
-
get "/job/#{name}/api/json"
|
53
|
+
json = get "/job/#{name}/api/json"
|
54
|
+
cache_base_uri
|
55
|
+
json
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
def self.cache_base_uri
|
60
|
+
Hudson::Config.config["base_uri"] = base_uri
|
61
|
+
Hudson::Config.store!
|
41
62
|
end
|
42
63
|
end
|
43
64
|
end
|
data/lib/hudson/cli.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'active_support/core_ext/object/blank'
|
2
3
|
require 'hudson/cli/formatting'
|
4
|
+
require 'hudson/config'
|
5
|
+
require 'hudson/remote'
|
3
6
|
|
4
7
|
module Hudson
|
5
8
|
class CLI < Thor
|
@@ -58,7 +61,7 @@ module Hudson
|
|
58
61
|
end
|
59
62
|
name = options[:name] || File.basename(FileUtils.pwd)
|
60
63
|
if Hudson::Api.create_job(name, job_config)
|
61
|
-
build_url = "
|
64
|
+
build_url = "#{@uri}/job/#{name.gsub(/\s/,'%20')}/build"
|
62
65
|
puts "Added project '#{name}' to Hudson."
|
63
66
|
puts "Trigger builds via: #{build_url}"
|
64
67
|
else
|
@@ -67,33 +70,39 @@ module Hudson
|
|
67
70
|
end
|
68
71
|
end
|
69
72
|
|
70
|
-
desc "list [
|
73
|
+
desc "list [server] [options]", "list builds on a hudson server"
|
71
74
|
common_options
|
72
|
-
def list(
|
75
|
+
def list(server = nil)
|
73
76
|
select_hudson_server(options)
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
else
|
84
|
-
display "No jobs found on #{options[:host]}:#{options[:port]}"
|
77
|
+
if summary = Hudson::Api.summary
|
78
|
+
unless summary["jobs"].blank?
|
79
|
+
shell.say "#{@uri} -"
|
80
|
+
summary["jobs"].each do |job|
|
81
|
+
color = job['color']
|
82
|
+
color = 'red' if color == 'red_anime'
|
83
|
+
color = 'green' if color == 'blue'
|
84
|
+
color = 'yellow' if color == 'grey'
|
85
|
+
shell.say job['name'], color.to_sym, false
|
85
86
|
end
|
87
|
+
shell.say ""
|
86
88
|
else
|
87
|
-
|
89
|
+
display "#{@uri} - no jobs"
|
88
90
|
end
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
desc "remote command [options]", "manage remote servers (comming sometime to a theater near you)"
|
93
|
-
def remote(command)
|
94
|
-
puts command
|
91
|
+
else
|
92
|
+
shell.say "#{@uri} - no connection", :red
|
93
|
+
end
|
95
94
|
end
|
96
95
|
|
96
|
+
# desc "add_remote name [options]", "manage remote servers (comming sometime to a theater near you)"
|
97
|
+
# common_options
|
98
|
+
# def add_remote(name)
|
99
|
+
# select_hudson_server(options)
|
100
|
+
# if Hudson::Remote.add_server(name, @uri)
|
101
|
+
# display "Added remote server '#{name}' for #{@uri}"
|
102
|
+
# else
|
103
|
+
# error "Could not add remote server for '#{@uri}'"
|
104
|
+
# end
|
105
|
+
# end
|
97
106
|
|
98
107
|
desc "help [command]", "show help for hudson or for a specific command"
|
99
108
|
def help(*args)
|
@@ -124,17 +133,18 @@ USEAGE
|
|
124
133
|
private
|
125
134
|
|
126
135
|
def select_hudson_server(options)
|
127
|
-
unless Hudson::Api.setup_base_url(options)
|
136
|
+
unless @uri = Hudson::Api.setup_base_url(options)
|
128
137
|
error "Either use --host or add remote servers."
|
129
138
|
end
|
130
139
|
end
|
140
|
+
|
131
141
|
def display(text)
|
132
142
|
shell.say text
|
133
143
|
exit
|
134
144
|
end
|
135
145
|
|
136
146
|
def error(text)
|
137
|
-
shell.say "ERROR: #{text}"
|
147
|
+
shell.say "ERROR: #{text}", :red
|
138
148
|
exit
|
139
149
|
end
|
140
150
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Hudson
|
2
|
+
module Config
|
3
|
+
extend self
|
4
|
+
|
5
|
+
def [](key)
|
6
|
+
config[key]
|
7
|
+
end
|
8
|
+
|
9
|
+
def config
|
10
|
+
@config ||= if File.exist?(config_file)
|
11
|
+
JSON.parse(File.read(config_file))
|
12
|
+
else
|
13
|
+
{}
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def store!
|
18
|
+
@config ||= {}
|
19
|
+
FileUtils.mkdir_p(File.dirname(config_file))
|
20
|
+
File.open(config_file, "w") { |file| file << @config.to_json }
|
21
|
+
end
|
22
|
+
|
23
|
+
def config_file
|
24
|
+
@config_file ||= "#{ENV['HOME']}/.hudson/hudsonrb-config.json"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
Binary file
|
data/lib/hudson/hudson.war
CHANGED
Binary file
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hudson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 62196369
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
- beta
|
11
|
+
- 1
|
12
|
+
version: 0.3.0.beta.1
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Charles Lowell
|
@@ -16,12 +18,10 @@ autorequire:
|
|
16
18
|
bindir: bin
|
17
19
|
cert_chain: []
|
18
20
|
|
19
|
-
date: 2010-
|
21
|
+
date: 2010-10-11 00:00:00 -07:00
|
20
22
|
default_executable:
|
21
23
|
dependencies:
|
22
24
|
- !ruby/object:Gem::Dependency
|
23
|
-
name: term-ansicolor
|
24
|
-
prerelease: false
|
25
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
@@ -34,10 +34,10 @@ dependencies:
|
|
34
34
|
- 4
|
35
35
|
version: 1.0.4
|
36
36
|
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
name: term-ansicolor
|
37
39
|
version_requirements: *id001
|
38
40
|
- !ruby/object:Gem::Dependency
|
39
|
-
name: yajl-ruby
|
40
|
-
prerelease: false
|
41
41
|
requirement: &id002 !ruby/object:Gem::Requirement
|
42
42
|
none: false
|
43
43
|
requirements:
|
@@ -50,10 +50,10 @@ dependencies:
|
|
50
50
|
- 6
|
51
51
|
version: 0.7.6
|
52
52
|
type: :runtime
|
53
|
+
prerelease: false
|
54
|
+
name: yajl-ruby
|
53
55
|
version_requirements: *id002
|
54
56
|
- !ruby/object:Gem::Dependency
|
55
|
-
name: httparty
|
56
|
-
prerelease: false
|
57
57
|
requirement: &id003 !ruby/object:Gem::Requirement
|
58
58
|
none: false
|
59
59
|
requirements:
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
- 2
|
67
67
|
version: 0.5.2
|
68
68
|
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
name: httparty
|
69
71
|
version_requirements: *id003
|
70
72
|
- !ruby/object:Gem::Dependency
|
71
|
-
name: builder
|
72
|
-
prerelease: false
|
73
73
|
requirement: &id004 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
@@ -82,27 +82,43 @@ dependencies:
|
|
82
82
|
- 2
|
83
83
|
version: 2.1.2
|
84
84
|
type: :runtime
|
85
|
+
prerelease: false
|
86
|
+
name: builder
|
85
87
|
version_requirements: *id004
|
86
88
|
- !ruby/object:Gem::Dependency
|
87
|
-
name: thor
|
88
|
-
prerelease: false
|
89
89
|
requirement: &id005 !ruby/object:Gem::Requirement
|
90
90
|
none: false
|
91
91
|
requirements:
|
92
92
|
- - "="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
hash:
|
94
|
+
hash: 35
|
95
95
|
segments:
|
96
96
|
- 0
|
97
|
-
-
|
98
|
-
-
|
99
|
-
version: 0.
|
97
|
+
- 14
|
98
|
+
- 2
|
99
|
+
version: 0.14.2
|
100
100
|
type: :runtime
|
101
|
+
prerelease: false
|
102
|
+
name: thor
|
101
103
|
version_requirements: *id005
|
102
104
|
- !ruby/object:Gem::Dependency
|
103
|
-
name: hpricot
|
104
|
-
prerelease: false
|
105
105
|
requirement: &id006 !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
hash: 7
|
111
|
+
segments:
|
112
|
+
- 3
|
113
|
+
- 0
|
114
|
+
- 0
|
115
|
+
version: 3.0.0
|
116
|
+
type: :runtime
|
117
|
+
prerelease: false
|
118
|
+
name: activesupport
|
119
|
+
version_requirements: *id006
|
120
|
+
- !ruby/object:Gem::Dependency
|
121
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
106
122
|
none: false
|
107
123
|
requirements:
|
108
124
|
- - ">="
|
@@ -112,43 +128,60 @@ dependencies:
|
|
112
128
|
- 0
|
113
129
|
version: "0"
|
114
130
|
type: :runtime
|
115
|
-
version_requirements: *id006
|
116
|
-
- !ruby/object:Gem::Dependency
|
117
|
-
name: cucumber
|
118
131
|
prerelease: false
|
119
|
-
|
132
|
+
name: hpricot
|
133
|
+
version_requirements: *id007
|
134
|
+
- !ruby/object:Gem::Dependency
|
135
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
120
136
|
none: false
|
121
137
|
requirements:
|
122
138
|
- - ~>
|
123
139
|
- !ruby/object:Gem::Version
|
124
|
-
hash:
|
140
|
+
hash: 49
|
125
141
|
segments:
|
126
142
|
- 0
|
143
|
+
- 8
|
127
144
|
- 7
|
128
|
-
|
129
|
-
version: 0.7.3
|
145
|
+
version: 0.8.7
|
130
146
|
type: :development
|
131
|
-
version_requirements: *id007
|
132
|
-
- !ruby/object:Gem::Dependency
|
133
|
-
name: rspec
|
134
147
|
prerelease: false
|
135
|
-
|
148
|
+
name: rake
|
149
|
+
version_requirements: *id008
|
150
|
+
- !ruby/object:Gem::Dependency
|
151
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
136
152
|
none: false
|
137
153
|
requirements:
|
138
154
|
- - ~>
|
139
155
|
- !ruby/object:Gem::Version
|
140
|
-
hash:
|
156
|
+
hash: 59
|
141
157
|
segments:
|
142
|
-
- 1
|
143
|
-
- 3
|
144
158
|
- 0
|
145
|
-
|
159
|
+
- 9
|
160
|
+
- 0
|
161
|
+
version: 0.9.0
|
146
162
|
type: :development
|
147
|
-
|
163
|
+
prerelease: false
|
164
|
+
name: cucumber
|
165
|
+
version_requirements: *id009
|
148
166
|
- !ruby/object:Gem::Dependency
|
149
|
-
|
167
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
168
|
+
none: false
|
169
|
+
requirements:
|
170
|
+
- - ~>
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
hash: 31098209
|
173
|
+
segments:
|
174
|
+
- 2
|
175
|
+
- 0
|
176
|
+
- 0
|
177
|
+
- beta
|
178
|
+
version: 2.0.0.beta
|
179
|
+
type: :development
|
150
180
|
prerelease: false
|
151
|
-
|
181
|
+
name: rspec
|
182
|
+
version_requirements: *id010
|
183
|
+
- !ruby/object:Gem::Dependency
|
184
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
152
185
|
none: false
|
153
186
|
requirements:
|
154
187
|
- - ~>
|
@@ -160,7 +193,23 @@ dependencies:
|
|
160
193
|
- 0
|
161
194
|
version: 1.4.0
|
162
195
|
type: :development
|
163
|
-
|
196
|
+
prerelease: false
|
197
|
+
name: json
|
198
|
+
version_requirements: *id011
|
199
|
+
- !ruby/object:Gem::Dependency
|
200
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
201
|
+
none: false
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
hash: 3
|
206
|
+
segments:
|
207
|
+
- 0
|
208
|
+
version: "0"
|
209
|
+
type: :development
|
210
|
+
prerelease: false
|
211
|
+
name: awesome_print
|
212
|
+
version_requirements: *id012
|
164
213
|
description: A suite of utilities for bringing continous integration to your projects (not the other way around) with hudson CI
|
165
214
|
email:
|
166
215
|
- cowboyd@thefrontside.net
|
@@ -176,6 +225,7 @@ files:
|
|
176
225
|
- features/create_jobs.feature
|
177
226
|
- features/development.feature
|
178
227
|
- features/fixtures/projects/ruby/Rakefile
|
228
|
+
- features/listing_jobs.feature
|
179
229
|
- features/managing_remote_servers.feature
|
180
230
|
- features/server.feature
|
181
231
|
- features/step_definitions/common_steps.rb
|
@@ -186,10 +236,14 @@ files:
|
|
186
236
|
- features/support/env.rb
|
187
237
|
- features/support/hooks.rb
|
188
238
|
- features/support/matchers.rb
|
239
|
+
- Gemfile
|
240
|
+
- Gemfile.lock
|
189
241
|
- hudson.gemspec
|
190
242
|
- lib/hudson/api.rb
|
191
243
|
- lib/hudson/cli/formatting.rb
|
192
244
|
- lib/hudson/cli.rb
|
245
|
+
- lib/hudson/config.rb
|
246
|
+
- lib/hudson/hudson-cli.jar
|
193
247
|
- lib/hudson/hudson.war
|
194
248
|
- lib/hudson/job_config_builder.rb
|
195
249
|
- lib/hudson/plugins/git.hpi
|
@@ -198,6 +252,7 @@ files:
|
|
198
252
|
- lib/hudson/plugins/rake.hpi
|
199
253
|
- lib/hudson/plugins/ruby.hpi
|
200
254
|
- lib/hudson/project_scm.rb
|
255
|
+
- lib/hudson/remote.rb
|
201
256
|
- lib/hudson.rb
|
202
257
|
- Rakefile
|
203
258
|
- README.md
|
@@ -229,12 +284,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
229
284
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
285
|
none: false
|
231
286
|
requirements:
|
232
|
-
- - "
|
287
|
+
- - ">"
|
233
288
|
- !ruby/object:Gem::Version
|
234
|
-
hash:
|
289
|
+
hash: 25
|
235
290
|
segments:
|
236
|
-
-
|
237
|
-
|
291
|
+
- 1
|
292
|
+
- 3
|
293
|
+
- 1
|
294
|
+
version: 1.3.1
|
238
295
|
requirements: []
|
239
296
|
|
240
297
|
rubyforge_project: hudson
|