pry-octokit 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +6 -0
- data/README.md +48 -0
- data/Rakefile +2 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/pry-octokit.rb +1 -0
- data/lib/pry/octokit.rb +64 -0
- data/lib/pry/octokit/version.rb +5 -0
- data/pry-octokit.gemspec +27 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: a5657e25dfe95fbfcfd8438b53d82024ea590485ca25c1cb226386425ce0802d
|
4
|
+
data.tar.gz: 5cb4a45da07ac118c834502e7ffe25c7ca70ef3040e351d1cdff3eb1f75b94e9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3d1a533753af287fdba2996436a68e7bba547e38e71132a711dfe2f77fa5daf886cabb59fadb415fd9c81812ec0a067b78938f4db2e299cac697fa17354177da
|
7
|
+
data.tar.gz: dd3f1f80331783d49b28c2702cdea5611532ec1e10ba8d58d6ca9e42d461e512267d3c8d856027b263c8e4ffa12b40e41f3e0152951b62e507ebeab2d52ecd66
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# pry-octokit
|
2
|
+
|
3
|
+
Call GitHub API from Pry.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'pry-octokit'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install pry-octokit
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
You can use `gh/` command to call GitHub API. It receives a path of API URL.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
[1] pry(main)> gh/user
|
27
|
+
=> {:login=>"pocke",
|
28
|
+
:id=>4361134,
|
29
|
+
:avatar_url=>"https://avatars0.githubusercontent.com/u/4361134?v=4",
|
30
|
+
:gravatar_id=>"",
|
31
|
+
:url=>"https://api.github.com/users/pocke",
|
32
|
+
:html_url=>"https://github.com/pocke",
|
33
|
+
:followers_url=>"https://api.github.com/users/pocke/followers",
|
34
|
+
(snip)
|
35
|
+
|
36
|
+
[2] pry(main)> _ # You can access the last response from the `_` variable.
|
37
|
+
(snip)
|
38
|
+
```
|
39
|
+
|
40
|
+
## Development
|
41
|
+
|
42
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
43
|
+
|
44
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
45
|
+
|
46
|
+
## Contributing
|
47
|
+
|
48
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/pocke/pry-octokit.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "pry/octokit"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/pry-octokit.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'pry/octokit'
|
data/lib/pry/octokit.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
require "pry/octokit/version"
|
2
|
+
require 'pry'
|
3
|
+
require 'octokit'
|
4
|
+
require 'yaml'
|
5
|
+
|
6
|
+
class Pry
|
7
|
+
module Octokit
|
8
|
+
class << self
|
9
|
+
def client
|
10
|
+
@client ||= (
|
11
|
+
conf = YAML.load_file(File.expand_path("~/.config/hub"))
|
12
|
+
token = conf['github.com'].first['oauth_token']
|
13
|
+
::Octokit::Client.new(access_token: token).tap do |client|
|
14
|
+
if debug?
|
15
|
+
client.middleware = Faraday::RackBuilder.new do |builder|
|
16
|
+
builder.use ::Octokit::Middleware::FollowRedirects
|
17
|
+
builder.use ::Octokit::Response::RaiseError
|
18
|
+
builder.use ::Octokit::Response::FeedParser
|
19
|
+
builder.response :logger
|
20
|
+
builder.adapter Faraday.default_adapter
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
)
|
25
|
+
end
|
26
|
+
|
27
|
+
def debug?
|
28
|
+
ENV['PRY_OCTOKIT_DEBUG']
|
29
|
+
end
|
30
|
+
|
31
|
+
def run(path, _pry_)
|
32
|
+
path, options = path.split(' ', 2)
|
33
|
+
path = eval %Q!"#{path}"!
|
34
|
+
options = parse_options options
|
35
|
+
method = options.delete :method
|
36
|
+
c = client
|
37
|
+
auto_paginate = options.delete :auto_paginate
|
38
|
+
if auto_paginate
|
39
|
+
puts "With auto_paginate" if debug?
|
40
|
+
c = c.dup
|
41
|
+
c.auto_paginate = true
|
42
|
+
end
|
43
|
+
resp =
|
44
|
+
if auto_paginate
|
45
|
+
c.__send__ :paginate, path, options
|
46
|
+
else
|
47
|
+
c.__send__ :request, method, path, options
|
48
|
+
end
|
49
|
+
_pry_.last_result = resp
|
50
|
+
_pry_.show_result resp
|
51
|
+
end
|
52
|
+
|
53
|
+
def parse_options(options)
|
54
|
+
eval("{#{options}}").tap do |opt|
|
55
|
+
opt[:method] ||= :get
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
Pry.commands.block_command(%r!^gh/(.+)!) do |path|
|
63
|
+
Pry::Octokit.run(path, _pry_)
|
64
|
+
end
|
data/pry-octokit.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "pry/octokit/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pry-octokit"
|
8
|
+
spec.version = Pry::Octokit::VERSION
|
9
|
+
spec.authors = ["Masataka Pocke Kuwabara"]
|
10
|
+
spec.email = ["kuwabara@pocke.me"]
|
11
|
+
|
12
|
+
spec.summary = %q{pry ❤ octokit}
|
13
|
+
spec.description = %q{pry ❤ octokit}
|
14
|
+
spec.homepage = "https://github.com/pocke/pry-octokit"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_runtime_dependency "pry"
|
26
|
+
spec.add_runtime_dependency "octokit"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pry-octokit
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masataka Pocke Kuwabara
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-04-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: octokit
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: pry ❤ octokit
|
70
|
+
email:
|
71
|
+
- kuwabara@pocke.me
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- Gemfile
|
78
|
+
- README.md
|
79
|
+
- Rakefile
|
80
|
+
- bin/console
|
81
|
+
- bin/setup
|
82
|
+
- lib/pry-octokit.rb
|
83
|
+
- lib/pry/octokit.rb
|
84
|
+
- lib/pry/octokit/version.rb
|
85
|
+
- pry-octokit.gemspec
|
86
|
+
homepage: https://github.com/pocke/pry-octokit
|
87
|
+
licenses: []
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.7.6
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: pry ❤ octokit
|
109
|
+
test_files: []
|