tc-client 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,10 @@ options = {}
8
8
  OptionParser.new do |opts|
9
9
  opts.banner = "Usage: tc-client <project name> <build name> [options]"
10
10
 
11
+ opts.on("-r", "--running", "Running builds") do |o|
12
+ options[:running] = o
13
+ end
14
+
11
15
  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
12
16
  options[:verbose] = v
13
17
  end
@@ -27,6 +31,13 @@ OptionParser.new do |opts|
27
31
  end.parse!
28
32
 
29
33
  client = TCClient.new(options[:verbose])
34
+ if options[:running]
35
+ puts "Current running builds: "
36
+ client.running.each do |build|
37
+ puts "#{build[:name]} (#{build[:complete]} %)"
38
+ end
39
+ exit
40
+ end
30
41
 
31
42
  case ARGV.length
32
43
  when 1 then
@@ -22,6 +22,17 @@ class TCClient
22
22
  doc.elements.collect("projects/project") { |p| { :name => p.attributes["name"], :href => p.attributes["href"]} }
23
23
  end
24
24
 
25
+ def running
26
+ xml = get("/httpAuth/app/rest/builds?locator=running:true")
27
+ doc = REXML::Document.new xml
28
+ builds = doc.elements.collect("builds/build") { |p| { :href => p.attributes["href"], :complete => p.attributes["percentageComplete"] } }
29
+ names = builds.collect do |b|
30
+ d = REXML::Document.new get(b[:href])
31
+ d.elements.collect("build/buildType") { |x| { :name => x.attributes["name"], :complete => b[:complete] } }
32
+ end
33
+ names.flatten
34
+ end
35
+
25
36
  def builds(project)
26
37
  p = projects.select{|x| x[:name].match /#{project}/i }
27
38
  return [{:name => "Can't find a project matching '#{project}'"}] if p.empty?
@@ -1,3 +1,3 @@
1
1
  class TCClient
2
- Version = "0.0.3"
2
+ Version = "0.0.4"
3
3
  end
@@ -0,0 +1,19 @@
1
+
2
+ namespace :bump do
3
+ desc "Bumps the minor version"
4
+ task :version do
5
+ version_rb = File.join(File.dirname(__FILE__), "lib", "version.rb")
6
+
7
+ File.open(version_rb, 'r+') do |f|
8
+ new = f.read
9
+ new.gsub!(/(\d+)\.?(\d+)\.?(\*|\d+)/) do
10
+ x = "#{$1}.#{$2}.#{$3.to_i + 1}"
11
+ puts "Version bumped to: #{x}"
12
+ x
13
+ end
14
+ f.rewind
15
+ f.puts(new)
16
+ end
17
+ end
18
+ end
19
+
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tc-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kristoffer Roupe
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-04 00:00:00 +02:00
18
+ date: 2012-05-11 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -49,6 +49,7 @@ files:
49
49
  - bin/tc-client
50
50
  - lib/tc-client.rb
51
51
  - lib/version.rb
52
+ - rakefile.rb
52
53
  - tc-client.gemspec
53
54
  has_rdoc: true
54
55
  homepage: http://github.com/kitofr/tc-client