Sha256: 44090ee9629ed5525600ae9cf2b716599ff9147946ad258f086987f1beae0ffe

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

#!/usr/bin/env ruby

$NITRO_NO_ENVIRONMENT = true

require 'nitro'
require 'ftools'

require 'nano/dir/%3A%3Arecurse'

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.25.0 bin/nitrogen
nitro-0.24.0 bin/nitrogen
nitro-0.26.0 bin/nitrogen