Class: Hackpad::Cli::Workspace
- Inherits:
-
ConfigStruct
- Object
- ConfigStruct
- Hackpad::Cli::Workspace
- Includes:
- Cliprompt
- Defined in:
- lib/hackpad/cli/workspace.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/hackpad/cli/workspace.rb', line 27 def create self.name = ask "What is the name of the new workspace?" self.basedir = File.("../#{self.name}", self.basedir) self.basefile = File.join(self.basedir, 'config.yml') prepare_dirs setup end |
#set_defaults ⇒ Object
10 11 12 13 14 15 |
# File 'lib/hackpad/cli/workspace.rb', line 10 def set_defaults super self.name ||= 'default' self.url ||= 'http://hackpad.com' setio @input, @output end |
#setup ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/hackpad/cli/workspace.rb', line 17 def setup values = {} puts Paint['Workspace configuration.', :blue] puts Paint['Gather your information from https://<workspace>.hackpad.com/ep/account/settings/', :bold] values['client_id'] = guess 'HPCLI_CLIENTID', 'What is your Client ID?' values['secret'] = guess 'HPCLI_SECRET', 'What is your Secret Key?' values['site'] = guess('HPCLI_URL', 'What is the URI of your workspace? (ex. https://xxx.hackpad.com)').gsub(/\/$/, '') write values end |