Class: Sails::CLI

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/sails/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject


12
13
14
# File 'lib/sails/cli.rb', line 12

def self.source_root
  __dir__
end

Instance Method Details

#consoleObject


72
73
74
# File 'lib/sails/cli.rb', line 72

def console
  Sails::Console.start(Sails.root.join("config/application.rb"))
end

#new(name) ⇒ Object


54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/sails/cli.rb', line 54

def new(name)
  require 'fileutils'

  app_dir = File.expand_path File.join(Dir.pwd, name)
  @rel_dir = name
  @app_name = File.basename app_dir

  directory 'templates', name
  %W(log tmp/pids tmp/cache lib/tasks app/models/concerns config/initializers log).each do |dir_name|
    empty_directory File.join(app_dir,dir_name)
  end
  puts ''
ensure
  @app_name = nil
  @rel_dir = nil
end

#restartObject


48
49
50
51
# File 'lib/sails/cli.rb', line 48

def restart
  Sails::Daemon.init(mode: options[:mode])
  Sails::Daemon.restart_process
end

#startObject


28
29
30
31
# File 'lib/sails/cli.rb', line 28

def start
  Sails::Daemon.init(mode: options[:mode], daemon: options[:daemon])
  Sails::Daemon.start_process
end

#stopObject


38
39
40
41
# File 'lib/sails/cli.rb', line 38

def stop
  Sails::Daemon.init(mode: options[:mode])
  Sails::Daemon.stop_process
end

#versionObject


77
78
79
# File 'lib/sails/cli.rb', line 77

def version
  puts "Sails #{Sails.version}"
end