Class: Climine::Command::Config

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

Constant Summary collapse

CONFIG =
"climine.yml"
TEMPLATE =
<<-ERB
url: <%= options[:url] %>
apikey: <%= options[:key] %>
<% if options[:editor] -%>
editor: <%= options[:editor] %>
<% end -%>
ERB

Instance Method Summary collapse

Instance Method Details

#initObject



20
21
22
23
24
25
# File 'lib/climine/command/config.rb', line 20

def init
  return if File.exist?(CONFIG) and !yes?("Overwrite? [#{CONFIG}] (y/n)", :green)

  open(CONFIG, 'w'){|file| file.write(ERB.new(TEMPLATE, nil, "-").result(binding)) }
  puts "create [ #{File.expand_path(CONFIG)} ]"
end