lib/core/application.rb in buildr-1.2.5 vs lib/core/application.rb in buildr-1.2.6

- old
+ new

@@ -18,20 +18,20 @@ "Display this help message."], ['--nosearch', '-N', GetoptLong::NO_ARGUMENT, "Do not search parent directories for the buildfile."], ['--quiet', '-q', GetoptLong::NO_ARGUMENT, "Do not log messages to standard output."], - ['--buildfile', '-f', GetoptLong::OPTIONAL_ARGUMENT, + ['--buildfile', '-f', GetoptLong::REQUIRED_ARGUMENT, "Use FILE as the buildfile."], ['--require', '-r', GetoptLong::REQUIRED_ARGUMENT, "Require MODULE before executing buildfile."], ['--trace', '-t', GetoptLong::NO_ARGUMENT, "Turn on invoke/execute tracing, enable full backtrace."], - ['--verbose', '-v', GetoptLong::NO_ARGUMENT, - "Log message to standard output (default)."], ['--version', '-V', GetoptLong::NO_ARGUMENT, "Display the program version."], + ['--environment', '-e', GetoptLong::REQUIRED_ARGUMENT, + "Environment name (e.g. development, test, production)."], ['--freeze', "-F", GetoptLong::NO_ARGUMENT, "Freezes the Buildfile so it always uses Buildr version #{Buildr::VERSION}"], ['--unfreeze', "-U", GetoptLong::NO_ARGUMENT, "Unfreezes the Buildfile to use the latest version of Buildr"] ] @@ -64,10 +64,12 @@ @rakefiles.clear @rakefiles << value when '--version' puts "Buildr, version #{Buildr::VERSION}" exit + when '--environment' + ENV['BUILDR_ENV'] = value when "--freeze" find_buildfile puts "Freezing the Buildfile so it always uses Buildr version #{Buildr::VERSION}" original = File.read(rakefile) if original =~ /gem\s*(["'])buildr\1/ @@ -83,11 +85,11 @@ modified = File.read(rakefile).sub(/^\s*gem\s*(["'])buildr\1.*\n/, "") File.open(rakefile, "w") { |file| file.write modified } exit when "--require" @requires << value - when "--nosearch", "--quiet", "--trace", "--verbose" + when "--nosearch", "--quiet", "--trace" super end end def find_buildfile() @@ -107,10 +109,10 @@ end end def load_buildfile() @requires.each { |name| require name } - puts "(in #{Dir.pwd})" + puts Buildr.environment ? "(in #{Dir.pwd}, #{Buildr.environment})" : "(in #{Dir.pwd})" load File.expand_path(@rakefile) if @rakefile != '' load_imports end def usage()