Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define a mechanism to load user-specific commands #62

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ def activate(args)
Dir[BasePath + '/commands/*.rb'].each do |command|
load command
end
# load user local extensions
Dir[ENV['HOME']+ '/.github-gem/commands/*.rb'].each do |command|
load command
end
invoke(args.shift, *args)
end

Expand Down Expand Up @@ -146,7 +150,7 @@ def debug?
end

def load(file)
file[0] =~ /^\// ? path = file : path = BasePath + "/commands/#{File.basename(file)}"
file =~ /^\// ? path = file : path = BasePath + "/commands/#{File.basename(file)}"
data = File.read(path)
GitHub.module_eval data, path
end
Expand Down