Module: Octonaut
- Defined in:
- lib/octonaut.rb,
lib/octonaut/utils.rb,
lib/octonaut/helpers.rb,
lib/octonaut/printer.rb,
lib/octonaut/version.rb,
lib/octonaut/commands/users.rb,
lib/octonaut/printers/users.rb,
lib/octonaut/commands/common.rb,
lib/octonaut/commands/activity.rb,
lib/octonaut/commands/contents.rb,
lib/octonaut/commands/markdown.rb,
lib/octonaut/commands/repositories.rb,
lib/octonaut/printers/repositories.rb,
lib/octonaut/printers/organizations.rb,
lib/octonaut/commands/authorizations.rb,
lib/octonaut/printers/authorizations.rb
Defined Under Namespace
Modules: Helpers, Printer, Printers, Utils
Constant Summary collapse
- VERSION =
'0.2.0'
Constants included from Printers::Users
Constants included from Printers::Repositories
Printers::Repositories::REPOSITORY_FIELDS
Class Method Summary collapse
- .client(global, options) ⇒ Object
- .config_path ⇒ Object
- .follow_user(target) ⇒ Object
- .unfollow_user(target) ⇒ Object
Methods included from Printer
Methods included from Printers::Users
#ls_users, #print_csv_users, #print_user_table, #print_users
Methods included from Printers::Repositories
#ls_repos, #print_csv_repos, #print_repo_table, #print_repos
Methods included from Printers::Authorizations
Methods included from Helpers
Methods included from Utils
Class Method Details
.client(global, options) ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/octonaut.rb', line 79 def self.client(global, ) opts = global netrc_path = global.delete("netrc-file") opts[:netrc] = netrc_path if netrc_path # drop OAuth token if basic auth is present if (opts['login'] && opts['password']) || opts[:netrc] %w(t token oauth_token).each do |k| opts.delete(k) opts.delete(k.to_sym) end end opts.merge!(). select {|k, v| Octokit::Configuration::VALID_OPTIONS_KEYS.include?(k) } Octokit::Client.new(opts) end |
.config_path ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/octonaut.rb', line 17 def self.config_path path = if ENV['OCTONAUT_ENV'] == 'TEST' 'tmp/fakehome' else ENV['HOME'] end File.(File.join(path, '.octonaut')) end |
.follow_user(target) ⇒ Object
108 109 110 |
# File 'lib/octonaut/commands/users.rb', line 108 def self.follow_user(target) puts "Followed #{target}." if @client.follow(target) end |
.unfollow_user(target) ⇒ Object
112 113 114 |
# File 'lib/octonaut/commands/users.rb', line 112 def self.unfollow_user(target) puts "Unfollowed #{target}." if @client.unfollow(target) end |