Class: Skylight::CLI Private
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary
Constants inherited from Thor
Thor::DynamicTask, Thor::HELP_MAPPINGS, Thor::HiddenTask, Thor::THOR_RESERVED_WORDS, Thor::Task, Thor::UndefinedTaskError, Thor::VERSION
Instance Attribute Summary
Attributes included from Thor::Base
#args, #options, #parent_options
Instance Method Summary collapse
- #setup(token = nil) ⇒ Object private
Methods inherited from Thor
check_unknown_options!, check_unknown_options?, command_help, default_command, desc, #help, help, long_desc, map, method_option, method_options, package_name, printable_commands, register, stop_on_unknown_option!, stop_on_unknown_option?, subcommand, subcommands
Methods included from Thor::Base
included, #initialize, register_klass_file, shell, shell=, subclass_files, subclasses
Instance Method Details
#setup(token = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/skylight/cli.rb', line 14 def setup(token=nil) if File.exist?(config_path) say "Your app is already on Skylight. http://www.skylight.io", :green return end unless token api.authentication = login end res = api.create_app(app_name, token) config[:application] = res.get('app.id') config[:authentication] = res.get('app.token') config.write(config_path) say "Congratulations. Your application is on Skylight! http://www.skylight.io", :green say "\nThe application was registered for you and we generated a config file\ncontaining your API token at:\n\n \#{relative_config_path}\n\nThe next step is for you to deploy your application to production. The\neasiest way is to just commit the config file to your source control\nrepository and deploy from there. You can learn more about the process at:\n\n http://docs.skylight.io/getting-started/#deploy\n\nIf you want to specify the authentication token as an environment variable,\nyou should set the `SKYLIGHT_AUTHENTICATION` variable to:\n\n \#{config[:authentication]}\n\n OUT\nrescue Api::CreateFailed => e\n say \"Could not create the application\", :red\n say e.to_s, :yellow\nrescue Interrupt\nend\n" |