-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.pryrc
53 lines (45 loc) · 1.33 KB
/
.pryrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# this loads all of 'git-multi'
lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'git/multi'
# this loads all 'git multi' contribs
# rubocop:disable Lint/NonDeterministicRequireOrder
Dir.glob File.join(__dir__, 'contrib', '**', '*.rb'), &method(:require)
# rubocop:enable Lint/NonDeterministicRequireOrder
# configure a logger
require 'logger'
logger = Logger.new($stdout)
logger.level = Logger::INFO
# configure Octokit middleware with logger
require 'octokit'
Octokit.middleware.response :logger, logger
# enumerator for Faraday middleware apps
def (_middleware = Octokit.middleware).each_app
Enumerator.new do |yielder|
next_app = app
while next_app
yielder << next_app
next_app = next_app.instance_variable_get(:@app)
end
end
end
# utility function to set pry context
# to an instance of <Octokit::Client>
def client
pry(Git::Hub.send(:client))
end
# utility function to set pry context
# to the Array of github repositories
def repos
pry(Git::Multi.repositories)
end
# utility function to set pry context
# to the various 'git multi' commands:
def cmds
pry(Git::Multi::Commands)
end
# utility function to set context
# to the named github repository:
def repo_named(full_name)
pry(Git::Multi.repositories.find { |repo| repo.full_name == full_name })
end