git-issue 0.7.3 → 0.7.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.3
1
+ 0.7.4
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{git-issue}
8
- s.version = "0.7.3"
8
+ s.version = "0.7.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Tomohito Ozaki"]
12
- s.date = %q{2012-02-24}
12
+ s.date = %q{2012-02-28}
13
13
  s.default_executable = %q{git-issue}
14
14
  s.description = %q{git extention command for issue tracker system.}
15
15
  s.email = %q{ozaki@yuroyoro.com}
@@ -64,19 +64,16 @@ module GitIssue
64
64
 
65
65
  begin
66
66
  its_type = Helper.configured_value('type')
67
- apikey = Helper.configured_value('apikey')
68
67
 
69
68
  # Use global config for hub
70
69
  if its_type.blank?
71
70
  github_user = Helper.global_configured_value('github.user')
72
71
  unless github_user.blank?
73
72
  its_type = 'github'
74
- apikey = Helper.global_configured_value('github.token')
75
73
  end
76
74
  end
77
75
 
78
76
  Helper.configure_error('type (redmine | github)', "git config issue.type redmine") if its_type.blank?
79
- Helper.configure_error('apikey', "git config issue.apikey some_api_key") if apikey.blank?
80
77
 
81
78
  its_klass = Helper.its_klass_of(its_type)
82
79
  status = its_klass.new(ARGV).execute || true
@@ -1,4 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
+ require 'base64'
3
+ require 'pit'
2
4
 
3
5
  module GitIssue
4
6
  class GitIssue::Github < GitIssue::Base
@@ -14,6 +16,10 @@ class GitIssue::Github < GitIssue::Base
14
16
 
15
17
  @user = options[:user] || configured_value('user')
16
18
  @user = global_configured_value('github.user') if @user.blank?
19
+ @user = Pit.get("github", :require => {
20
+ "user" => "Your user name in GitHub",
21
+ })["user"] if @user.blank?
22
+
17
23
  configure_error('user', "git config issue.user yuroyoro") if @user.blank?
18
24
  @sslNoVerify = @options[:sslNoVerify] && RUBY_VERSION < '1.9.0'
19
25
  end
@@ -152,7 +158,9 @@ class GitIssue::Github < GitIssue::Base
152
158
 
153
159
  puts url if @debug
154
160
 
155
- opt = {"Authorizaion" => "#{@user}/token:#{@apikey}"}
161
+ password = options[:password] || get_password(@user)
162
+ opt = {"Authorization" => "Basic " + Base64.encode64("#{@user}:#{password}")}
163
+
156
164
  opt[:ssl_verify_mode] = OpenSSL::SSL::VERIFY_NONE if @sslNoVerify
157
165
  json = open(url, opt) {|io|
158
166
  JSON.parse(io.read)
@@ -259,11 +267,9 @@ class GitIssue::Github < GitIssue::Base
259
267
  end
260
268
 
261
269
  def get_password(user)
262
- print "password(#{user}): "
263
- system "stty -echo"
264
- password = $stdin.gets.chop
265
- system "stty echo"
266
- password
270
+ Pit.get("github", :require => {
271
+ "password" => "Your password in GitHub",
272
+ })["password"]
267
273
  end
268
274
 
269
275
  def oneline_issue(issue, options = {})
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-issue
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 7
9
- - 3
10
- version: 0.7.3
9
+ - 4
10
+ version: 0.7.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tomohito Ozaki
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-02-24 00:00:00 +09:00
18
+ date: 2012-02-28 00:00:00 +09:00
19
19
  default_executable: git-issue
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency