codefumes 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,101 @@
1
+ module CodeFumesServiceHelpers
2
+ module Shared
3
+ # These are used pratically _everywhere_
4
+ def setup_fixture_base
5
+ @project_name = "Project_Name(tm)"
6
+ @pub_key = 'public_key_value'
7
+ @priv_key = 'private_key_value'
8
+ @project = CodeFumes::Project.new(:public_key => @pub_key, :private_key => @priv_key, :name => @project_name)
9
+
10
+ @anonymous_base_uri = "http://codefumes.com/api/v1/xml"
11
+ @authenticated_base_uri = "http://#{@pub_key}:#{@priv_key}@codefumes.com/api/v1/xml"
12
+ @authd_project_api_uri = "#{@authenticated_base_uri}/projects/#{@pub_key}"
13
+ @anon_project_api_uri = "#{@anonymous_base_uri}/projects/#{@pub_key}"
14
+ @updated_name = @project_name + "_updated"
15
+ @commit_data = "commit_data"
16
+ @api_key = "USERS_API_KEY"
17
+ end
18
+
19
+ def fixtures
20
+ @fixtures ||= ResponseFixtureSet.new
21
+ end
22
+ end
23
+
24
+ module Project
25
+ def register_no_param_create_uri(status_code = ["200", "Ok"], body_content = fixtures[:project])
26
+ FakeWeb.register_uri( :post, "#{@anonymous_base_uri}/projects?project[name]=&project[public_key]=",
27
+ :status => status_code,
28
+ :body => body_content)
29
+ end
30
+
31
+ def register_create_uri(status_code = ["200", "Ok"], body_content = fixtures[:project])
32
+ FakeWeb.register_uri( :post, "#{@anonymous_base_uri}/projects?project[name]=#{@project_name}&project[public_key]=#{@pub_key}",
33
+ :status => status_code,
34
+ :body => body_content)
35
+ end
36
+
37
+ def register_update_uri(status_code = ["200", "Ok"], body_content = fixtures[:project])
38
+ FakeWeb.register_uri(:put, "#{@authd_project_api_uri}?project[name]=#{@project_name}_updated",
39
+ :status => status_code,
40
+ :body => body_content)
41
+ end
42
+
43
+ def register_show_uri(status_code = ["200", "Ok"], body_content = fixtures[:project])
44
+ FakeWeb.register_uri(:get, @anon_project_api_uri,
45
+ :status => status_code,
46
+ :body => body_content)
47
+ end
48
+
49
+ def register_delete_uri(status_code = ["200", "Ok"], body_content = fixtures[:project])
50
+ FakeWeb.register_uri(:delete, @authd_project_api_uri,
51
+ :status => status_code,
52
+ :body => body_content)
53
+ end
54
+ end
55
+
56
+ module Commit
57
+ def register_latest_uri(status_code = ["200", "Ok"], body_content = fixtures[:commit])
58
+ FakeWeb.register_uri(:get, "#{@anon_project_api_uri}/commits/latest",
59
+ :status => status_code, :body => body_content)
60
+ end
61
+
62
+ def register_index_uri(status_code = ["200", "Ok"], body_content = fixtures[:multiple_commits])
63
+ FakeWeb.register_uri( :get, "#{@anon_project_api_uri}/commits",
64
+ :status => status_code,
65
+ :body => body_content)
66
+ end
67
+
68
+ def register_find_uri(status_code = ["200", "Ok"], body_content = fixtures[:commit])
69
+ FakeWeb.register_uri(:get, "#{@anonymous_base_uri}/commits/#{@identifier}",
70
+ :status => status_code, :body => body_content)
71
+ end
72
+ end
73
+
74
+ module Payload
75
+ def register_create_uri(status_code = ["200", "Ok"], body_content = fixtures[:payload])
76
+ FakeWeb.register_uri(:post, "#{@authd_project_api_uri}/payloads?payload[commits]=#{@commit_data}",
77
+ :status => status_code, :body => body_content)
78
+ end
79
+ end
80
+
81
+ module Claim
82
+ def register_public_create_uri(status_code = ["200", "Ok"], body_content = "")
83
+ register_create_uri(status_code, body_content, :public)
84
+ end
85
+
86
+ def register_private_create_uri(status_code = ["200", "Ok"], body_content = "")
87
+ register_create_uri(status_code, body_content, :private)
88
+ end
89
+
90
+ def register_destroy_uri(status_code = ["200", "Ok"], body_content = "")
91
+ request_uri = "#{@authd_project_api_uri}/claim?api_key=#{@api_key}"
92
+ FakeWeb.register_uri(:delete, request_uri, :status => status_code, :body => body_content)
93
+ end
94
+
95
+ private
96
+ def register_create_uri(status_code, body_content, visibility)
97
+ request_uri = "#{@authd_project_api_uri}/claim?api_key=#{@api_key}&visibility=#{visibility.to_s}"
98
+ FakeWeb.register_uri(:put, request_uri, :status => status_code, :body => body_content)
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <commit>
3
+ <identifier>f3badd5624dfbcf5176f0471261731e1b92ce957</identifier>
4
+ <author_name>John Doe</author_name>
5
+ <author_email>jdoe@example.com</author_email>
6
+ <committer_name>John Doe</committer_name>
7
+ <committer_email>jdoe@example.com</committer_email>
8
+ <short_message>Made command-line option for 'name' actually work</short_message>
9
+ <message>
10
+ Made command-line option for 'name' actually work
11
+ - Commentd out hard-coded 'require' line used for testing
12
+ </message>
13
+ <parent_identifiers>9ddj48423jdsjds5176f0471261731e1b92ce957,3ewdjok23jdsjds5176f0471261731e1b92ce957,284djsksjfjsjds5176f0471261731e1b92ce957</parent_identifiers>
14
+ <committed_at>Wed May 20 09:09:06 -0500 2009</committed_at>
15
+ <authored_at>Wed May 20 09:09:06 -0500 2009</authored_at>
16
+ <uploaded_at>2009-06-04 02:43:20 UTC</uploaded_at>
17
+ <api_uri>http://localhost:3000/api/v1/commits/f3badd5624dfbcf5176f0471261731e1b92ce957.xml</api_uri>
18
+ <line_additions>20</line_additions>
19
+ <line_deletions>10</line_deletions>
20
+ <line_total>30</line_total>
21
+ <affected_file_count>2</affected_file_count>
22
+ </commit>
@@ -0,0 +1,26 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <commit>
3
+ <identifier>f3badd5624dfbcf5176f0471261731e1b92ce957</identifier>
4
+ <author_name>John Doe</author_name>
5
+ <author_email>jdoe@example.com</author_email>
6
+ <committer_name>John Doe</committer_name>
7
+ <committer_email>jdoe@example.com</committer_email>
8
+ <short_message>Made command-line option for 'name' actually work</short_message>
9
+ <message>
10
+ Made command-line option for 'name' actually work
11
+ - Commentd out hard-coded 'require' line used for testing
12
+ </message>
13
+ <parent_identifiers>9ddj48423jdsjds5176f0471261731e1b92ce957,3ewdjok23jdsjds5176f0471261731e1b92ce957,284djsksjfjsjds5176f0471261731e1b92ce957</parent_identifiers>
14
+ <committed_at>Wed May 20 09:09:06 -0500 2009</committed_at>
15
+ <authored_at>Wed May 20 09:09:06 -0500 2009</authored_at>
16
+ <uploaded_at>2009-06-04 02:43:20 UTC</uploaded_at>
17
+ <api_uri>http://localhost:3000/api/v1/commits/f3badd5624dfbcf5176f0471261731e1b92ce957.xml</api_uri>
18
+ <line_additions>20</line_additions>
19
+ <line_deletions>10</line_deletions>
20
+ <line_total>30</line_total>
21
+ <affected_file_count>2</affected_file_count>
22
+ <custom_attributes>
23
+ <coverage>83</coverage>
24
+ <random_attribute>1</random_attribute>
25
+ </custom_attributes>
26
+ </commit>
@@ -0,0 +1,78 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <commits>
3
+ <commit>
4
+ <identifier>f3badd5624dfbcf5176f0471261731e1b92ce957</identifier>
5
+ <author_name>John Doe</author_name>
6
+ <author_email>jdoe@example.com</author_email>
7
+ <committer_name>John Doe</committer_name>
8
+ <committer_email>jdoe@example.com</committer_email>
9
+ <short_message>Made command-line option for 'name' actually work</short_message>
10
+ <message>
11
+ Made command-line option for 'name' actually work
12
+ - Commentd out hard-coded 'require' line used for testing
13
+ </message>
14
+ <parent_identifiers>9ddj48423jdsjds5176f0471261731e1b92ce957,3ewdjok23jdsjds5176f0471261731e1b92ce957,284djsksjfjsjds5176f0471261731e1b92ce957</parent_identifiers>
15
+ <committed_at>Wed May 20 09:09:06 -0500 2009</committed_at>
16
+ <authored_at>Wed May 20 09:09:06 -0500 2009</authored_at>
17
+ <uploaded_at>2009-06-04 02:43:20 UTC</uploaded_at>
18
+ <api_uri>http://localhost:3000/api/v1/commits/f3badd5624dfbcf5176f0471261731e1b92ce957.xml</api_uri>
19
+ <line_additions>20</line_additions>
20
+ <line_deletions>10</line_deletions>
21
+ <line_total>30</line_total>
22
+ <affected_file_count>2</affected_file_count>
23
+ <custom_attributes>
24
+ <coverage>83</coverage>
25
+ <random_attribute>1</random_attribute>
26
+ </custom_attributes>
27
+ </commit>
28
+ <commit>
29
+ <identifier>f3badd5624dfbcf5176f0471261731e1b92ce958</identifier>
30
+ <author_name>John Doe</author_name>
31
+ <author_email>jdoe@example.com</author_email>
32
+ <committer_name>John Doe</committer_name>
33
+ <committer_email>jdoe@example.com</committer_email>
34
+ <short_message>Made command-line option for 'name' actually work</short_message>
35
+ <message>
36
+ Made command-line option for 'name' actually work
37
+ - Commentd out hard-coded 'require' line used for testing
38
+ </message>
39
+ <parent_identifiers>9ddj48423jdsjds5176f0471261731e1b92ce957,3ewdjok23jdsjds5176f0471261731e1b92ce957,284djsksjfjsjds5176f0471261731e1b92ce957</parent_identifiers>
40
+ <committed_at>Wed May 20 09:09:06 -0500 2009</committed_at>
41
+ <authored_at>Wed May 20 09:09:06 -0500 2009</authored_at>
42
+ <uploaded_at>2009-06-04 02:43:20 UTC</uploaded_at>
43
+ <api_uri>http://localhost:3000/api/v1/commits/f3badd5624dfbcf5176f0471261731e1b92ce957.xml</api_uri>
44
+ <line_additions>20</line_additions>
45
+ <line_deletions>10</line_deletions>
46
+ <line_total>30</line_total>
47
+ <affected_file_count>2</affected_file_count>
48
+ <custom_attributes>
49
+ <coverage>83</coverage>
50
+ <random_attribute>1</random_attribute>
51
+ </custom_attributes>
52
+ </commit>
53
+ <commit>
54
+ <identifier>f3badd5624dfbcf5176f0471261731e1b92ce959</identifier>
55
+ <author_name>John Doe</author_name>
56
+ <author_email>jdoe@example.com</author_email>
57
+ <committer_name>John Doe</committer_name>
58
+ <committer_email>jdoe@example.com</committer_email>
59
+ <short_message>Made command-line option for 'name' actually work</short_message>
60
+ <message>
61
+ Made command-line option for 'name' actually work
62
+ - Commentd out hard-coded 'require' line used for testing
63
+ </message>
64
+ <parent_identifiers>9ddj48423jdsjds5176f0471261731e1b92ce957,3ewdjok23jdsjds5176f0471261731e1b92ce957,284djsksjfjsjds5176f0471261731e1b92ce957</parent_identifiers>
65
+ <committed_at>Wed May 20 09:09:06 -0500 2009</committed_at>
66
+ <authored_at>Wed May 20 09:09:06 -0500 2009</authored_at>
67
+ <uploaded_at>2009-06-04 02:43:20 UTC</uploaded_at>
68
+ <api_uri>http://localhost:3000/api/v1/commits/f3badd5624dfbcf5176f0471261731e1b92ce957.xml</api_uri>
69
+ <line_additions>20</line_additions>
70
+ <line_deletions>10</line_deletions>
71
+ <line_total>30</line_total>
72
+ <affected_file_count>2</affected_file_count>
73
+ <custom_attributes>
74
+ <coverage>83</coverage>
75
+ <random_attribute>1</random_attribute>
76
+ </custom_attributes>
77
+ </commit>
78
+ </commits>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <payload>
3
+ <created_at>2009-09-26 21:19:11 UTC</created_at>
4
+ </payload>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project>
3
+ <access-secret nil="true"></access-secret>
4
+ <created-at type="datetime">2009-04-29T23:18:03Z</created-at>
5
+ <public-key>public_key_value</public-key>
6
+ <private-key>private_key_value</private-key>
7
+ <name>Project_Name(tm)</name>
8
+ <updated-at type="datetime">2009-04-29T23:18:03Z</updated-at>
9
+ <short_uri>http://codefumes.com/p/public_key_value</short_uri>
10
+ <community_uri>http://codefumes.com/community/projects/public_key_value</community_uri>
11
+ <api-uri>http://codefumes.com/api/v1/xml/projects/public_key_value.xml</api-uri>
12
+ </project>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project>
3
+ <access-secret nil="true"></access-secret>
4
+ <created-at type="datetime">2009-04-29T23:18:03Z</created-at>
5
+ <public-key>public_key_value</public-key>
6
+ <private-key>private_key_value</private-key>
7
+ <name>The Project Name(tm) updated</name>
8
+ <updated-at type="datetime">2009-04-29T23:18:03Z</updated-at>
9
+ <short_uri>http://codefumes.com/p/public_key_value</short_uri>
10
+ <community_uri>http://codefumes.com/community/projects/public_key_value</community_uri>
11
+ <api-uri>http://codefumes.com/api/v1/xml/projects/public_key_value.xml</api-uri>
12
+ </project>
data/spec/spec_helper.rb CHANGED
@@ -7,11 +7,19 @@ rescue LoadError
7
7
  require 'spec'
