module Octonaut

Constants

MODE_OPTS
VERSION

Public Class Methods

client(global, options) click to toggle source
# File lib/octonaut.rb, line 79
def self.client(global, options)
  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!(options).
    select {|k, v| Octokit::Configuration::VALID_OPTIONS_KEYS.include?(k) }
  Octokit::Client.new(opts)
end
config_path() click to toggle source
# File lib/octonaut.rb, line 17
def self.config_path
  path = if ENV['OCTONAUT_ENV'] == 'TEST'
    'tmp/fakehome'
  else
    ENV['HOME']
  end

  File.expand_path(File.join(path, '.octonaut'))
end
follow_user(target) click to toggle source
# File lib/octonaut/commands/users.rb, line 108
def self.follow_user(target)
  puts "Followed #{target}." if @client.follow(target)
end
unfollow_user(target) click to toggle source
# File lib/octonaut/commands/users.rb, line 112
def self.unfollow_user(target)
  puts "Unfollowed #{target}." if @client.unfollow(target)
end