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 CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.1.8 / 2010-04-15
2
+
3
+ * Added Project#build_status
4
+
1
5
  == 0.1.7 27-MAR-2010
2
6
 
3
7
  * Small fixes to Build support
data/Rakefile CHANGED
@@ -17,6 +17,7 @@ rescue LoadError
17
17
  end
18
18
 
19
19
  Hoe.plugin :website
20
+ Hoe.plugin :git
20
21
 
21
22
  $hoe = Hoe.spec('codefumes') do
22
23
  self.summary = "A client-side implementation of the CodeFumes.com API."
@@ -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['project']['public_key']
93
- @private_key = options['project']['private_key']
94
- @short_uri = options['project']['short_uri']
95
- @community_uri = options['project']['community_uri']
96
- @api_uri = options['project']['api_uri']
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
@@ -10,5 +10,5 @@ require 'codefumes/payload'
10
10
  require 'codefumes/project'
11
11
 
12
12
  module CodeFumes
13
- VERSION = '0.1.7' unless defined?(CodeFumes::VERSION)
13
+ VERSION = '0.1.8' unless defined?(CodeFumes::VERSION)
14
14
  end
@@ -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
@@ -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
- - 7
9
- version: 0.1.7
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-03-27 00:00:00 -05:00
18
+ date: 2010-04-15 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency