Sha256: 2ead91f1daa0c2194bf92e6859777172fdd7b30ef0aae3abc5136bdf12f63580

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

#!/usr/bin/env ruby

require 'nitro'
require 'ftools'

require 'facet/dir/recurse'

PROTO_DIR = File.join(Nitro::LibPath, '..', 'proto')

def usage
  puts <<-USAGE

NAME
     nitrogen - frontend for the Nitro generator mechanism.

SYNOPSIS
     nitrogen app [full path]

DESCRIPTION
     This is a frontend to the Nitro generator mechanism. Nitro 
     generators are used to 'bootstrap' development by creating 
     a standard directory structure and files for common tasks.
     
     app: This will create some basic files to get you 
     started fleshing out your Nitro web application.

EXAMPLE
     nitrogen app ~/my_application

     This will generate a new Nitro application in the 
     ~/my_application folder.
USAGE
  exit 1  
end

def run
  case command = ARGV[0] || usage()
  when 'app'
    path = ARGV[1] || usage()
    path = File.expand_path(path)

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

    FileUtils.cp_r(PROTO_DIR, path)
    
    Dir.recurse(path) do |f| 
      FileUtils.rm_rf(f) if /\.svn$/ =~ f 
    end 
    
  else
    usage()
  end
end

run

# This script is based on Michael Neumann's Wee creator script.  

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nitro-0.21.0 bin/nitrogen
nitro-0.21.2 bin/nitrogen
nitro-0.22.0 bin/nitrogen