Skip to content

Dry run can be turn on via LAUNCHY_DRY_RUN environment variable #38

Merged
merged 1 commit into from Mar 18, 2012
View
2 lib/launchy.rb
@@ -51,7 +51,7 @@ def extract_global_options( options )
Launchy.application = options.delete( :application ) || ENV['LAUNCHY_APPLICATION']
Launchy.host_os = options.delete( :host_os ) || ENV['LAUNCHY_HOST_OS']
Launchy.ruby_engine = options.delete( :ruby_engine ) || ENV['LAUNCHY_RUBY_ENGINE']
- Launchy.dry_run = options.delete( :dry_run )
+ Launchy.dry_run = options.delete( :dry_run ) || ENV['LAUNCHY_DRY_RUN']
end
def debug=( d )
View
7 spec/launchy_spec.rb
@@ -23,6 +23,13 @@
ENV["LAUNCHY_DEBUG"] = nil
end
+ it "sets the global option :dry_run to value of LAUNCHY_DRY_RUN environment variable" do
+ ENV['LAUNCHY_DRY_RUN'] = 'true'
+ Launchy.extract_global_options({})
+ Launchy.dry_run?.must_equal 'true'
+ ENV['LAUNCHY_DRY_RUN'] = nil
+ end
+
it "has the global option :debug" do
Launchy.extract_global_options( { :debug => 'true' } )
Launchy.debug?.must_equal true
Something went wrong with that request. Please try again.