Skip to content

Commit

Permalink
changed display for 'hudson list'; and displays 'no jobs' as necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
drnic committed Oct 11, 2010
1 parent 51826a1 commit de46a45
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile
@@ -1,3 +1,3 @@
source 'http://rubygems.org'

gemspec
gemspec
3 changes: 3 additions & 0 deletions Gemfile.lock
Expand Up @@ -2,6 +2,7 @@ PATH
remote: .
specs:
hudson (0.3.0.beta.1)
activesupport (~> 3.0.0)
builder (~> 2.1.2)
hpricot
httparty (~> 0.5.2)
Expand All @@ -12,6 +13,7 @@ PATH
GEM
remote: http://rubygems.org/
specs:
activesupport (3.0.0)
awesome_print (0.2.1)
builder (2.1.2)
crack (0.1.6)
Expand Down Expand Up @@ -48,6 +50,7 @@ PLATFORMS
ruby

DEPENDENCIES
activesupport (~> 3.0.0)
awesome_print
builder (~> 2.1.2)
cucumber (~> 0.9.0)
Expand Down
1 change: 1 addition & 0 deletions Rakefile
Expand Up @@ -23,6 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency("httparty", ["~> 0.5.2"])
s.add_dependency("builder", ["~> 2.1.2"])
s.add_dependency("thor", ["= 0.14.2"])
s.add_dependency("activesupport", ["~> 3.0.0"])
s.add_dependency("hpricot")
s.add_development_dependency("rake", ["~> 0.8.7"])
s.add_development_dependency("cucumber", ["~> 0.9.0"])
Expand Down
26 changes: 26 additions & 0 deletions features/listing_jobs.feature
@@ -0,0 +1,26 @@
Feature: Listing jobs
I want to see the status of jobs on servers I'm interested in

Scenario: List jobs on a non-existent server
When I run local executable "hudson" with arguments "list test --host localhost --port 9999"
Then I should see "localhost:9999 - no connection"

Scenario: List jobs on a server with no jobs
Given I have a Hudson server running
And the Hudson server has no current jobs
When I run local executable "hudson" with arguments "list test --host localhost --port 3010"
Then I should see "localhost:3010 - no jobs"

Scenario: List jobs on a server with jobs
Given I have a Hudson server running
And the Hudson server has no current jobs
And I am in the "ruby" project folder
And the project uses "git" scm
When I run local executable "hudson" with arguments "create . --host localhost --port 3010"
When I run local executable "hudson" with arguments "list --host localhost --port 3010"
Then I should see "localhost:3010 -"
Then I should see "ruby"




5 changes: 4 additions & 1 deletion hudson.gemspec
Expand Up @@ -11,7 +11,7 @@ Gem::Specification.new do |s|
s.description = %q{A suite of utilities for bringing continous integration to your projects (not the other way around) with hudson CI}
s.email = ["cowboyd@thefrontside.net", "drnicwilliams@gmail.com"]
s.executables = ["hudson"]
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", "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/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"]
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/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"]
s.homepage = %q{http://github.com/cowboyd/hudson.rb}
s.require_paths = ["lib"]
s.rubyforge_project = %q{hudson}
Expand All @@ -28,6 +28,7 @@ Gem::Specification.new do |s|
s.add_runtime_dependency(%q<httparty>, ["~> 0.5.2"])
s.add_runtime_dependency(%q<builder>, ["~> 2.1.2"])
s.add_runtime_dependency(%q<thor>, ["= 0.14.2"])
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.0"])
s.add_runtime_dependency(%q<hpricot>, [">= 0"])
s.add_development_dependency(%q<rake>, ["~> 0.8.7"])
s.add_development_dependency(%q<cucumber>, ["~> 0.9.0"])
Expand All @@ -40,6 +41,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<httparty>, ["~> 0.5.2"])
s.add_dependency(%q<builder>, ["~> 2.1.2"])
s.add_dependency(%q<thor>, ["= 0.14.2"])
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
s.add_dependency(%q<hpricot>, [">= 0"])
s.add_dependency(%q<rake>, ["~> 0.8.7"])
s.add_dependency(%q<cucumber>, ["~> 0.9.0"])
Expand All @@ -53,6 +55,7 @@ Gem::Specification.new do |s|
s.add_dependency(%q<httparty>, ["~> 0.5.2"])
s.add_dependency(%q<builder>, ["~> 2.1.2"])
s.add_dependency(%q<thor>, ["= 0.14.2"])
s.add_dependency(%q<activesupport>, ["~> 3.0.0"])
s.add_dependency(%q<hpricot>, [">= 0"])
s.add_dependency(%q<rake>, ["~> 0.8.7"])
s.add_dependency(%q<cucumber>, ["~> 0.9.0"])
Expand Down
9 changes: 6 additions & 3 deletions lib/hudson/cli.rb
@@ -1,5 +1,6 @@
require 'thor'
require 'hudson/cli/formatting'
require 'active_support/core_ext/object/blank'

module Hudson
class CLI < Thor
Expand Down Expand Up @@ -72,16 +73,18 @@ def create(project_path = ".")
def list(server = nil)
select_hudson_server(options)
if summary = Hudson::Api.summary
if summary["jobs"]
unless summary["jobs"].blank?
shell.say "#{@uri} -"
summary["jobs"].each do |job|
color = job['color']
color = 'red' if color == 'red_anime'
color = 'green' if color == 'blue'
color = 'yellow' if color == 'grey'
shell.say job['name'], color.to_sym, false
shell.say " - #{job['url']}"
end
shell.say ""
else
display "No jobs found on #{@uri}"
display "#{@uri} - no jobs"
end
else
error "Failed connection to #{@uri}"
Expand Down

0 comments on commit de46a45

Please sign in to comment.