summaryrefslogtreecommitdiffhomepage
path: root/exe/justicar
blob: efd75af61e9854d7b21cc1c2a5f4574695186c31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/ruby

require 'fileutils'

template_path = File.expand_path(File.dirname(__FILE__) + '/../template')

def help
	puts 'Pass a path as an argument to generate a new project'
end

if ARGV.length == 0 || ARGV.first.chars.first == '-'
  help
elsif ARGV.length == 1
	begin
      if ARGV.first.chars.first == '/'
        FileUtils.copy_entry(template_path, ARGV.first)
      else
        FileUtils.copy_entry(template_path, "#{Dir.pwd}/#{ARGV.first}")
      end
      puts "Project generated"
    rescue
      help
    end
else
  help
end