bin/sprout in sprout-0.7.246-darwin vs bin/sprout in sprout-1.0.0.pre
- old
+ new
@@ -1,133 +1,3 @@
#!/usr/bin/env ruby
-#
-# Created by Luke Bayes on 2007-4-29.
-# Copyright (c) 2007. All rights reserved.
-begin
- require 'rubygems'
-rescue LoadError
- # no rubygems to load, so we fail silently
-end
-
-$:.push(File.dirname(__FILE__) + '/../lib')
-require 'sprout'
-require 'sprout/generator'
-require 'optparse'
-
-OPTIONS = {
- :sources => [],
- :project_name => nil,
- :sprout_name => nil,
- :requirements => nil,
- :remove_all => false
-}
-
-def fail_with(opts, message)
- puts "[ERROR] #{message}"
- puts ""
- puts opts
- exit
-end
-
-parser = OptionParser.new do |opts|
- opts.banner = <<BANNER
-Sprout is an open-source, cross-platform project generation and configuration tool
-
-Usage: #{File.basename($0)} [options] [ProjectName]
-
-Examples:
-
-Create a new ActionScript 3.0 project named 'SomeProject':
- #{File.basename($0)} -n as3 SomeProject
-
-Create a new ActionScript 2.0 project named 'OtherProject':
- #{File.basename($0)} -n as2 OtherProject
-
-Create a new MXML project named 'SomeProject':
- #{File.basename($0)} -n mxml SomeProject
-
-Remove all Sprout gems and cached files:
- #{File.basename($0)} -R
-
-Options are:
-BANNER
- opts.separator ""
-
- opts.on("-n", "--name NAME", String, "The name of the sprout bundle whose project generator will be executed (e.g., as2 or as3)") do |name|
- OPTIONS[:sprout_name] = name
- end
-
- opts.on('--source [URL]', String, "Use URL as the remote source for gems") do |source|
- OPTIONS[:sources] << source
- end
-
- opts.on('-r', '--requirements REQUIREMENTS', String, "The specific gem version requirements for the named bundle (e.g., 0.3.2)") do |requirements|
- OPTIONS[:requirements] = requirements
- end
-
- opts.on("-R", "--remove-all", "Remove all sprout gems and cached files") do
- OPTIONS[:remove_all] = true
- Sprout::Sprout.remove_all
- end
-
- opts.on("-v", "--version", "Display the installed version of the sprout gem") do |version|
- puts "sprout #{Sprout::VERSION::STRING}"
- exit
- end
-
- opts.on("-h", "--help", "Show this help message.") do
- puts opts
- exit
- end
-
- opts.parse!(ARGV)
-
- if(OPTIONS[:sources].size > 0)
- set_sources OPTIONS[:sources]
- end
-
- if(ARGV.size > 0)
- if(OPTIONS[:sprout_name])
- OPTIONS[:project_name] = ARGV.pop
- if(OPTIONS[:project_name] == "=")
- fail_with(opts, "Invalid project name #{OPTIONS[:project_name]}")
- elsif(OPTIONS[:project_name] =~ /Test$/)
- fail_with(opts, "Your project name should not match /Test$/ as this will quickly cause problems when generating test cases and test suites")
- end
- else
- fail_with(opts, "You must provide a sprout name argument such as, '-n as2' or '-n as3'")
- end
- elsif(OPTIONS[:remove_all])
- exit
- else
- fail_with(opts, "Expected a sprout bundle name and project name like: 'sprout -n as2 SomeProject'")
- end
-
-end
-
-#############################################
-
-sprout_name = OPTIONS[:sprout_name]
-sprout_requirements = OPTIONS[:requirements]
-project_name = OPTIONS[:project_name]
-
-#############################################
-
-puts ">> Creating new project '#{project_name}' with #{sprout_name}"
-Sprout::Sprout.project_name = project_name
-
-begin
- # Fallback if a version was specified
- if(sprout_requirements)
- sprout(sprout_name, sprout_requirements)
- end
- # Try to run the generator against user home and existing gems first
- Sprout::Sprout.generate(sprout_name, 'project', [project_name])
-rescue RubiGen::GeneratorError
- # Failing that, try to download a sprout gem by name
- sprout(sprout_name, sprout_requirements)
- # Then try again....
- Sprout::Sprout.generate(sprout_name, 'project', [project_name])
-end
-
-Sprout::Log.flush
+puts 'Type sprout- and then hit the tab key to see the new sprout binaries.'
\ No newline at end of file