taskmapper-github 0.11.2 → 0.11.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -26,7 +26,7 @@ GEM
26
26
  builder (3.0.4)
27
27
  diff-lcs (1.1.3)
28
28
  fakeweb (1.3.0)
29
- faraday (0.8.6)
29
+ faraday (0.8.7)
30
30
  multipart-post (~> 1.1)
31
31
  faraday_middleware (0.9.0)
32
32
  faraday (>= 0.7.4, < 0.9)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.2
1
+ 0.11.3
@@ -11,25 +11,27 @@ module TaskMapper::Provider
11
11
  def self.new(auth = {})
12
12
  TaskMapper.new(:github, auth)
13
13
  end
14
+
15
+ def provider
16
+ TaskMapper::Provider::Github
17
+ end
18
+
19
+ def new_github_client(auth)
20
+ Octokit::Client.new auth
21
+ end
14
22
 
15
23
  # declare needed overloaded methods here
16
24
  def authorize(auth = {})
17
25
  @authentication ||= TaskMapper::Authenticator.new(auth)
18
- login = @authentication.login || @authentication.username
19
- if login.blank?
20
- raise TaskMapper::Exception.new('Please provide at least a username')
21
- elsif @authentication.token
22
- TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :token => @authentication.token)
23
- elsif @authentication.password
24
- TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login, :password => @authentication.password)
25
- else
26
- TaskMapper::Provider::Github.api = Octokit::Client.new(:login => login)
27
- end
28
- TaskMapper::Provider::Github.login = login
26
+ auth[:login] = auth[:login] || auth[:username]
27
+ raise TaskMapper::Exception.new('Please provide at least a username') if auth[:login].blank?
28
+ provider.login = auth[:login]
29
+ provider.user_token = auth[:password] || auth[:token]
30
+ provider.api = new_github_client auth
29
31
  end
30
32
 
31
33
  def valid?
32
- TaskMapper::Provider::Github.api.authenticated? || TaskMapper::Provider::Github.api.oauthed?
34
+ provider.api.authenticated? || provider.api.oauthed?
33
35
  end
34
36
 
35
37
  end
@@ -0,0 +1,13 @@
1
+ module TaskMapper::Provider::Github
2
+ class OctokitWrapper
3
+
4
+ def initialize(username, password)
5
+ @username = username
6
+ @password = password
7
+ @octokit = Octokit::Client.new(:login => @username, :password => @password)
8
+ end
9
+
10
+ def valid?
11
+ end
12
+ end
13
+ end
@@ -12,11 +12,11 @@ module TaskMapper::Provider
12
12
  @system_data = {:client => object}
13
13
  unless object.is_a? Hash
14
14
  hash = {:description => object.description,
15
- :created_at => object.created_at,
16
- :updated_at => object.created_at,
17
- :name => object.name,
18
- :id => object.name,
19
- :owner => object.owner}
15
+ :created_at => object.created_at,
16
+ :updated_at => object.created_at,
17
+ :name => object.name,
18
+ :id => object.name,
19
+ :owner => object.owner}
20
20
  else
21
21
  hash = object
22
22
  end
@@ -61,8 +61,8 @@ module TaskMapper::Provider
61
61
  end
62
62
 
63
63
  def find_by_id(id)
64
- id = "#{TaskMapper::Provider::Github.login}/#{id}" unless id.include?("/")
65
- self.new TaskMapper::Provider::Github.api.repository(id)
64
+ project_id = "#{TaskMapper::Provider::Github.login}/#{id}" unless id.include?("/")
65
+ self.new TaskMapper::Provider::Github.api.repository(project_id)
66
66
  end
67
67
 
68
68
  def find_all
@@ -61,13 +61,9 @@ module TaskMapper::Provider
61
61
  search_by_attribute(issues, attributes)
62
62
  end
63
63
 
64
- def self.last_modified
65
- TaskMapper::Provider::Github.api.last_modified || Time.now.httpdate
66
- end
67
-
68
64
  def self.find_all(project_id)
69
65
  issues = []
70
- issues = Array(TaskMapper::Provider::Github.api.issues(project_id, :since => last_modified))
66
+ issues = Array(TaskMapper::Provider::Github.api.issues(project_id))
71
67
  issues += TaskMapper::Provider::Github.api.issues(project_id, {:state => "closed"}) unless issues.empty?
