<NME> rango
<BEF> #!/usr/bin/env ruby
# encoding: utf-8

rango_root = File.join(File.dirname(__FILE__), '..')

$: << "#{rango_root}/lib"
require "#{rango_root}/lib/rango"
HELP
end

begin
  ARGV.shift.eql?("create") || abort(usage)
  generator_name = ARGV.shift || abort(usage)
  templater = SimpleTemplater.new(:rango)
  # This enables you to create custom generators for Rango
  load File.join(File.dirname(base), "..", "simple-templater.scope") # neccesary if we run rango locally and not from RubyGems
  templater.discover!
  generator_set = templater.find(generator_name)
  if generator_set.nil?
    abort "Generator #{generator_name} doesn't exist. Available generators are: #{templater.generators.map { |set| set.name }.inspect}"
  else
    begin
      generator_set.run(ARGV)
    rescue SimpleTemplater::TargetAlreadyExist => exception
      abort exception.message
    rescue Interrupt
      exit
    rescue Exception => exception
      abort "Exception #{exception.inspect} occured during running generator #{generator_set.inspect}\n#{exception.backtrace.join("\n")}"
    end
  end
end

<MSG> Rango executable can generate new project or app from system-wide stubs or from ~/.rango/stubs

<DFF> @@ -4,4 +4,26 @@
 rango_root = File.join(File.dirname(__FILE__), '..')
 
 $: << "#{rango_root}/lib"
-require "#{rango_root}/lib/rango"
+
+def create(stubs_dirs, type, name)
+  dir = stubs_dirs.find { |dir| File.directory?("#{dir}/#{type}") }
+  %x(cp -R "#{dir}/#{type}" #{name})
+  puts "#{type.capitalize} #{name} have been created (used stub from #{dir})."
+end
+
+stubs_dirs = ["#{rango_root}/lib/rango/stubs", "#{ENV["HOME"]}/.rango/stubs"]
+
+case command = ARGV.first
+when "help", "--help", "-h", "-H"
+  puts "=== Usage ==="
+  puts "rango startproject mycoolproject"
+  puts "rango startapp mycoolapp"
+when "startproject"
+  create(stubs_dirs, "project", ARGV[1])
+when "startapp"
+  create(stubs_dirs, "app", ARGV[1])
+when "-i"
+  require "rango"
+else
+  puts "Unknown command: #{command}"
+end
\ No newline at end of file

Rango executable can generate new project or app from system-wide stubs or from ~/.rango/stubs