tc-client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/bin/tc-client +14 -0
- data/lib/tc-client.rb +37 -0
- data/lib/version.rb +3 -0
- metadata +88 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*swp
|
data/bin/tc-client
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
require 'tc-client'
|
5
|
+
|
6
|
+
if ARGV.length != 1
|
7
|
+
puts "Usage: #{File.basename(__FILE__)} [build project]"
|
8
|
+
puts "Available builds:"
|
9
|
+
puts projects.keys.sort
|
10
|
+
Process.exit
|
11
|
+
end
|
12
|
+
|
13
|
+
client = TCClient.new(ARGV[0])
|
14
|
+
puts client.builds
|
data/lib/tc-client.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'restclient'
|
3
|
+
require 'rexml/document'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
def config
|
7
|
+
file = File.expand_path('~/.tc-client')
|
8
|
+
raise "No configuration file found! Please provide one at #{file}" unless File.exists? file
|
9
|
+
@config ||= YAML::load(File.open(file))
|
10
|
+
end
|
11
|
+
|
12
|
+
def projects
|
13
|
+
config["projects"].to_hash
|
14
|
+
end
|
15
|
+
|
16
|
+
class TCClient
|
17
|
+
def initialize(project)
|
18
|
+
@count = 10
|
19
|
+
@project = projects[project]
|
20
|
+
|
21
|
+
@base_url = config["base_url"]
|
22
|
+
puts "last #{@count} (successful) builds for #{project} (#{@project})"
|
23
|
+
@user = config["user"]
|
24
|
+
@pwd = config["pwd"]
|
25
|
+
end
|
26
|
+
|
27
|
+
def builds
|
28
|
+
xml = RestClient.get "http://#{@user}:#{@pwd}@#{@base_url}/httpAuth/app/rest/buildTypes/id:#{@project}/builds?status=SUCCESS&count=#{@count}"
|
29
|
+
doc = REXML::Document.new xml
|
30
|
+
builds = []
|
31
|
+
doc.elements.each("builds/build") do |build|
|
32
|
+
builds << build.attributes["number"]
|
33
|
+
end
|
34
|
+
builds
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
data/lib/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tc-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Kristoffer Roupe
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-06-21 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rest-client
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 13
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 6
|
33
|
+
- 1
|
34
|
+
version: 1.6.1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
description: Sometimes you just need to know!
|
38
|
+
email:
|
39
|
+
- kitofr@gmail.com
|
40
|
+
executables:
|
41
|
+
- tc-client
|
42
|
+
extensions: []
|
43
|
+
|
44
|
+
extra_rdoc_files: []
|
45
|
+
|
46
|
+
files:
|
47
|
+
- .gitignore
|
48
|
+
- bin/tc-client
|
49
|
+
- lib/tc-client.rb
|
50
|
+
- lib/version.rb
|
51
|
+
has_rdoc: true
|
52
|
+
homepage: http://github.com/kitofr/tc-client
|
53
|
+
licenses: []
|
54
|
+
|
55
|
+
post_install_message:
|
56
|
+
rdoc_options: []
|
57
|
+
|
58
|
+
require_paths:
|
59
|
+
- lib
|
60
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
hash: 57
|
66
|
+
segments:
|
67
|
+
- 1
|
68
|
+
- 8
|
69
|
+
- 7
|
70
|
+
version: 1.8.7
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
version: "0"
|
80
|
+
requirements: []
|
81
|
+
|
82
|
+
rubyforge_project: tc-client
|
83
|
+
rubygems_version: 1.3.7
|
84
|
+
signing_key:
|
85
|
+
specification_version: 3
|
86
|
+
summary: A simple ruby based Team City build checker
|
87
|
+
test_files: []
|
88
|
+
|