8
8
  end
9
9
 
10
+ # For autospec...there has to be a better solution
11
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
12
  require 'codefumes'
11
13
 
12
- # CodeFumes service 'fixtures'
13
- require 'spec/codefumes_service_stubs'
14
+ require 'spec/codefumes_service_helpers'
15
+ include CodeFumesServiceHelpers::Shared
14
16
 
15
17
  include CodeFumes
16
18
 
17
19
  ENV['CODEFUMES_CONFIG_FILE'] = File.expand_path(File.dirname(__FILE__) + '/sample_codefumes_config.tmp')
20
+
21
+ class ResponseFixtureSet
22
+ def [](response_fixture)
23
+ "spec/fixtures/#{response_fixture.to_s}.xml"
24
+ end
25
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codefumes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Kersten
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-09-26 00:00:00 -05:00
13
+ date: 2010-02-19 00:00:00 -06:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -51,7 +51,7 @@ dependencies:
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.2.0
54
+ version: 1.2.6
55
55
  version:
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: hoe
@@ -61,15 +61,32 @@ dependencies:
61
61
  requirements:
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 2.3.3
64
+ version: 2.5.0
65
65
  version:
66
- description: CodeFumes.com[http://codefumes.com] is a service intended to help people involved with software projects who are interested in tracking, sharing, and reviewing metrics/information about a project in relation to the commits of said project's repository. The site supports a small set of 'standard' metrics, but also provides a simple method of supplying and retrieving custom metrics, allowing users to gather any metric they are interested in tracking. The 'codefumes' gem is an implementation of the CodeFumes.com[http://codefumes.com] API. The intention of the gem is to simplify integration with CodeFumes.com for developers of other libraries & and applications. For an example of another library using the current features of this gem, you can refer to the 'codefumes_harvester[http://codefumes.rubyforge.org/codefumes_harvester]' gem.
66
+ description: |-
67
+ CodeFumes.com[http://codefumes.com] is a service intended to help people
68
+ involved with software projects who are interested in tracking, sharing,
69
+ and reviewing metrics/information about a project in relation to the
70
+ commits of said project's repository. The site supports a small set of
71
+ 'standard' metrics, but also provides a simple method of supplying
72
+ and retrieving custom metrics, allowing users to gather any metric they
73
+ are interested in tracking.
74
+
75
+ The 'codefumes' gem is an implementation of the
76
+ CodeFumes.com[http://codefumes.com] API. The intention of the
77
+ gem is to simplify integration with CodeFumes.com for developers of
78
+ other libraries & and applications.
79
+
80
+ For an example of another library using the current features of this
81
+ gem, you can refer to the
82
+ 'codefumes_harvester[http://codefumes.rubyforge.org/codefumes_harvester]' gem.
67
83
  email:
68
84
  - tom.kersten@cosyntech.com
69
85
  - freemarmoset@gmail.com
70
86
  executables:
71
87
  - cf_claim_project
72
- - store_codefumes_credentials
88
+ - cf_release_project
89
+ - cf_store_credentials
73
90
  extensions: []
74
91
 
75
92
  extra_rdoc_files:
@@ -82,8 +99,11 @@ files:
82
99
  - README.txt
83
100
  - Rakefile
84
101
  - bin/cf_claim_project
85
- - bin/store_codefumes_credentials
102
+ - bin/cf_release_project
103
+ - bin/cf_store_credentials
86
104
  - lib/cf_claim_project/cli.rb
105
+ - lib/cf_release_project/cli.rb
106
+ - lib/cf_store_credentials/cli.rb
87
107
  - lib/codefumes.rb
88
108
  - lib/codefumes/api.rb
89
109
  - lib/codefumes/claim.rb
@@ -91,23 +111,31 @@ files:
91
111
  - lib/codefumes/config_file.rb
92
112
  - lib/codefumes/payload.rb
93
113
  - lib/codefumes/project.rb
94
- - lib/store_codefumes_credentials/cli.rb
95
114
  - spec/cf_claim_project/cli_spec.rb
115
+ - spec/cf_release_project/cli_spec.rb
116
+ - spec/cf_store_credentials/cli_spec.rb
96
117
  - spec/codefumes/api_spec.rb
97
118
  - spec/codefumes/claim_spec.rb
98
119
  - spec/codefumes/commit_spec.rb
99
120
  - spec/codefumes/config_file_spec.rb
100
121
  - spec/codefumes/payload_spec.rb
101
122
  - spec/codefumes/project_spec.rb
102
- - spec/codefumes_service_stubs.rb
123
+ - spec/codefumes_service_helpers.rb
124
+ - spec/fixtures/commit.xml
125
+ - spec/fixtures/commit_with_custom_attrs.xml
126
+ - spec/fixtures/multiple_commits.xml
127
+ - spec/fixtures/payload.xml
128
+ - spec/fixtures/project.xml
129
+ - spec/fixtures/project_update.xml
103
130
  - spec/spec.opts
104
131
  - spec/spec_helper.rb
105
- - spec/store_codefumes_credentials/cli_spec.rb
106
132
  - tasks/rspec.rake
107
133
  - website/index.html
108
134
  - website/stylesheets/screen.css
109
135
  has_rdoc: true
110
136
  homepage: http://codefumes.rubyforge.org/codefumes
137
+ licenses: []
138
+
111
139
  post_install_message:
112
140
  rdoc_options:
113
141
  - --main
@@ -129,9 +157,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
157
  requirements: []
130
158
 
131
159
  rubyforge_project: codefumes
132
- rubygems_version: 1.3.1
160
+ rubygems_version: 1.3.5
133
161
  signing_key:
134
- specification_version: 2
162
+ specification_version: 3
135
163
  summary: A client-side implementation of the CodeFumes.com API.
136
164
  test_files: []
137
165
 
@@ -1,54 +0,0 @@
1
- module CodeFumesServiceStubs
2
- def single_commit(options = {})
3
- commit_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
4
- commit_xml += <<-END_OF_COMMIT
5
- <commit>
6
- <identifier>f3badd5624dfbcf5176f0471261731e1b92ce957</identifier>
7
- <author_name>John Doe</author_name>
8
- <author_email>jdoe@example.com</author_email>
9
- <committer_name>John Doe</committer_name>
10
- <committer_email>jdoe@example.com</committer_email>
11
- <short_message>Made command-line option for 'name' actually work</short_message>
12
- <message>
13
- Made command-line option for 'name' actually work
14
- - Commentd out hard-coded 'require' line used for testing
15
- </message>
16
- <parent_identifiers>9ddj48423jdsjds5176f0471261731e1b92ce957,3ewdjok23jdsjds5176f0471261731e1b92ce957,284djsksjfjsjds5176f0471261731e1b92ce957</parent_identifiers>
17
- <committed_at>Wed May 20 09:09:06 -0500 2009</committed_at>
18
- <authored_at>Wed May 20 09:09:06 -0500 2009</authored_at>
19
- <uploaded_at>2009-06-04 02:43:20 UTC</uploaded_at>
20
- <api_uri>http://localhost:3000/api/v1/commits/f3badd5624dfbcf5176f0471261731e1b92ce957.xml</api_uri>
21
- <line_additions>20</line_additions>
22
- <line_deletions>10</line_deletions>
23
- <line_total>30</line_total>
24
- <affected_file_count>2</affected_file_count>
25
- END_OF_COMMIT
26
-
27
- if options[:include_custom_attributes]
28
- commit_xml <<
29
- <<-END_OF_COMMIT
30
- <custom_attributes>
31
- <coverage>83</coverage>
32
- <random_attribute>1</random_attribute>
33
- </custom_attributes>
34
- END_OF_COMMIT
35
- end
36
-
37
- commit_xml << "\n</commit>"
38
- end
39
-
40
- def register_index_uri
41
- FakeWeb.register_uri(
42
- :get, "http://www.codefumes.com:80/api/v1/xml/projects/apk/commits",
43
- :status => ["200", "Ok"],
44
- :string => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<commits>\n#{single_commit}\n#{single_commit}\n#{single_commit}\n</commits>\n")
45
- end
46
-
47
- def stub_codefumes_uri(api_uri, status, response_string)
48
- FakeWeb.register_uri(
49
- :get, "http://www.codefumes.com:80/api/v1/xml/#{api_uri}",
50
- :status => status,
51
- :string => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n#{response_string}")
52
- end
53
- end
54
-