Class: Looks::Command::Config

Inherits:
Base
  • Object
show all
Defined in:
lib/looks/command/config.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#initialize, #run, #to_s, #usage

Constructor Details

This class inherits a constructor from Looks::Command::Base

Instance Method Details

#execute(args) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/looks/command/config.rb', line 11

def execute(args)
  highline = HighLine.new

  address  = highline.ask("  Email address: ")
  password = highline.ask("       Password: ") { |q| q.echo = '*' }

  config.address  = address
  config.password = password

  begin
    config.save
  rescue IOError, SystemCallError
    raise Error, "#{Looks::Config.filename}: Cannot write file"
  end
end