Class: Stealth::Cli

Inherits:
Thor
  • Object
show all
Extended by:
CliBase
Defined in:
lib/stealth/cli.rb

Instance Method Summary collapse

Methods included from CliBase

banner, define_commands, handle_argument_error

Instance Method Details

#consoleObject



86
87
88
89
90
91
92
# File 'lib/stealth/cli.rb', line 86

def console
  if options[:help]
    invoke :help, ['console']
  else
    Stealth::Commands::Console.new(options).start
  end
end

#generate(generator, name) ⇒ Object



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/stealth/cli.rb', line 31

def generate(generator, name)
  case generator
  when 'migration'
    Stealth::Migrations::Generator.migration(name)
  when 'flow'
    Stealth::Generators::Generate.start([generator, name])
  else
    puts "Could not find generator '#{generator}'."
    puts "Run `stealth help generate` for more options."
  end
end

#new(name) ⇒ Object



20
21
22
# File 'lib/stealth/cli.rb', line 20

def new(name)
  Stealth::Generators::Builder.start([name])
end

#serverObject



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

def server
  if options[:help]
    invoke :help, ['server']
  else
    require 'stealth/commands/server'
    Stealth::Commands::Server.new(port: options.fetch(:port) { 5000 }).start
  end
end

#setup(service) ⇒ Object



102
103
104
105
106
# File 'lib/stealth/cli.rb', line 102

def setup(service)
  Stealth.load_environment
  service_setup_klass = "Stealth::Services::#{service.classify}::Setup".constantize
  service_setup_klass.trigger
end

#versionObject



49
50
51
52
# File 'lib/stealth/cli.rb', line 49

def version
  require 'stealth/version'
  puts "#{ Stealth::VERSION }"
end