Class: Temp::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/temp/runner.rb

Class Method Summary collapse

Class Method Details

.startObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/temp/runner.rb', line 7

def self.start
  options = {}

  begin
    OptionParser.new do |o|
      o.banner = 'Usage: temp [options] [project] [template]'

      o.on('-v', '--version', 'Show version information') do
        puts "Temp #{Temp::VERSION}"
      end
    end.parse!

    c = Temp::Copier.new
    if ARGV.size == 0
      raise 'no project directory or template name specified'
    elsif ARGV.size == 1
      raise 'no template name specified'
    else
      c.create_project(ARGV[0], ARGV[1])
    end
  rescue => e
    puts e.message
  end
end