Class: Rocketwheel::Command::CLI::New

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

Defined Under Namespace

Classes: NoTemplateDirectory

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



9
10
11
# File 'lib/rocketwheel/command/cli/new.rb', line 9

def self.source_root
  File.join(Rocketwheel::Command.templates, 'project')
end

Instance Method Details

#new(name) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rocketwheel/command/cli/new.rb', line 16

def new(name)
  dir = version.dup
  until File.exists?(File.join(self.class.source_root, dir)) do
    raise Thor::Error, "No project template for version #{version}" unless dir.gsub! /(.*)\..*/, '\\1'
  end
  directory dir, name
end