Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from Mar 18, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/launchy.rb
Expand Up @@ -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 )
Expand Down
7 changes: 7 additions & 0 deletions spec/launchy_spec.rb
Expand Up @@ -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
Expand Down