hudson 0.3.0.beta.1 → 0.3.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/hudson/cli.rb CHANGED
@@ -7,15 +7,15 @@ require 'hudson/remote'
7
7
  module Hudson
8
8
  class CLI < Thor
9
9
  include CLI::Formatting
10
-
10
+
11
11
  map "-v" => :version, "--version" => :version, "-h" => :help, "--help" => :help
12
-
12
+
13
13
  def self.common_options
14
14
  method_option :host, :desc => 'connect to hudson server on this host'
15
15
  method_option :port, :desc => 'connect to hudson server on this port'
16
16
  method_option :server, :desc => 'connect to remote hudson server by search'
17
17
  end
18
-
18
+
19
19
  desc "server [options]", "run a hudson server"
20
20
  method_option :home, :type => :string, :default => File.join(ENV['HOME'], ".hudson", "server"), :banner => "PATH", :desc => "use this directory to store server data"
21
21
  method_option :port, :type => :numeric, :default => 3001, :desc => "run hudson server on this port", :aliases => "-p"
@@ -69,10 +69,10 @@ module Hudson
69
69
  end
70
70
  end
71
71
  end
72
-
73
- desc "list [server] [options]", "list builds on a hudson server"
72
+
73
+ desc "list [options]", "list jobs on a hudson server"
74
74
  common_options
75
- def list(server = nil)
75
+ def list
76
76
  select_hudson_server(options)
77
77
  if summary = Hudson::Api.summary
78
78
  unless summary["jobs"].blank?
@@ -80,19 +80,42 @@ module Hudson
80
80
  summary["jobs"].each do |job|
81
81
  color = job['color']
82
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
83
+ color = 'green' if color == 'blue' || color == 'blue_anime'
84
+ color = 'yellow' if color == 'grey' || color == 'disabled'
85
+ shell.say job['name'], color.to_sym, true
86
86
  end
87
87
  shell.say ""
88
88
  else
89
89
  display "#{@uri} - no jobs"
90
90
  end
91
91
  else
92
- shell.say "#{@uri} - no connection", :red
92
+ error "#{@uri} - no connection"
93
93
  end
94
94
  end
95
-
95
+
96
+ desc "nodes", "list hudson server nodes"
97
+ common_options
98
+ def nodes
99
+ select_hudson_server(options)
100
+ nodes = Hudson::Api.nodes
101
+ nodes["computer"].each do |node|
102
+ color = node["offline"] ? :red : :green
103
+ shell.say node["displayName"], color
104
+ end
105
+ end
106
+
107
+ desc "job name [options]", "display job status"
108
+ common_options
109
+ def job(name)
110
+ select_hudson_server(options)
111
+ if job = Hudson::Api.job(name)
112
+ require "ap"
113
+ ap job
114
+ else
115
+ error "#{@uri} - no connection"
116
+ end
117
+ end
118
+
96
119
  # desc "add_remote name [options]", "manage remote servers (comming sometime to a theater near you)"
97
120
  # common_options
98
121
  # def add_remote(name)
@@ -103,24 +126,24 @@ module Hudson
103
126
  # error "Could not add remote server for '#{@uri}'"
104
127
  # end
105
128
  # end
106
-
129
+
107
130
  desc "help [command]", "show help for hudson or for a specific command"
108
131
  def help(*args)
109
132
  super(*args)
110
133
  end
111
-
134
+
112
135
  desc "version", "show version information"
113
136
  def version
114
137
  shell.say "#{Hudson::VERSION} (Hudson Server #{Hudson::HUDSON_VERSION})"
115
138
  end
116
139
 
117
- def self.help(shell)
140
+ def self.help(shell, *)
118
141
  list = printable_tasks
119
142
  shell.say <<-USEAGE
120
143
  Hudson.rb is a smart set of utilities for making
121
144
  continuous integration as simple as possible
122
145
 
123
- Usage: hudson command [arguments] [options]
146
+ Usage: hudson command [arguments] [options]
124
147
 
125
148
  USEAGE
126
149
 
@@ -129,15 +152,15 @@ USEAGE
129
152
  shell.say
130
153
  class_options_help(shell)
131
154
  end
132
-
155
+
133
156
  private
134
-
157
+
135
158
  def select_hudson_server(options)
136
159
  unless @uri = Hudson::Api.setup_base_url(options)
137
160
  error "Either use --host or add remote servers."
138
161
  end
139
162
  end
140
-
163
+
141
164
  def display(text)
142
165
  shell.say text
143
166
  exit
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: 62196369
4
+ hash: 62196375
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
9
  - 0
10
10
  - beta
11
- - 1
12
- version: 0.3.0.beta.1
11
+ - 2
12
+ version: 0.3.0.beta.2
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-10-11 00:00:00 -07:00
21
+ date: 2010-10-27 00:00:00 -07:00
22
22
  default_executable:
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
@@ -222,6 +222,8 @@ extra_rdoc_files: []
222
222
 
223
223
  files:
224
224
  - bin/hudson
225
+ - bin/hudson.compiled.rbc
226
+ - features/adding_slave_nodes.feature
225
227
  - features/create_jobs.feature
226
228
  - features/development.feature
227
229
  - features/fixtures/projects/ruby/Rakefile
@@ -240,6 +242,7 @@ files:
240
242
  - Gemfile.lock
241
243
  - hudson.gemspec
242
244
  - lib/hudson/api.rb
245
+ - lib/hudson/api.rbc
243
246
  - lib/hudson/cli/formatting.rb
244
247
  - lib/hudson/cli.rb
245
248
  - lib/hudson/config.rb
@@ -254,6 +257,7 @@ files:
254
257
  - lib/hudson/project_scm.rb
255
258
  - lib/hudson/remote.rb
256
259
  - lib/hudson.rb
260
+ - lib/hudson.rbc
257
261
  - Rakefile
258
262
  - README.md
259
263
  - spec/fixtures/ec2_global.config.xml