codefumes 0.1.7 → 0.1.8
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.
- data/History.txt +4 -0
- data/Rakefile +1 -0
- data/lib/codefumes/project.rb +10 -8
- data/lib/codefumes.rb +1 -1
- data/spec/codefumes/project_spec.rb +26 -0
- data/spec/fixtures/project.xml +1 -0
- metadata +3 -3
data/History.txt
CHANGED
data/Rakefile
CHANGED
data/lib/codefumes/project.rb
CHANGED
@@ -4,7 +4,7 @@ module CodeFumes
|
|
4
4
|
# name defined. Projects are also associated with a collection of
|
5
5
|
# commits from a repository.
|
6
6
|
class Project < CodeFumes::API
|
7
|
-
attr_reader :private_key, :short_uri, :community_uri, :api_uri
|
7
|
+
attr_reader :private_key, :short_uri, :community_uri, :api_uri, :build_status
|
8
8
|
attr_accessor :name,:public_key
|
9
9
|
|
10
10
|
# Accepts Hash containing the following keys:
|
@@ -44,7 +44,7 @@ module CodeFumes
|
|
44
44
|
response = exists? ? update : create
|
45
45
|
case response.code
|
46
46
|
when 201, 200
|
47
|
-
reinitialize!(response)
|
47
|
+
reinitialize!(response['project'])
|
48
48
|
true
|
49
49
|
else
|
50
50
|
false
|
@@ -81,7 +81,7 @@ module CodeFumes
|
|
81
81
|
case response.code
|
82
82
|
when 200
|
83
83
|
project = Project.new
|
84
|
-
project.reinitialize!(response)
|
84
|
+
project.reinitialize!(response['project'])
|
85
85
|
else
|
86
86
|
nil
|
87
87
|
end
|
@@ -89,11 +89,13 @@ module CodeFumes
|
|
89
89
|
|
90
90
|
# TODO: Make this a private method
|
91
91
|
def reinitialize!(options = {}) #:nodoc:
|
92
|
-
@public_key = options['
|
93
|
-
@private_key = options['
|
94
|
-
@short_uri = options['
|
95
|
-
@community_uri = options['
|
96
|
-
@api_uri = options['
|
92
|
+
@public_key = options['public_key']
|
93
|
+
@private_key = options['private_key']
|
94
|
+
@short_uri = options['short_uri']
|
95
|
+
@community_uri = options['community_uri']
|
96
|
+
@api_uri = options['api_uri']
|
97
|
+
@build_status = options['build_status'].empty? ? nil : options['build_status']
|
98
|
+
@build_status && @build_status.sub!(/_build/, '')
|
97
99
|
self
|
98
100
|
end
|
99
101
|
|
data/lib/codefumes.rb
CHANGED
@@ -245,4 +245,30 @@ describe "Project" do
|
|
245
245
|
end
|
246
246
|
end
|
247
247
|
end
|
248
|
+
|
249
|
+
describe "reinitialize" do
|
250
|
+
context "when the server has returned a build_status of 'running_build'" do
|
251
|
+
it "returns 'running'" do
|
252
|
+
project = Project.new
|
253
|
+
project.reinitialize!({'build_status' => "running_build"})
|
254
|
+
project.build_status.should == 'running'
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
context "when the server has returned a build_status of 'nobuilds'" do
|
259
|
+
it "returns 'nobuilds'" do
|
260
|
+
project = Project.new
|
261
|
+
project.reinitialize!({'build_status' => "nobuilds"})
|
262
|
+
project.build_status.should == 'nobuilds'
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
266
|
+
context "when the server has returned a build_status of ''" do
|
267
|
+
it "returns nil" do
|
268
|
+
project = Project.new
|
269
|
+
project.reinitialize!({'build_status' => ""})
|
270
|
+
project.build_status.should be_nil
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
248
274
|
end
|
data/spec/fixtures/project.xml
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
<public-key>public_key_value</public-key>
|
6
6
|
<private-key>private_key_value</private-key>
|
7
7
|
<name>Project_Name(tm)</name>
|
8
|
+
<build_status>running_build</build_status>
|
8
9
|
<updated-at type="datetime">2009-04-29T23:18:03Z</updated-at>
|
9
10
|
<short_uri>http://codefumes.com/p/public_key_value</short_uri>
|
10
11
|
<community_uri>http://codefumes.com/community/projects/public_key_value</community_uri>
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 8
|
9
|
+
version: 0.1.8
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tom Kersten
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-04-15 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|