Class: AppGen

Inherits:
Gen
  • Object
show all
Defined in:
lib/gen/app/gen.rb

Overview

gen app - Nitro application generator.

This generator will create some basic files to get you started fleshing out your Nitro web application. The proto directory structure in the standard Nitro distribution is used as reference.

Example

gen app ~/my_application

This will generate a new Nitro application in the ~/my_application folder.

Constant Summary

Constants inherited from Gen

Gen::LibPath, Gen::Version

Instance Attribute Summary

Attributes inherited from Gen

#generator_dir

Instance Method Summary collapse

Methods inherited from Gen

#teardown, #usage

Instance Method Details

#runObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/gen/app/gen.rb', line 31

def run
  if File.exists? @path
    STDERR.puts "ERROR: Path #{@path} already exists! Aborting!"
    exit 1
  end

  puts "Copying proto dir to '#@path'"
  FileUtils.cp_r(PROTO_DIR, @path)
  
  Dir.recurse(@path) do |f| 
    FileUtils.rm_rf(f) if /\.svn$/ =~ f 
  end   
  
  puts 'Done'
end

#setupObject



26
27
28
29
# File 'lib/gen/app/gen.rb', line 26

def setup
  @path = ARGV[0] || usage()
  @path = File.expand_path(@path)
end