class Temjin::ConfigCommand::InitCommand

Public Instance Methods

config() click to toggle source
# File lib/temjin/config_command/init_command.rb, line 4
def config # override
  @config ||= Config.new(:create => true)
end
execute() click to toggle source
# File lib/temjin/config_command/init_command.rb, line 14
def execute
  # TODO: use Formatador for all output
  puts 'Go to https://trello.com/app-key to get your key and token.'
  puts

  config.username = prompt('username: ')
  config.key = prompt('key: ')
  config.token = prompt('token: ')

  config.save!
end
prompt(message, default = nil) click to toggle source
# File lib/temjin/config_command/init_command.rb, line 8
def prompt(message, default = nil)
  print(message)
  result = $stdin.gets.chomp
  result.empty? ? default : result
end