Sha256: e17012aac09a900cca1c1a019f0fd904e61b2ac9dd30846a5b2754abc91e5bbd

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 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

4 entries across 4 versions & 1 rubygems

Version Path
nitro-0.19.0 bin/nitrogen
nitro-0.18.0 bin/nitrogen
nitro-0.18.1 bin/nitrogen
nitro-0.20.0 bin/nitrogen