hudson-remote-cli 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -0
- data/lib/hudson-remote-cli/build.rb +17 -0
- data/lib/hudson-remote-cli/version.rb +1 -1
- data/spec/job_spec.rb +7 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -123,6 +123,12 @@ b = Hudson::Build.new('job_name', 142)
|
|
123
123
|
# get all informations of the build
|
124
124
|
b.api
|
125
125
|
|
126
|
+
# get build description
|
127
|
+
b.description
|
128
|
+
|
129
|
+
# set build description
|
130
|
+
b.description = 'some description'
|
131
|
+
|
126
132
|
# get the result of this build
|
127
133
|
b.result
|
128
134
|
|
@@ -17,12 +17,29 @@ module Hudson
|
|
17
17
|
api_base = "job/#{@job.name}/#{@number}"
|
18
18
|
@api_build = "#{api_base}/api/json"
|
19
19
|
@api_build_console = "#{api_base}/consoleText"
|
20
|
+
@api_build_description = "#{api_base}/submitDescription"
|
20
21
|
end
|
21
22
|
|
22
23
|
def api(keys = nil, refresh = false)
|
23
24
|
api_base(@api_build, keys, refresh)
|
24
25
|
end
|
25
26
|
|
27
|
+
def active?
|
28
|
+
api('building', true)['building']
|
29
|
+
end
|
30
|
+
|
31
|
+
def description
|
32
|
+
api('description', true)['description']
|
33
|
+
end
|
34
|
+
|
35
|
+
def description=(description)
|
36
|
+
send_post_request(uri_for(@api_build_description), {
|
37
|
+
:description => description,
|
38
|
+
:json => "{\"description\": \"#{description}\"}",
|
39
|
+
:Submit => 'Submit',
|
40
|
+
})
|
41
|
+
end
|
42
|
+
|
26
43
|
def start_time
|
27
44
|
Time.at(api('timestamp')['timestamp'] / 1000)
|
28
45
|
end
|
data/spec/job_spec.rb
CHANGED
@@ -36,7 +36,7 @@ module Hudson
|
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'job description set/get' do
|
39
|
-
it '
|
39
|
+
it 'should be "test success"' do
|
40
40
|
@job.description = 'test success'
|
41
41
|
@job.description.should eq('test success')
|
42
42
|
end
|
@@ -68,6 +68,12 @@ module Hudson
|
|
68
68
|
it 'should be suit for the time in record' do
|
69
69
|
(10 - (@build.end_time - @build.start_time)).should < 2
|
70
70
|
end
|
71
|
+
|
72
|
+
it 'should be "haha, test success"' do
|
73
|
+
test_s = "haha, test success"
|
74
|
+
@build.description = test_s
|
75
|
+
@build.description.should eq(test_s)
|
76
|
+
end
|
71
77
|
end
|
72
78
|
|
73
79
|
describe '#delete' do
|