Class: CLI

Inherits:
Thor show all
Includes:
Thor::Actions
Defined in:
lib/volt/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



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

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

Instance Method Details

#consoleObject



16
17
18
19
# File 'lib/volt/cli.rb', line 16

def console
  require 'volt/console'
  Console.start
end

#gem(name) ⇒ Object



44
45
46
47
48
# File 'lib/volt/cli.rb', line 44

def gem(name)
  require 'volt/cli/new_gem'
  
  NewGem.new(self, name, options)
end

#new(name) ⇒ Object



8
9
10
11
12
13
# File 'lib/volt/cli.rb', line 8

def new(name)
  directory("project", name)
  
  say "Bundling Gems...."
  `cd #{name} ; bundle -j 4`
end

#serverObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/volt/cli.rb', line 22

def server
  require 'thin'
  require 'fileutils'

  # If we're in a Volt project, clear the temp directory
  # TODO: this is a work around for a bug when switching between
  # source maps and non-source maps.
  if File.exists?("config.ru") && File.exists?("Gemfile")
    FileUtils.rm_rf("tmp/.")
  end

  ENV['SERVER'] = 'true'
  Thin::Runner.new(['start']).run!
end