kenai_tools 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -3,6 +3,7 @@
3
3
  Gemfile.lock
4
4
  pkg/*
5
5
 
6
- # RubyMine per-user files http://devnet.jetbrains.net/docs/DOC-1192
7
- .idea/workspace.xml
8
- .idea/tasks.xml
6
+ # 2012-03-06 RubyMine: following the advice at
7
+ # http://devnet.jetbrains.net/docs/DOC-1192 has problems so just ignore all
8
+ # files for now
9
+ .idea/
data/bin/dlutil CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'rubygems'
4
- require "bundler/setup"
5
4
 
6
5
  $LOAD_PATH << File.dirname(__FILE__) + '/../lib'
7
6
  require 'ostruct'
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
- require 'bundler/setup'
3
2
 
4
3
  require 'forwardable'
5
4
  require 'rest_client'
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
- require "bundler/setup"
3
2
 
4
3
  require 'rest_client'
5
4
  require 'json'
@@ -46,10 +45,34 @@ module KenaiTools
46
45
  end
47
46
  end
48
47
 
48
+ def project_features(proj_name)
49
+ begin
50
+ fetch_all("projects/#{proj_name}/features", 'features')
51
+ rescue RestClient::ResourceNotFound
52
+ nil
53
+ end
54
+ end
55
+
56
+ def project_feature(proj_name, feature_name)
57
+ begin
58
+ JSON.parse(project_feature_client(proj_name, feature_name).get)
59
+ rescue RestClient::ResourceNotFound
60
+ nil
61
+ end
62
+ end
63
+
64
+ def create_project_feature(proj_name, feature_json)
65
+ self["projects/#{proj_name}/features"].post(feature_json, :content_type => :json, :accept => :json)
66
+ end
67
+
68
+ def delete_project_feature(proj_name, feature_name)
69
+ project_feature_client(proj_name, feature_name).delete
70
+ end
71
+
49
72
  # collect all project hashes (scope may be :all, or all projects, or
50
73
  # :mine, for projects in which the current user has some role)
51
- def projects(scope=:all)
52
- fetch_all('projects', 'projects')
74
+ def projects(params = {})
75
+ fetch_all('projects', 'projects', params)
53
76
  end
54
77
 
55
78
  def my_projects
@@ -58,7 +81,7 @@ module KenaiTools
58
81
 
59
82
  # get wiki images for a project
60
83
  def wiki_images(project, on_page = nil)
61
- fetch_all("projects/#{project}/features/wiki/images", 'images', on_page)
84
+ fetch_all("projects/#{project}/features/wiki/images", 'images', :page => on_page)
62
85
  end
63
86
 
64
87
  # get the wiki raw image data for an image
@@ -84,7 +107,7 @@ module KenaiTools
84
107
 
85
108
  # get wiki pages for a project
86
109
  def wiki_pages(project, on_page = nil)
87
- fetch_all("projects/#{project}/features/wiki/pages", 'pages', on_page)
110
+ fetch_all("projects/#{project}/features/wiki/pages", 'pages', :page => on_page)
88
111
  end
89
112
 
90
113
  def wiki_page(proj_name, page_name)
@@ -142,27 +165,42 @@ module KenaiTools
142
165
 
143
166
  private
144
167
 
145
- # +on_page+ means only on that particular page or all pages if nil
146
- def fetch_all(initial_url, item_key, on_page = nil)
147
- unless on_page
148
- next_page = initial_url
168
+ # +opts+ are translated to URL params (see API docs):
169
+ # :page => on_page, means only on that particular page or all pages if nil
170
+ # :filter => 'all', means to also include private projects
171
+ def fetch_all(initial_url, item_key, opts = {})
172
+ params = query_params(opts)
173
+ url = initial_url + params
174
+
175
+ unless opts[:page]
176
+ next_page = url
149
177
  results = []
150
178
 
151
- begin
179
+ loop do
152
180
  curr_page = JSON.parse(self[next_page].get)
153
181
  results += curr_page[item_key]
154
- next_page = curr_page['next']
155
- end until next_page.nil?
182
+ break unless curr_page['next']
183
+ next_page = curr_page['next'] + params
184
+ end
156
185
 
157
186
  results
158
187
  else
159
- url = on_page ? initial_url + "?page=#{on_page}" : initial_url
160
188
  JSON.parse(self[url].get)[item_key]
161
189
  end
162
190
  end
163
191
 
192
+ def query_params(opts)
193
+ params = opts.map { |k, v| "#{k}=#{v}" }
194
+ query = params.empty? ? "" : "?#{params.join('&')}"
195
+ query
196
+ end
197
+
164
198
  def wiki_page_client(project, page)
165
199
  self["projects/#{project}/features/wiki/pages/#{page}"]
166
200
  end
201
+
202
+ def project_feature_client(proj_name, feature_name)
203
+ self["projects/#{proj_name}/features/#{feature_name}"]
204
+ end
167
205
  end
168
206
  end
@@ -1,3 +1,3 @@
1
1
  module KenaiTools
2
- VERSION = "0.0.7"
2
+ VERSION = "1.0.0"
3
3
  end
metadata CHANGED
@@ -1,131 +1,93 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: kenai_tools
3
- version: !ruby/object:Gem::Version
4
- hash: 17
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 7
10
- version: 0.0.7
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Edwin Goei
14
9
  - Project Kenai Team
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-09-27 00:00:00 -07:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
13
+ date: 2012-03-22 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
23
16
  name: rspec
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &2152634940 !ruby/object:Gem::Requirement
26
18
  none: false
27
- requirements:
19
+ requirements:
28
20
  - - ~>
29
- - !ruby/object:Gem::Version
30
- hash: 9
31
- segments:
32
- - 2
33
- - 5
34
- version: "2.5"
21
+ - !ruby/object:Gem::Version
22
+ version: '2.5'
35
23
  type: :development
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: bundler
39
24
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
25
+ version_requirements: *2152634940
26
+ - !ruby/object:Gem::Dependency
27
+ name: bundler
28
+ requirement: &2152634380 !ruby/object:Gem::Requirement
41
29
  none: false
42
- requirements:
30
+ requirements:
43
31
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 15
46
- segments:
47
- - 1
48
- - 0
49
- version: "1.0"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
50
34
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: gemcutter
54
35
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
36
+ version_requirements: *2152634380
37
+ - !ruby/object:Gem::Dependency
38
+ name: gemcutter
39
+ requirement: &2152633980 !ruby/object:Gem::Requirement
56
40
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 3
61
- segments:
62
- - 0
63
- version: "0"
41
+ requirements:
42
+ - - ! '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
64
45
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: rest-client
68
46
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
47
+ version_requirements: *2152633980
48
+ - !ruby/object:Gem::Dependency
49
+ name: rest-client
50
+ requirement: &2152633340 !ruby/object:Gem::Requirement
70
51
  none: false
71
- requirements:
52
+ requirements:
72
53
  - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 3
75
- segments:
76
- - 1
77
- - 6
78
- version: "1.6"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.6'
79
56
  type: :runtime
80
- version_requirements: *id004
81
- - !ruby/object:Gem::Dependency
82
- name: json
83
57
  prerelease: false
84
- requirement: &id005 !ruby/object:Gem::Requirement
58
+ version_requirements: *2152633340
59
+ - !ruby/object:Gem::Dependency
60
+ name: json
61
+ requirement: &2152632760 !ruby/object:Gem::Requirement
85
62
  none: false
86
- requirements:
63
+ requirements:
87
64
  - - ~>
88
- - !ruby/object:Gem::Version
89
- hash: 5
90
- segments:
91
- - 1
92
- - 5
93
- version: "1.5"
65
+ - !ruby/object:Gem::Version
66
+ version: '1.5'
94
67
  type: :runtime
95
- version_requirements: *id005
96
- - !ruby/object:Gem::Dependency
97
- name: highline
98
68
  prerelease: false
99
- requirement: &id006 !ruby/object:Gem::Requirement
69
+ version_requirements: *2152632760
70
+ - !ruby/object:Gem::Dependency
71
+ name: highline
72
+ requirement: &2152632280 !ruby/object:Gem::Requirement
100
73
  none: false
101
- requirements:
74
+ requirements:
102
75
  - - ~>
103
- - !ruby/object:Gem::Version
104
- hash: 3
105
- segments:
106
- - 1
107
- - 6
108
- version: "1.6"
76
+ - !ruby/object:Gem::Version
77
+ version: '1.6'
109
78
  type: :runtime
110
- version_requirements: *id006
111
- description: Tools for sites such as java.net that are hosted on the Kenai platform. Use dlutil to upload and download files.
112
- email:
79
+ prerelease: false
80
+ version_requirements: *2152632280
81
+ description: Tools for sites such as java.net that are hosted on the Kenai platform.
82
+ Use dlutil to upload and download files.
83
+ email:
113
84
  - edwin.goei@oracle.com
114
- executables:
85
+ executables:
115
86
  - dlutil
116
87
  extensions: []
117
-
118
88
  extra_rdoc_files: []
119
-
120
- files:
89
+ files:
121
90
  - .gitignore
122
- - .idea/.name
123
- - .idea/.rakeTasks
124
- - .idea/encodings.xml
125
- - .idea/kenai_tools.iml
126
- - .idea/misc.xml
127
- - .idea/modules.xml
128
- - .idea/vcs.xml
129
91
  - Gemfile
130
92
  - README.md
131
93
  - Rakefile
@@ -153,55 +115,35 @@ files:
153
115
  - spec/fixtures/data/sax2r2.jar
154
116
  - spec/fixtures/data/text1.txt
155
117
  - spec/spec_helper.rb
156
- has_rdoc: true
157
118
  homepage: http://kenai.com/projects/kenaiapis
158
119
  licenses: []
159
-
160
- post_install_message: |+
161
-
162
- ==============================================================================
163
-
164
- Thanks for installing kenai_tools. Run the following command for what to do
165
- next:
166
-
167
- dlutil --help
168
-
169
- Warning: this tool is not yet supported on Windows. Please use a unix-based
170
- OS. For more info, see http://kenai.com/jira/browse/KENAI-2853.
171
-
172
- ==============================================================================
173
-
174
-
120
+ post_install_message: ! "\n==============================================================================\n\nThanks
121
+ for installing kenai_tools. Run the following command for what to do\nnext:\n\n
122
+ \ dlutil --help\n\nWarning: this tool is not yet supported on Windows. Please use
123
+ a unix-based\nOS. For more info, see http://kenai.com/jira/browse/KENAI-2853.\n\n==============================================================================\n\n\n"
175
124
  rdoc_options: []
176
-
177
- require_paths:
125
+ require_paths:
178
126
  - lib
179
- required_ruby_version: !ruby/object:Gem::Requirement
127
+ required_ruby_version: !ruby/object:Gem::Requirement
180
128
  none: false
181
- requirements:
182
- - - ">="
183
- - !ruby/object:Gem::Version
184
- hash: 3
185
- segments:
186
- - 0
187
- version: "0"
188
- required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ! '>='
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
189
134
  none: false
190
- requirements:
191
- - - ">="
192
- - !ruby/object:Gem::Version
193
- hash: 3
194
- segments:
195
- - 0
196
- version: "0"
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
197
139
  requirements: []
198
-
199
140
  rubyforge_project: kenai_tools
200
- rubygems_version: 1.6.2
141
+ rubygems_version: 1.8.17
201
142
  signing_key:
202
143
  specification_version: 3
203
- summary: Tools for sites hosted on the Kenai platform. Use dlutil to upload and download files.
204
- test_files:
144
+ summary: Tools for sites hosted on the Kenai platform. Use dlutil to upload and download
145
+ files.
146
+ test_files:
205
147
  - spec/downloads_client_spec.rb
206
148
  - spec/fixtures/data/irs_docs/irs-form-1040.pdf
207
149
  - spec/fixtures/data/irs_docs/irs-p555.pdf
data/.idea/.name DELETED
@@ -1 +0,0 @@
1
- kenai_tools
data/.idea/.rakeTasks DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <Settings><!--This file was automatically generated by Ruby plugin.
3
- You are allowed to:
4
- 1. Remove rake task
5
- 2. Add existing rake tasks
6
- To add existing rake tasks automatically delete this file and reload the project.
7
- --><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build kenai_tools-0.0.1.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Build and install kenai_tools-0.0.1.gem into system gems" fullCmd="install" taksId="install" /><RakeTask description="Create tag v0.0.1 and build and push kenai_tools-0.0.1.gem to Rubygems" fullCmd="release" taksId="release" /></RakeGroup></Settings>
data/.idea/encodings.xml DELETED
@@ -1,5 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
4
- </project>
5
-
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="RUBY_MODULE" version="4">
3
- <component name="GemRequirementsHolder" version="3">
4
- <requirement>
5
- <requirement>
6
- <dependency name="highline" version="1.6" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
7
- </requirement>
8
- <source from="Gemfile" />
9
- </requirement>
10
- <requirement>
11
- <requirement>
12
- <dependency name="json" version="1.5" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
13
- </requirement>
14
- <source from="Gemfile" />
15
- </requirement>
16
- <requirement>
17
- <requirement>
18
- <dependency name="rest-client" version="1.6" bound="LATEST_IN_BRANCH" git="false" path="false" doRequire="true" />
19
- </requirement>
20
- <source from="Gemfile" />
21
- </requirement>
22
- </component>
23
- <component name="NewModuleRootManager">
24
- <content url="file://$MODULE_DIR$" />
25
- <orderEntry type="inheritedJdk" />
26
- <orderEntry type="sourceFolder" forTests="false" />
27
- <orderEntry type="library" scope="PROVIDED" name="rspec (v2.5.0, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
28
- <orderEntry type="library" scope="PROVIDED" name="rest-client (v1.6.3, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
29
- <orderEntry type="library" scope="PROVIDED" name="rspec-core (v2.5.2, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
30
- <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.1.2, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
31
- <orderEntry type="library" scope="PROVIDED" name="highline (v1.6.2, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
32
- <orderEntry type="library" scope="PROVIDED" name="bundler (v1.0.12, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
33
- <orderEntry type="library" scope="PROVIDED" name="mime-types (v1.16, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
34
- <orderEntry type="library" scope="PROVIDED" name="json (v1.5.3, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
35
- <orderEntry type="library" scope="PROVIDED" name="gemcutter (v0.7.0, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
36
- <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v2.5.0, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
37
- <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v2.5.0, RVM: ruby-1.8.7-p302 [kenai_tools]) [gem]" level="application" />
38
- </component>
39
- </module>
40
-
data/.idea/misc.xml DELETED
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="DependencyValidationManager">
4
- <option name="SKIP_IMPORT_STATEMENTS" value="false" />
5
- </component>
6
- <component name="ProjectRootManager" version="2" project-jdk-name="RVM: ruby-1.8.7-p302 [kenai_tools]" project-jdk-type="RUBY_SDK" />
7
- </project>
8
-
data/.idea/modules.xml DELETED
@@ -1,9 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/kenai_tools.iml" filepath="$PROJECT_DIR$/.idea/kenai_tools.iml" />
6
- </modules>
7
- </component>
8
- </project>
9
-
data/.idea/vcs.xml DELETED
@@ -1,7 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>
7
-