hudson 0.3.0.beta.14 → 0.3.0.beta.15

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hudson (0.3.0.beta.14)
4
+ hudson (0.3.0.beta.15)
5
5
  builder (~> 2.1.2)
6
6
  hpricot
7
7
  httparty (~> 0.6.1)
@@ -3,6 +3,7 @@ Given /^I have a Hudson server running$/ do
3
3
  port = 3010
4
4
  begin
5
5
  res = Net::HTTP.start("localhost", port) { |http| http.get('/api/json') }
6
+ Hudson::Api.base_uri "http://localhost:#{port}"
6
7
  rescue Errno::ECONNREFUSED => e
7
8
  puts "\n\n\nERROR: To run tests, launch hudson in test mode: 'rake hudson:server:test'\n\n\n"
8
9
  exit
@@ -14,16 +15,10 @@ end
14
15
 
15
16
  Given /^the Hudson server has no current jobs$/ do
16
17
  if port = @hudson_port
17
- require "open-uri"
18
- require "yajl"
19
- hudson_info = Yajl::Parser.new.parse(open("http://#{@hudson_host}:#{@hudson_port}/api/json"))
20
-
21
- hudson_info['jobs'].each do |job|
22
- job_url = job['url']
23
- res = Net::HTTP.start("localhost", port) { |http| http.post("#{job_url}doDelete/api/json", {}) }
18
+ Hudson::Api.summary['jobs'].each do |job|
19
+ Hudson::Api.delete_job(job['name'])
24
20
  end
25
- hudson_info = Yajl::Parser.new.parse(open("http://#{@hudson_host}:#{@hudson_port}/api/json"))
26
- hudson_info['jobs'].should == []
21
+ Hudson::Api.summary['jobs'].should == []
27
22
  else
28
23
  puts "WARNING: Run 'I have a Hudson server running' step first."
29
24
  end
@@ -31,26 +26,16 @@ end
31
26
 
32
27
  Given /^the Hudson server has no slaves$/ do
33
28
  if port = @hudson_port
34
- require "open-uri"
35
- require "yajl"
36
- base_url = "http://#{@hudson_host}:#{@hudson_port}"
37
- hudson_info = Yajl::Parser.new.parse(open("#{base_url}/api/json"))
38
- (hudson_info['jobs'] || []).each do |job|
39
- job_url = job['url']
40
- res = Net::HTTP.start("localhost", port) { |http| http.post("#{job_url}doDelete/api/json", {}) }
29
+ Hudson::Api.summary['jobs'].each do |job|
30
+ Hudson::Api.delete_job(job['name'])
41
31
  end
42
- hudson_info = Yajl::Parser.new.parse(open("#{base_url}/api/json"))
43
- hudson_info['jobs'].should == []
32
+ Hudson::Api.summary['jobs'].should == []
44
33
 
45
- hudson_info = Yajl::Parser.new.parse(open("#{base_url}/computer/api/json"))
46
- hudson_info['computer'].each do |node|
47
- name = node["displayName"]
48
- next if name == "master"
49
- job_url = "#{base_url}/computer/#{CGI::escape(name).gsub('+', '%20')}"
50
- res = Net::HTTP.start("localhost", port) { |http| http.post("#{job_url}/doDelete/api/json", {}) }
34
+ Hudson::Api.nodes['computer'].each do |node|
35
+ name = node['displayName']
36
+ Hudson::Api.delete_node(name) unless name == "master"
51
37
  end
52
- hudson_info = Yajl::Parser.new.parse(open("#{base_url}/computer/api/json"))
53
- hudson_info['computer'].size.should == 1
38
+ Hudson::Api.nodes['computer'].size.should == 1
54
39
  else
55
40
  puts "WARNING: Run 'I have a Hudson server running' step first."
56
41
  end
@@ -91,8 +76,8 @@ end
91
76
  Then /^I should see a hudson server on port (\d+)$/ do |port|
92
77
  require 'json'
93
78
  try(15, 2) do
94
- res = Net::HTTP.start("localhost", port) { |http| http.get('/api/json') }
95
- JSON.parse(res.body)['nodeDescription'].should == "the master Hudson node"
79
+ Hudson::Api.base_uri "http://localhost:#{port}"
80
+ Hudson::Api.summary['nodeDescription'].should == "the master Hudson node"
96
81
  end
