Class: Lariat::Github
- Inherits:
-
Object
- Object
- Lariat::Github
- Includes:
- Issues
- Defined in:
- lib/lariat/github.rb,
lib/lariat/github/issues.rb
Defined Under Namespace
Modules: Issues
Instance Method Summary collapse
- #handle ⇒ Object
-
#initialize(config_file) ⇒ Github
constructor
A new instance of Github.
- #initialize_git_client ⇒ Object
- #load_config(config_file) ⇒ Object
Methods included from Issues
#close_issue, #create_issue, #get_user_from_repo_url, #search_issues
Constructor Details
#initialize(config_file) ⇒ Github
Returns a new instance of Github.
9 10 11 12 13 |
# File 'lib/lariat/github.rb', line 9 def initialize(config_file) @config = load_config(config_file) initialize_git_client @gh = ::Github.new end |
Instance Method Details
#handle ⇒ Object
15 16 17 |
# File 'lib/lariat/github.rb', line 15 def handle @gh end |
#initialize_git_client ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lariat/github.rb', line 19 def initialize_git_client unless @config['token'] puts "You must have a Github API Token. Create one, and add it to the local 'config/github.yml' and try again." exit end ::Github.configure do |c| c.oauth_token = @config['token'] c.site = @config['site'] c.endpoint = @config['endpoint'] end end |
#load_config(config_file) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/lariat/github.rb', line 32 def load_config(config_file) ::Lariat.load_environment_config_from_yaml(config_file) rescue puts "You must have a Github API Token. Create one, and add it to the local 'config/github.yml' and try again." exit end |