Class: See::Plugins::GitHub
Instance Method Summary collapse
- #config_name ⇒ Object
- #display_name ⇒ Object
- #run(config, plugin_config) ⇒ Object
- #show_collection(name, collection) ⇒ Object
Methods inherited from Plugin
Instance Method Details
#config_name ⇒ Object
10 11 12 |
# File 'lib/see/plugins/github.rb', line 10 def config_name 'github' end |
#display_name ⇒ Object
6 7 8 |
# File 'lib/see/plugins/github.rb', line 6 def display_name 'GitHub' end |
#run(config, plugin_config) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/see/plugins/github.rb', line 14 def run(config, plugin_config) info = [] token = access_token('GITHUB_ACCESS_TOKEN') account = plugin_config['account'] repository = plugin_config['repository'] github_name = [account, repository].join '/' client = Octokit::Client.new :access_token => token pull_requests = client.pull_requests(github_name) info.concat(show_collection('Pull Requests', pull_requests)) issues = client.issues(github_name) info.concat(show_collection('Issues', issues)) info end |
#show_collection(name, collection) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/see/plugins/github.rb', line 31 def show_collection(name, collection) if collection.count == 0 return [" No open #{name.downcase}".yellow] end info = [] info << " Open #{name.downcase}:".light_blue info << collection.map do |github_object| username = "[#{github_object.user.login}]".cyan time = "- #{github_object.updated_at.strftime("%b %e,%l:%M %p")}".black " - #{github_object.title} #{username} #{time}" end end |