97
82
  end
98
83
 
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.3.0.beta.14"
5
+ s.version = "0.3.0.beta.15"
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"]
9
- s.date = %q{2010-11-01}
9
+ s.date = %q{2010-11-02}
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/development.feature", "features/launch_server.feature", "features/listing_jobs.feature", "features/manage_jobs.feature", "features/manage_slave_nodes.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", "fixtures", "fixtures/projects", "fixtures/projects/non-bundler", "fixtures/projects/non-bundler/Rakefile", "fixtures/projects/rails-3", "fixtures/projects/rails-3/app", "fixtures/projects/rails-3/app/controllers", "fixtures/projects/rails-3/app/controllers/application_controller.rb", "fixtures/projects/rails-3/app/helpers", "fixtures/projects/rails-3/app/helpers/application_helper.rb", "fixtures/projects/rails-3/app/mailers", "fixtures/projects/rails-3/app/models", "fixtures/projects/rails-3/app/views", "fixtures/projects/rails-3/app/views/layouts", "fixtures/projects/rails-3/app/views/layouts/application.html.erb", "fixtures/projects/rails-3/config", "fixtures/projects/rails-3/config/application.rb", "fixtures/projects/rails-3/config/boot.rb", "fixtures/projects/rails-3/config/database.yml", "fixtures/projects/rails-3/config/environment.rb", "fixtures/projects/rails-3/config/environments", "fixtures/projects/rails-3/config/environments/development.rb", "fixtures/projects/rails-3/config/environments/production.rb", "fixtures/projects/rails-3/config/environments/test.rb", "fixtures/projects/rails-3/config/initializers", "fixtures/projects/rails-3/config/initializers/backtrace_silencers.rb", "fixtures/projects/rails-3/config/initializers/inflections.rb", "fixtures/projects/rails-3/config/initializers/mime_types.rb", "fixtures/projects/rails-3/config/initializers/secret_token.rb", "fixtures/projects/rails-3/config/initializers/session_store.rb", "fixtures/projects/rails-3/config/locales", "fixtures/projects/rails-3/config/locales/en.yml", "fixtures/projects/rails-3/config/routes.rb", "fixtures/projects/rails-3/config.ru", "fixtures/projects/rails-3/db", "fixtures/projects/rails-3/db/seeds.rb", "fixtures/projects/rails-3/doc", "fixtures/projects/rails-3/doc/README_FOR_APP", "fixtures/projects/rails-3/Gemfile", "fixtures/projects/rails-3/Gemfile.lock", "fixtures/projects/rails-3/lib", "fixtures/projects/rails-3/lib/tasks", "fixtures/projects/rails-3/log", "fixtures/projects/rails-3/log/development.log", "fixtures/projects/rails-3/log/production.log", "fixtures/projects/rails-3/log/server.log", "fixtures/projects/rails-3/log/test.log", "fixtures/projects/rails-3/public", "fixtures/projects/rails-3/public/404.html", "fixtures/projects/rails-3/public/422.html", "fixtures/projects/rails-3/public/500.html", "fixtures/projects/rails-3/public/favicon.ico", "fixtures/projects/rails-3/public/images", "fixtures/projects/rails-3/public/images/rails.png", "fixtures/projects/rails-3/public/index.html", "fixtures/projects/rails-3/public/javascripts", "fixtures/projects/rails-3/public/javascripts/application.js", "fixtures/projects/rails-3/public/javascripts/controls.js", "fixtures/projects/rails-3/public/javascripts/dragdrop.js", "fixtures/projects/rails-3/public/javascripts/effects.js", "fixtures/projects/rails-3/public/javascripts/prototype.js", "fixtures/projects/rails-3/public/javascripts/rails.js", "fixtures/projects/rails-3/public/robots.txt", "fixtures/projects/rails-3/public/stylesheets", "fixtures/projects/rails-3/Rakefile", "fixtures/projects/rails-3/README", "fixtures/projects/rails-3/script", "fixtures/projects/rails-3/script/rails", "fixtures/projects/rails-3/test", "fixtures/projects/rails-3/test/fixtures", "fixtures/projects/rails-3/test/functional", "fixtures/projects/rails-3/test/integration", "fixtures/projects/rails-3/test/performance", "fixtures/projects/rails-3/test/performance/browsing_test.rb", "fixtures/projects/rails-3/test/test_helper.rb", "fixtures/projects/rails-3/test/unit", "fixtures/projects/rails-3/vendor", "fixtures/projects/rails-3/vendor/plugins", "fixtures/projects/ruby", "fixtures/projects/ruby/Gemfile", "fixtures/projects/ruby/Gemfile.lock", "fixtures/projects/ruby/Rakefile", "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/core_ext", "lib/hudson/core_ext/object", "lib/hudson/core_ext/object/blank.rb", "lib/hudson/hudson-cli.jar", "lib/hudson/hudson.war", "lib/hudson/hudson_version.rb", "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/version.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.triggers.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", "tasks", "tasks/upgrade.rake"]
14
+ s.files = ["bin", "bin/hudson", "features", "features/development.feature", "features/launch_server.feature", "features/listing_jobs.feature", "features/manage_jobs.feature", "features/manage_slave_nodes.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", "fixtures", "fixtures/projects", "fixtures/projects/non-bundler", "fixtures/projects/non-bundler/Rakefile", "fixtures/projects/rails-3", "fixtures/projects/rails-3/app", "fixtures/projects/rails-3/app/controllers", "fixtures/projects/rails-3/app/controllers/application_controller.rb", "fixtures/projects/rails-3/app/helpers", "fixtures/projects/rails-3/app/helpers/application_helper.rb", "fixtures/projects/rails-3/app/mailers", "fixtures/projects/rails-3/app/models", "fixtures/projects/rails-3/app/views", "fixtures/projects/rails-3/app/views/layouts", "fixtures/projects/rails-3/app/views/layouts/application.html.erb", "fixtures/projects/rails-3/config", "fixtures/projects/rails-3/config/application.rb", "fixtures/projects/rails-3/config/boot.rb", "fixtures/projects/rails-3/config/database.yml", "fixtures/projects/rails-3/config/environment.rb", "fixtures/projects/rails-3/config/environments", "fixtures/projects/rails-3/config/environments/development.rb", "fixtures/projects/rails-3/config/environments/production.rb", "fixtures/projects/rails-3/config/environments/test.rb", "fixtures/projects/rails-3/config/initializers", "fixtures/projects/rails-3/config/initializers/backtrace_silencers.rb", "fixtures/projects/rails-3/config/initializers/inflections.rb", "fixtures/projects/rails-3/config/initializers/mime_types.rb", "fixtures/projects/rails-3/config/initializers/secret_token.rb", "fixtures/projects/rails-3/config/initializers/session_store.rb", "fixtures/projects/rails-3/config/locales", "fixtures/projects/rails-3/config/locales/en.yml", "fixtures/projects/rails-3/config/routes.rb", "fixtures/projects/rails-3/config.ru", "fixtures/projects/rails-3/db", "fixtures/projects/rails-3/db/seeds.rb", "fixtures/projects/rails-3/doc", "fixtures/projects/rails-3/doc/README_FOR_APP", "fixtures/projects/rails-3/Gemfile", "fixtures/projects/rails-3/Gemfile.lock", "fixtures/projects/rails-3/lib", "fixtures/projects/rails-3/lib/tasks", "fixtures/projects/rails-3/log", "fixtures/projects/rails-3/log/development.log", "fixtures/projects/rails-3/log/production.log", "fixtures/projects/rails-3/log/server.log", "fixtures/projects/rails-3/log/test.log", "fixtures/projects/rails-3/public", "fixtures/projects/rails-3/public/404.html", "fixtures/projects/rails-3/public/422.html", "fixtures/projects/rails-3/public/500.html", "fixtures/projects/rails-3/public/favicon.ico", "fixtures/projects/rails-3/public/images", "fixtures/projects/rails-3/public/images/rails.png", "fixtures/projects/rails-3/public/index.html", "fixtures/projects/rails-3/public/javascripts", "fixtures/projects/rails-3/public/javascripts/application.js", "fixtures/projects/rails-3/public/javascripts/controls.js", "fixtures/projects/rails-3/public/javascripts/dragdrop.js", "fixtures/projects/rails-3/public/javascripts/effects.js", "fixtures/projects/rails-3/public/javascripts/prototype.js", "fixtures/projects/rails-3/public/javascripts/rails.js", "fixtures/projects/rails-3/public/robots.txt", "fixtures/projects/rails-3/public/stylesheets", "fixtures/projects/rails-3/Rakefile", "fixtures/projects/rails-3/README", "fixtures/projects/rails-3/script", "fixtures/projects/rails-3/script/rails", "fixtures/projects/rails-3/test", "fixtures/projects/rails-3/test/fixtures", "fixtures/projects/rails-3/test/functional", "fixtures/projects/rails-3/test/integration", "fixtures/projects/rails-3/test/performance", "fixtures/projects/rails-3/test/performance/browsing_test.rb", "fixtures/projects/rails-3/test/test_helper.rb", "fixtures/projects/rails-3/test/unit", "fixtures/projects/rails-3/vendor", "fixtures/projects/rails-3/vendor/plugins", "fixtures/projects/ruby", "fixtures/projects/ruby/Gemfile", "fixtures/projects/ruby/Gemfile.lock", "fixtures/projects/ruby/Rakefile", "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/core_ext", "lib/hudson/core_ext/object", "lib/hudson/core_ext/object/blank.rb", "lib/hudson/hudson-cli.jar", "lib/hudson/hudson.war", "lib/hudson/hudson_version.rb", "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/version.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.triggers.xml", "spec/fixtures/rails.single.config.xml", "spec/fixtures/ruby.single.config.xml", "spec/fixtures/rubygem.config.xml", "spec/fixtures/therubyracer.config.xml", "spec/job_config_builder_spec.rb", "spec/spec_helper.rb", "tasks", "tasks/upgrade.rake"]
15
15
  s.homepage = %q{http://github.com/cowboyd/hudson.rb}
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{hudson}
data/lib/hudson/api.rb CHANGED
@@ -155,12 +155,18 @@ module Hudson
155
155
  false
156
156
  end
157
157
  end
158
+
159
+ def self.delete_node(name)
160
+ post_plain("#{base_uri}/computer/#{CGI::escape(name).gsub('+', '%20')}/doDelete/api/json")
161
+ end
158
162
 
163
+ # Helper for POST that don't barf at Hudson's crappy API responses
159
164
  def self.post_plain(path, options = {})
160
165
  uri = URI.parse base_uri
161
166
  res = Net::HTTP.start(uri.host, uri.port) { |http| http.post(path, options) }
162
167
  end
163
168
 
169
+ # Helper for GET that don't barf at Hudson's crappy API responses
164
170
  def self.get_plain(path, options = {})
165
171
  uri = URI.parse base_uri
166
172
  res = Net::HTTP.start(uri.host, uri.port) { |http| http.get(path, options) }
@@ -2,18 +2,23 @@ require "builder"
2
2
 
3
3
  module Hudson
4
4
  class JobConfigBuilder
5
- attr_accessor :scm, :git_branches, :public_scm
6
5
  attr_accessor :job_type, :matrix_project
6
+ attr_accessor :steps
7
+ attr_accessor :scm, :public_scm, :git_branches, :git_tool
7
8
  attr_accessor :assigned_node
8
9
 
9
10
  InvalidTemplate = Class.new(StandardError)
10
11
 
11
- def initialize(options = nil, &block)
12
- if options.is_a?(String) || options.is_a?(Symbol)
13
- self.job_type = options.to_s
14
- elsif options.is_a?(Hash)
15
- self.job_type = options[:job_type].to_s
16
- end
12
+ # +job_type+ - template of default steps to create with the job
13
+ # +steps+ - array of [:method, cmd], e.g. [:build_shell_step, "bundle initial"]
14
+ # - Default is based on +job_type+.
15
+ # +scm+ - URL to the repository. Currently only support git URLs.
16
+ # +public_scm+ - convert the +scm+ URL to a publicly accessible URL for the Hudson job config.
17
+ # +git_branches+ - array of branches to run builds. Default: ['master']
18
+ # +git_tool+ - key reference for Hudson CI git command. Default: 'Default'
19
+ # +assigned_node+ - restrict this job to running on slaves with these labels (space separated)
20
+ def initialize(job_type = :ruby, &block)
21
+ self.job_type = job_type.to_s if job_type
17
22
 
18
23
  yield self
19
24
 
@@ -95,7 +100,7 @@ module Hudson
95
100
  b.clean false
96
101
  b.wipeOutWorkspace false
97
102
  b.buildChooser :class => "hudson.plugins.git.util.DefaultBuildChooser"
98
- b.gitTool "Default"
103
+ b.gitTool git_tool ? git_tool : "Default"
99
104
  b.submoduleCfg :class => "list"
100
105
  b.relativeTargetDir
101
106
  b.excludedRegions
@@ -128,22 +133,29 @@ module Hudson
128
133
  VALID_JOB_TEMPLATES = %w[rails rails3 ruby rubygem]
129
134
  def build_steps(b)
130
135
  b.builders do
131
- raise InvalidTemplate unless VALID_JOB_TEMPLATES.include?(job_type)
132
- if job_type == "rails" || job_type == "rails3"
133
- build_shell_step b, "bundle install"
134
- build_ruby_step b, <<-RUBY.gsub(/^ /, '')
135
- unless File.exist?("config/database.yml")
136
- require 'fileutils'
137
- example = Dir["config/database*"].first
138
- puts "Using \#{example} for config/database.yml"
139
- FileUtils.cp example, "config/database.yml"
136
+ if job_type
137
+ raise InvalidTemplate unless VALID_JOB_TEMPLATES.include?(job_type)
138
+ if job_type == "rails" || job_type == "rails3"
139
+ build_shell_step b, "bundle install"
140
+ build_ruby_step b, <<-RUBY.gsub(/^ /, '')
141
+ unless File.exist?("config/database.yml")
142
+ require 'fileutils'
143
+ example = Dir["config/database*"].first
144
+ puts "Using \#{example} for config/database.yml"
145
+ FileUtils.cp example, "config/database.yml"
146
+ end
147
+ RUBY
148
+ build_shell_step b, "bundle exec rake db:schema:load"
149
+ build_shell_step b, "bundle exec rake"
150
+ else
151
+ build_shell_step b, "bundle install"
152
+ build_shell_step b, "bundle exec rake"
140
153
  end
141
- RUBY
142
- build_shell_step b, "bundle exec rake db:schema:load"
143
- build_shell_step b, "bundle exec rake"
144
154
  else
145
- build_shell_step b, "bundle install"
146
- build_shell_step b, "bundle exec rake"
155
+ steps.each do |step|
156
+ method, cmd = step
157
+ send(method.to_sym, b, cmd)
158
+ end
147
159
  end
148
160
  end
149
161
  end
@@ -1,3 +1,3 @@
1
1
  module Hudson
2
- VERSION = "0.3.0.beta.14"
2
+ VERSION = "0.3.0.beta.15"
3
3
  end
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project>
3
+ <actions/>
4
+ <description/>
5
+ <keepDependencies>false</keepDependencies>
6
+ <properties/>
7
+ <scm class="hudson.plugins.git.GitSCM">
8
+ <configVersion>1</configVersion>
9
+ <remoteRepositories>
10
+ <org.spearce.jgit.transport.RemoteConfig>
11
+ <string>origin</string>
12
+ <int>5</int>
13
+ <string>fetch</string>
14
+ <string>+refs/heads/*:refs/remotes/origin/*</string>
15
+ <string>receivepack</string>
16
+ <string>git-upload-pack</string>
17
+ <string>uploadpack</string>
18
+ <string>git-upload-pack</string>
19
+ <string>url</string>
20
+ <string>git://codebasehq.com/mocra/misc/mocra-web.git</string>
21
+ <string>tagopt</string>
22
+ <string/>
23
+ </org.spearce.jgit.transport.RemoteConfig>
24
+ </remoteRepositories>
25
+ <branches>
26
+ <hudson.plugins.git.BranchSpec>
27
+ <name>master</name>
28
+ </hudson.plugins.git.BranchSpec>
29
+ </branches>
30
+ <localBranch/>
31
+ <mergeOptions/>
32
+ <recursiveSubmodules>false</recursiveSubmodules>
33
+ <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
34
+ <authorOrCommitter>false</authorOrCommitter>
35
+ <clean>false</clean>
36
+ <wipeOutWorkspace>false</wipeOutWorkspace>
37
+ <buildChooser class="hudson.plugins.git.util.DefaultBuildChooser"/>
38
+ <gitTool>Default</gitTool>
39
+ <submoduleCfg class="list"/>
40
+ <relativeTargetDir/>
41
+ <excludedRegions/>
42
+ <excludedUsers/>
43
+ </scm>
44
+ <canRoam>true</canRoam>
45
+ <disabled>false</disabled>
46
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
47
+ <concurrentBuild>false</concurrentBuild>
48
+ <builders>
49
+ <hudson.tasks.Shell>
50
+ <command>bundle install</command>
51
+ </hudson.tasks.Shell>
52
+ <hudson.tasks.Shell>
53
+ <command>bundle exec rake</command>
54
+ </hudson.tasks.Shell>
55
+ </builders>
56
+ <publishers/>
57
+ <buildWrappers/>
58
+ </project>
@@ -3,11 +3,26 @@ require File.dirname(__FILE__) + "/spec_helper"
3
3
  describe Hudson::JobConfigBuilder do
4
4
  include ConfigFixtureLoaders
5
5
 
6
- describe "rails job; single axis; block syntax" do
6
+ describe "explicit steps to match a ruby job" do
7
+ before do
8
+ @config = Hudson::JobConfigBuilder.new do |c|
9
+ c.scm = "git://codebasehq.com/mocra/misc/mocra-web.git"
10
+ c.steps = [
11
+ [:build_shell_step, "bundle install"],
12
+ [:build_shell_step, "bundle exec rake"]
13
+ ]
14
+ end
15
+ end
16
+ it "builds config.xml" do
17
+ config_xml("ruby", "single").should == @config.to_xml
18
+ end
19
+ end
20
+
21
+
22
+ describe "rails job; single axis" do
7
23
  before do
8
24
  @config = Hudson::JobConfigBuilder.new(:rails) do |c|
9
25
  c.scm = "git://codebasehq.com/mocra/misc/mocra-web.git"
10
- c.git_branches = %w[master]
11
26
  end
12
27
  end
13
28
  it "builds config.xml" do
@@ -15,7 +30,9 @@ describe Hudson::JobConfigBuilder do
15
30
  end
16
31
  end
17
32
 
18
- describe "rubygem job; single axis; block syntax" do
33
+
34
+
35
+ describe "rubygem job; single axis" do
19
36
  before do
20
37
  @config = Hudson::JobConfigBuilder.new(:rubygem) do |c|
21
38
  c.scm = "http://github.com/drnic/picasa_plucker.git"
@@ -53,7 +70,6 @@ describe Hudson::JobConfigBuilder do
53
70
  before do
54
71
  @config = Hudson::JobConfigBuilder.new(:rails) do |c|
55
72
  c.scm = "git@codebasehq.com:mocra/misc/mocra-web.git"
56
- c.git_branches = %w[master]
57
73
  c.public_scm = true
58
74
  end
59
75
  end
@@ -62,4 +78,17 @@ describe Hudson::JobConfigBuilder do
62
78
  end
63
79
  end
64
80
 
81
+ describe "select specific git cmd" do
82
+ before do
83
+ @config = Hudson::JobConfigBuilder.new(:rails) do |c|
84
+ c.scm = "git://codebasehq.com/mocra/misc/mocra-web.git"
85
+ c.git_tool = "xyz"
86
+ c.steps = []
87
+ end
88
+ end
89
+ it "builds config.xml" do
90
+ Hpricot.XML(@config.to_xml).search("gitTool").size.should == 1
91
+ Hpricot.XML(@config.to_xml).search("gitTool").text.should == "xyz"
92
+ end
93
+ end
65
94
  end
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: 62196367
4
+ hash: 62196365
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
9
  - 0
10
10
  - beta
11
- - 14
12
- version: 0.3.0.beta.14
11
+ - 15
12
+ version: 0.3.0.beta.15
13
13
  platform: ruby
14
14
  authors:
15
15
  - Charles Lowell
@@ -18,7 +18,7 @@ autorequire:
18
18
  bindir: bin
19
19
  cert_chain: []
20
20
 
21
- date: 2010-11-01 00:00:00 -07:00
21
+ date: 2010-11-02 00:00:00 -07:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -293,6 +293,7 @@ files:
293
293
  - spec/fixtures/rails.multi.config.xml
294
294
  - spec/fixtures/rails.single.config.triggers.xml
295
295
  - spec/fixtures/rails.single.config.xml
296
+ - spec/fixtures/ruby.single.config.xml
296
297
  - spec/fixtures/rubygem.config.xml
297
298
  - spec/fixtures/therubyracer.config.xml
298
299
  - spec/job_config_builder_spec.rb