Class: Skylight::CLI::Base Private

Inherits:
Thor show all
Includes:
Helpers
Defined in:
lib/skylight/cli.rb

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

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

#disable_dev_warningObject

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.



68
69
70
71
72
73
# File 'lib/skylight/cli.rb', line 68

def disable_dev_warning
  user_config.disable_dev_warning = true
  user_config.save

  say "Development mode warning disabled", :green
end

#disable_env_warningObject

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.



78
79
80
81
82
83
# File 'lib/skylight/cli.rb', line 78

def disable_env_warning
  user_config.disable_env_warning = true
  user_config.save

  say "Environment warning disabled", :green
end

#setup(token) ⇒ 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.



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
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/skylight/cli.rb', line 23

def setup(token)
  if File.exist?(config_path)
    say <<~OUT, :green
      A config/skylight.yml already exists for your application.

      Visit your app at https://www.skylight.io/app or remove config/skylight.yml
      to set it up as a new app in Skylight.
    OUT

    return
  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! https://www.skylight.io", :green
  say <<~OUT

    The application was registered for you and we generated a config file
    containing your API token at:

      #{relative_config_path}

    The next step is for you to deploy your application to production. The
    easiest way is to just commit the config file to your source control
    repository and deploy from there. You can learn more about the process at:

      https://docs.skylight.io/getting-set-up/#deployment

    If you want to specify the authentication token as an environment variable,
    you should set the `SKYLIGHT_AUTHENTICATION` variable to:

      #{config[:authentication]}

  OUT
rescue Api::CreateFailed => e
  say "Could not create the application. Please run `bundle exec skylight doctor` for diagnostics.", :red
  say e.to_s, :yellow
rescue Interrupt # rubocop:disable Lint/SuppressedException
end