Class: Trails::CLI

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

Instance Method Summary collapse

Instance Method Details

#new(name) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/cli.rb', line 100

def new(name)
  app_destination = File.join(Dir.pwd, name)
  raise "Directory already exists at #{app_destination}" if Dir.exist?(app_destination)

  FileUtils.copy_entry(TEMPLATE_PATH, app_destination)
  Dir.mkdir(File.join(app_destination, "app/models"))
  Dir.mkdir(File.join(app_destination, "db/migrations"))
end

#serverObject Also known as: s



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

def server
  raise "Cannot find Trails App" unless PROJECT_ROOT
  require_relative "#{PROJECT_ROOT}/config/routes"
  require_relative '../bin/server'

  server = TrailsServer.new(options[:port], options[:host])
  server.start
end