72
68
  issues.collect do |issue|
73
69
  issue.merge!(:project_id => project_id)
data/spec/ticket_spec.rb CHANGED
@@ -9,7 +9,7 @@ describe TaskMapper::Provider::Github::Ticket do
9
9
 
10
10
  describe "Retrieving tickets" do
11
11
  before(:each) do
12
- stub_get('https://taskmapper-user:Tm123456@api.github.com/orgs/2hf/repos?since', 'org_repos.json')
12
+ stub_get('https://taskmapper-user:Tm123456@api.github.com/orgs/2hf/repos', 'org_repos.json')
13
13
  stub_get('https://taskmapper-user:Tm123456@api.github.com/repos/taskmapper-user/tmtest-repo/issues/1', 'issues/1.json')
14
14
  stub_get('https://taskmapper-user:Tm123456@api.github.com/repos/taskmapper-user/tmtest-repo/issues', 'issues.json')
15
15
  stub_get('https://taskmapper-user:Tm123456@api.github.com/repos/taskmapper-user/tmtest-repo/issues?state=closed', 'issues.json')
Binary file
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "taskmapper-github"
8
- s.version = "0.11.2"
8
+ s.version = "0.11.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["HybridGroup"]
12
- s.date = "2013-03-14"
12
+ s.date = "2013-04-01"
13
13
  s.description = "This provides an interface with github through the taskmapper gem."
14
14
  s.email = "hong.quach@abigfisch.com"
15
15
  s.extra_rdoc_files = [
@@ -31,6 +31,7 @@ Gem::Specification.new do |s|
31
31
  "VERSION",
32
32
  "lib/provider/comment.rb",
33
33
  "lib/provider/github.rb",
34
+ "lib/provider/octokit_wrapper.rb",
34
35
  "lib/provider/project.rb",
35
36
  "lib/provider/ticket.rb",
36
37
  "lib/taskmapper-github.rb",
@@ -52,11 +53,12 @@ Gem::Specification.new do |s|
52
53
  "spec/spec_helper.rb",
53
54
  "spec/taskmapper-github_spec.rb",
54
55
  "spec/ticket_spec.rb",
56
+ "taskmapper-github-0.11.2.gem",
55
57
  "taskmapper-github.gemspec"
56
58
  ]
57
59
  s.homepage = "http://github.com/kiafaldorius/taskmapper-github"
58
60
  s.require_paths = ["lib"]
59
- s.rubygems_version = "1.8.24"
61
+ s.rubygems_version = "1.8.25"
60
62
  s.summary = "The github provider for taskmapper"
61
63
 
62
64
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taskmapper-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-14 00:00:00.000000000 Z
12
+ date: 2013-04-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: taskmapper
@@ -145,6 +145,7 @@ files:
145
145
  - VERSION
146
146
  - lib/provider/comment.rb
147
147
  - lib/provider/github.rb
148
+ - lib/provider/octokit_wrapper.rb
148
149
  - lib/provider/project.rb
149
150
  - lib/provider/ticket.rb
150
151
  - lib/taskmapper-github.rb
@@ -166,6 +167,7 @@ files:
166
167
  - spec/spec_helper.rb
167
168
  - spec/taskmapper-github_spec.rb
168
169
  - spec/ticket_spec.rb
170
+ - taskmapper-github-0.11.2.gem
169
171
  - taskmapper-github.gemspec
170
172
  homepage: http://github.com/kiafaldorius/taskmapper-github
171
173
  licenses: []
@@ -181,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
183
  version: '0'
182
184
  segments:
183
185
  - 0
184
- hash: -2844606696510024364
186
+ hash: -4503675965697247980
185
187
  required_rubygems_version: !ruby/object:Gem::Requirement
186
188
  none: false
187
189
  requirements:
@@ -190,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
192
  version: '0'
191
193
  requirements: []
192
194
  rubyforge_project:
193
- rubygems_version: 1.8.24
195
+ rubygems_version: 1.8.25
194
196
  signing_key:
195
197
  specification_version: 3
196
198
  summary: The github provider for taskmapper