Class: Simplerb::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



30
31
32
# File 'lib/simplerb/cli.rb', line 30

def self.source_root
  File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
end

Instance Method Details

#new(name) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/simplerb/cli.rb', line 10

def new(name)
  target = Pathname.pwd.join(name)
  self.destination_root = target
  options = { name: name }
  directory 'views', options
  directory 'public', options
  template 'Gemfile.tt', options
  template 'config.ru.tt', options
  inside target do
    run 'bundle install'
  end
end

#serverObject



26
27
28
# File 'lib/simplerb/cli.rb', line 26

def server
  exec "rackup -p #{options[:port]} -s #{options[:server]}"
end