Merge pull request #25 from jaylevitt/master

Allow QWANDRY_EDITOR variable
This commit is contained in:
Adam Sanderson 2012-07-23 17:18:12 -07:00
commit 22d35a2576
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
require 'rake' require 'rake'
require 'rake/testtask' require 'rake/testtask'
require 'rake/rdoctask' require 'rdoc/task'
begin begin
require 'jeweler' require 'jeweler'

View File

@ -25,10 +25,10 @@ module Qwandry
# Launches a Package or path represented by a String. Unless `editor` will # Launches a Package or path represented by a String. Unless `editor` will
# check against the environment by default. # check against the environment by default.
def launch(package, editor=nil) def launch(package, editor=nil)
editor ||= @editor || ENV['VISUAL'] || ENV['EDITOR'] editor ||= @editor || ENV['QWANDRY_EDITOR'] || ENV['VISUAL'] || ENV['EDITOR']
if (!editor) || (editor =~ /^\s*$/) # if the editor is not set, or is blank, exit with a message: if (!editor) || (editor =~ /^\s*$/) # if the editor is not set, or is blank, exit with a message:
puts "Please either set EDITOR or pass in an editor to use" puts "Please set QWANDRY_EDITOR, VISUAL or EDITOR, or pass in an editor to use"
exit 1 exit 1
end end