ghee 0.9.4 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +29 -1
- data/bin/ghee +71 -0
- data/lib/ghee.rb +12 -3
- data/lib/ghee/api/gists.rb +10 -1
- data/lib/ghee/api/git_data.rb +8 -5
- data/lib/ghee/api/issues.rb +6 -3
- data/lib/ghee/api/labels.rb +0 -1
- data/lib/ghee/resource_proxy.rb +2 -0
- data/lib/ghee/version.rb +1 -1
- metadata +90 -47
data/README.md
CHANGED
@@ -81,7 +81,35 @@ Delete a gist:
|
|
81
81
|
|
82
82
|
gh.gists("1393990").destroy
|
83
83
|
|
84
|
-
|
84
|
+
### Comments
|
85
|
+
|
86
|
+
List comments for a gist:
|
87
|
+
|
88
|
+
gh.gists("1382919").comments
|
89
|
+
|
90
|
+
Get a single gist comment:
|
91
|
+
|
92
|
+
gh.gists.comments("1231414")
|
93
|
+
|
94
|
+
Create a single gist comment:
|
95
|
+
|
96
|
+
gh.gists.comments("1231414").create({
|
97
|
+
:body => "new body"
|
98
|
+
})
|
99
|
+
|
100
|
+
Patch a single gist comment:
|
101
|
+
|
102
|
+
gh.gists.comments("1231414").patch({
|
103
|
+
:body => "new body"
|
104
|
+
})
|
105
|
+
|
106
|
+
Delete a comment for a gist:
|
107
|
+
|
108
|
+
gh.gists.comments("1231441").destroy
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
## Repos
|
85
113
|
|
86
114
|
Get a single repo:
|
87
115
|
|
data/bin/ghee
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require "ghee"
|
3
|
+
require "optparse"
|
4
|
+
|
5
|
+
options = {}
|
6
|
+
|
7
|
+
opt_parser = OptionParser.new do |opt|
|
8
|
+
opt.banner = "Usage: ghee COMMAND [OPTIONS}"
|
9
|
+
opt.separator ""
|
10
|
+
opt.separator "Commands"
|
11
|
+
opt.separator " install: install <username> <password>"
|
12
|
+
opt.separator ""
|
13
|
+
opt.separator "Options"
|
14
|
+
|
15
|
+
opt.on("-h", "--help", "help") do
|
16
|
+
puts opt_parser
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
opt_parser.parse!
|
21
|
+
class CMD
|
22
|
+
def self.get_password
|
23
|
+
begin
|
24
|
+
print "Enter your GitHub password (never stored): "
|
25
|
+
current_tty = `stty -g`
|
26
|
+
system 'stty raw -echo -icanon isig' if $?.success?
|
27
|
+
input = ''
|
28
|
+
while char = $stdin.getbyte and not (char == 13 or char == 10)
|
29
|
+
if char == 127 or char == 8
|
30
|
+
input[-1, 1] = '' unless input.empty?
|
31
|
+
else
|
32
|
+
input << char.chr
|
33
|
+
end
|
34
|
+
end
|
35
|
+
input
|
36
|
+
rescue Interrupt
|
37
|
+
print '^C'
|
38
|
+
ensure
|
39
|
+
system "stty #{current_tty}" unless current_tty.empty?
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
|
46
|
+
case ARGV[0]
|
47
|
+
when "install"
|
48
|
+
user = ARGV[1]
|
49
|
+
|
50
|
+
ghee = Ghee.basic_auth user, CMD.get_password
|
51
|
+
|
52
|
+
auth = ghee.authorizations.create(
|
53
|
+
:scopes => %w(repo,user,gist),
|
54
|
+
:note => "ghee api key",
|
55
|
+
:note_url => "https://github.com/rauhryan/ghee"
|
56
|
+
)
|
57
|
+
token = auth["token"]
|
58
|
+
run = []
|
59
|
+
run << "git config --global github.user #{user}"
|
60
|
+
run << "git config --global github.token #{token}"
|
61
|
+
system run.join("; ")
|
62
|
+
puts <<EOF
|
63
|
+
Your ~/.gitconfig has been modified. Be sure not to commit this to a public repository!
|
64
|
+
|
65
|
+
Alternatively you can have a private .dotfile that can set an ENV variable
|
66
|
+
|
67
|
+
EOF
|
68
|
+
puts " export GH_TOKEN=#{token}"
|
69
|
+
else
|
70
|
+
puts opt_parser
|
71
|
+
end
|
data/lib/ghee.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require 'ghee/version'
|
3
3
|
require 'ghee/connection'
|
4
4
|
require 'ghee/uri_escape'
|
5
|
-
require 'ghee/resource_proxy'
|
6
5
|
require 'ghee/state_methods'
|
6
|
+
require 'ghee/resource_proxy'
|
7
7
|
require 'ghee/api/authorizations'
|
8
8
|
require 'ghee/api/gists'
|
9
9
|
require 'ghee/api/users'
|
@@ -40,8 +40,17 @@ class Ghee
|
|
40
40
|
#
|
41
41
|
# Access_token - String of the access_token
|
42
42
|
#
|
43
|
-
def initialize(options =
|
44
|
-
|
43
|
+
def initialize(options = nil)
|
44
|
+
|
45
|
+
return @connection = Ghee::Connection.new(options) unless options.nil?
|
46
|
+
|
47
|
+
begin
|
48
|
+
token = ENV["GH_TOKEN"] || `git config github.token`
|
49
|
+
@connection = Ghee::Connection.new :access_token => token unless token.empty?
|
50
|
+
raise "Couldn't find an auth token. Please run `ghee install <username>`" if token.empty?
|
51
|
+
rescue Errno::ENOENT
|
52
|
+
raise "Couldn't find git"
|
53
|
+
end
|
45
54
|
end
|
46
55
|
|
47
56
|
def self.basic_auth(user_name, password)
|
data/lib/ghee/api/gists.rb
CHANGED
@@ -10,11 +10,20 @@ class Ghee
|
|
10
10
|
#
|
11
11
|
module Gists
|
12
12
|
|
13
|
+
module Comments
|
14
|
+
class Proxy < ::Ghee::ResourceProxy
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
13
18
|
# Gists::Proxy inherits from Ghee::Proxy and
|
14
19
|
# enables defining methods on the proxy object
|
15
20
|
#
|
16
21
|
class Proxy < ::Ghee::ResourceProxy
|
17
|
-
|
22
|
+
|
23
|
+
def comments(id = nil)
|
24
|
+
prefix = id ? "#{path_prefix}/comments/#{id}" : "#{path_prefix}/comments"
|
25
|
+
return Ghee::API::Gists::Comments::Proxy.new connection, prefix
|
26
|
+
end
|
18
27
|
|
19
28
|
|
20
29
|
# Star a gist
|
data/lib/ghee/api/git_data.rb
CHANGED
@@ -18,7 +18,8 @@ class Ghee
|
|
18
18
|
#
|
19
19
|
module Blobs
|
20
20
|
class Proxy < ::Ghee::ResourceProxy
|
21
|
-
|
21
|
+
undef_method "patch"
|
22
|
+
undef_method "destroy"
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -26,7 +27,8 @@ class Ghee
|
|
26
27
|
#
|
27
28
|
module Tags
|
28
29
|
class Proxy < ::Ghee::ResourceProxy
|
29
|
-
|
30
|
+
undef_method "patch"
|
31
|
+
undef_method "destroy"
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -34,7 +36,8 @@ class Ghee
|
|
34
36
|
#
|
35
37
|
module Commits
|
36
38
|
class Proxy < ::Ghee::ResourceProxy
|
37
|
-
|
39
|
+
undef_method "patch"
|
40
|
+
undef_method "destroy"
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
@@ -42,7 +45,8 @@ class Ghee
|
|
42
45
|
#
|
43
46
|
module Trees
|
44
47
|
class Proxy < ::Ghee::ResourceProxy
|
45
|
-
|
48
|
+
undef_method "patch"
|
49
|
+
undef_method "destroy"
|
46
50
|
end
|
47
51
|
end
|
48
52
|
|
@@ -50,7 +54,6 @@ class Ghee
|
|
50
54
|
#
|
51
55
|
module Refs
|
52
56
|
class Proxy < ::Ghee::ResourceProxy
|
53
|
-
include Ghee::CUD
|
54
57
|
end
|
55
58
|
end
|
56
59
|
|
data/lib/ghee/api/issues.rb
CHANGED
@@ -17,6 +17,9 @@ class Ghee
|
|
17
17
|
#
|
18
18
|
module Labels
|
19
19
|
class Proxy < ::Ghee::ResourceProxy
|
20
|
+
undef_method "patch"
|
21
|
+
undef_method "destroy"
|
22
|
+
undef_method "create"
|
20
23
|
|
21
24
|
# Creates label for an issue using the authenicated user
|
22
25
|
#
|
@@ -51,13 +54,14 @@ class Ghee
|
|
51
54
|
#
|
52
55
|
module Comments
|
53
56
|
class Proxy < ::Ghee::ResourceProxy
|
54
|
-
include Ghee::CUD
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
58
60
|
module Events
|
59
61
|
class Proxy < ::Ghee::ResourceProxy
|
60
|
-
|
62
|
+
undef_method "patch"
|
63
|
+
undef_method "destroy"
|
64
|
+
undef_method "create"
|
61
65
|
end
|
62
66
|
end
|
63
67
|
|
@@ -65,7 +69,6 @@ class Ghee
|
|
65
69
|
# enables defining methods on the proxy object
|
66
70
|
#
|
67
71
|
class Proxy < ::Ghee::ResourceProxy
|
68
|
-
include Ghee::CUD
|
69
72
|
|
70
73
|
# Close issue - closed issue by id
|
71
74
|
#
|
data/lib/ghee/api/labels.rb
CHANGED
data/lib/ghee/resource_proxy.rb
CHANGED
@@ -10,6 +10,8 @@ class Ghee
|
|
10
10
|
# Undefine methods that might get in the way
|
11
11
|
instance_methods.each { |m| undef_method m unless m =~ /^__|instance_eval|instance_variable_get|object_id|respond_to/ }
|
12
12
|
|
13
|
+
include Ghee::CUD
|
14
|
+
|
13
15
|
# Make connection and path_prefix readable
|
14
16
|
attr_reader :connection, :path_prefix, :params
|
15
17
|
|
data/lib/ghee/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ghee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-10-04 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,15 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: '0'
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: faraday_middleware
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: '0'
|
34
39
|
type: :runtime
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: multi_json
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: '0'
|
45
55
|
type: :runtime
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: yajl-ruby
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,10 +70,15 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :runtime
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: rake
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
@@ -66,10 +86,15 @@ dependencies:
|
|
66
86
|
version: '0'
|
67
87
|
type: :development
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
70
95
|
- !ruby/object:Gem::Dependency
|
71
96
|
name: json_pure
|
72
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
none: false
|
74
99
|
requirements:
|
75
100
|
- - ! '>='
|
@@ -77,10 +102,15 @@ dependencies:
|
|
77
102
|
version: '0'
|
78
103
|
type: :development
|
79
104
|
prerelease: false
|
80
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
81
111
|
- !ruby/object:Gem::Dependency
|
82
112
|
name: rspec
|
83
|
-
requirement:
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
84
114
|
none: false
|
85
115
|
requirements:
|
86
116
|
- - ~>
|
@@ -88,10 +118,15 @@ dependencies:
|
|
88
118
|
version: 2.9.0
|
89
119
|
type: :development
|
90
120
|
prerelease: false
|
91
|
-
version_requirements:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ~>
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: 2.9.0
|
92
127
|
- !ruby/object:Gem::Dependency
|
93
128
|
name: webmock
|
94
|
-
requirement:
|
129
|
+
requirement: !ruby/object:Gem::Requirement
|
95
130
|
none: false
|
96
131
|
requirements:
|
97
132
|
- - ! '>='
|
@@ -99,10 +134,15 @@ dependencies:
|
|
99
134
|
version: '0'
|
100
135
|
type: :development
|
101
136
|
prerelease: false
|
102
|
-
version_requirements:
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
103
143
|
- !ruby/object:Gem::Dependency
|
104
144
|
name: vcr
|
105
|
-
requirement:
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
106
146
|
none: false
|
107
147
|
requirements:
|
108
148
|
- - ! '>='
|
@@ -110,10 +150,15 @@ dependencies:
|
|
110
150
|
version: '0'
|
111
151
|
type: :development
|
112
152
|
prerelease: false
|
113
|
-
version_requirements:
|
153
|
+
version_requirements: !ruby/object:Gem::Requirement
|
154
|
+
none: false
|
155
|
+
requirements:
|
156
|
+
- - ! '>='
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
114
159
|
- !ruby/object:Gem::Dependency
|
115
160
|
name: ZenTest
|
116
|
-
requirement:
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
117
162
|
none: false
|
118
163
|
requirements:
|
119
164
|
- - ! '>='
|
@@ -121,10 +166,15 @@ dependencies:
|
|
121
166
|
version: '0'
|
122
167
|
type: :development
|
123
168
|
prerelease: false
|
124
|
-
version_requirements:
|
169
|
+
version_requirements: !ruby/object:Gem::Requirement
|
170
|
+
none: false
|
171
|
+
requirements:
|
172
|
+
- - ! '>='
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
125
175
|
- !ruby/object:Gem::Dependency
|
126
176
|
name: autotest-growl
|
127
|
-
requirement:
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
128
178
|
none: false
|
129
179
|
requirements:
|
130
180
|
- - ! '>='
|
@@ -132,11 +182,17 @@ dependencies:
|
|
132
182
|
version: '0'
|
133
183
|
type: :development
|
134
184
|
prerelease: false
|
135
|
-
version_requirements:
|
185
|
+
version_requirements: !ruby/object:Gem::Requirement
|
186
|
+
none: false
|
187
|
+
requirements:
|
188
|
+
- - ! '>='
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
136
191
|
description: A complete, simple, and intuitive ruby API for all things Github.
|
137
192
|
email:
|
138
193
|
- rauh.ryan@gmail.com
|
139
|
-
executables:
|
194
|
+
executables:
|
195
|
+
- ghee
|
140
196
|
extensions: []
|
141
197
|
extra_rdoc_files: []
|
142
198
|
files:
|
@@ -147,6 +203,7 @@ files:
|
|
147
203
|
- LICENSE
|
148
204
|
- README.md
|
149
205
|
- Rakefile
|
206
|
+
- bin/ghee
|
150
207
|
- ghee.gemspec
|
151
208
|
- lib/ghee.rb
|
152
209
|
- lib/ghee/api/authorizations.rb
|
@@ -206,36 +263,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
206
263
|
- - ! '>='
|
207
264
|
- !ruby/object:Gem::Version
|
208
265
|
version: '0'
|
266
|
+
segments:
|
267
|
+
- 0
|
268
|
+
hash: 4307522016883475070
|
209
269
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
210
270
|
none: false
|
211
271
|
requirements:
|
212
272
|
- - ! '>='
|
213
273
|
- !ruby/object:Gem::Version
|
214
274
|
version: '0'
|
275
|
+
segments:
|
276
|
+
- 0
|
277
|
+
hash: 4307522016883475070
|
215
278
|
requirements: []
|
216
279
|
rubyforge_project: ghee
|
217
|
-
rubygems_version: 1.8.
|
280
|
+
rubygems_version: 1.8.24
|
218
281
|
signing_key:
|
219
282
|
specification_version: 3
|
220
283
|
summary: Access Github in ruby.
|
221
|
-
test_files:
|
222
|
-
- spec/fyeah.jpg
|
223
|
-
- spec/ghee/api/authorizations_spec.rb
|
224
|
-
- spec/ghee/api/collaborators_spec.rb
|
225
|
-
- spec/ghee/api/downloads_spec.rb
|
226
|
-
- spec/ghee/api/events_spec.rb
|
227
|
-
- spec/ghee/api/gists_spec.rb
|
228
|
-
- spec/ghee/api/gitdata_spec.rb
|
229
|
-
- spec/ghee/api/hooks_spec.rb
|
230
|
-
- spec/ghee/api/issues_spec.rb
|
231
|
-
- spec/ghee/api/milestones_spec.rb
|
232
|
-
- spec/ghee/api/orgs_spec.rb
|
233
|
-
- spec/ghee/api/repos_spec.rb
|
234
|
-
- spec/ghee/api/teams_spec.rb
|
235
|
-
- spec/ghee/api/users_spec.rb
|
236
|
-
- spec/ghee/connection_spec.rb
|
237
|
-
- spec/ghee/resource_proxy_spec.rb
|
238
|
-
- spec/ghee_spec.rb
|
239
|
-
- spec/settings.yml.sample
|
240
|
-
- spec/spec.opts
|
241
|
-
- spec/spec_helper.rb
|
284
|
+
test_files: []
|