Class: Yetty::User
Overview
User command class
Constant Summary
Constants inherited from Command
Command::DEFAULT_CONFIGURATION_FILES
Instance Attribute Summary
Attributes inherited from Command
Instance Method Summary collapse
-
#execute! ⇒ Object
Invoke shelr record.
Methods inherited from Command
Constructor Details
This class inherits a constructor from Yetty::Command
Instance Method Details
#execute! ⇒ Object
Invoke shelr record
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/yetty/user.rb', line 8 def execute! ui.info 'Configuration population (.yetty)' site_url = ui.ask('Site URL', 'http://localhost:4000') username = ui.ask('Username', ENV['USER']) provider = ui.ask('Storage Provider', 'aws') bucket = ui.ask('Storage bucket', 'yetty') credentials = Hash[ ui.ask('Storage credentials(k=v,k=v...)').split(',').map{|x|x.split('=')} ] run_action('Writing configuration file (.yetty)') do File.open('.yetty', 'w+') do |file| file.write( MultiJson.dump( Smash.new( :site => { :url => site_url }, :user => { :username => username, :storage => { :provider => provider, :bucket => bucket, :credentials => credentials } } ), :pretty => true ) ) end end end |