In Ruby < 1.9, Symbol#downcase doesn't exist!
This commit is contained in:
parent
3d52d51d36
commit
cb5843aa47
@ -1,5 +1,9 @@
|
|||||||
## Master
|
## Master
|
||||||
|
|
||||||
|
### Bugs fixes:
|
||||||
|
|
||||||
|
- In Ruby < 1.9, Symbol#downcase doesn't exist! ([@rymai](https://github.com/rymai))
|
||||||
|
|
||||||
### New features:
|
### New features:
|
||||||
|
|
||||||
- Pull request [#73](https://github.com/guard/guard/pull/73): Allow DSL's `group` method to accept a Symbol as group name. ([@johnbintz](https://github.com/johnbintz))
|
- Pull request [#73](https://github.com/guard/guard/pull/73): Allow DSL's `group` method to accept a Symbol as group name. ([@johnbintz](https://github.com/johnbintz))
|
||||||
|
@ -81,14 +81,14 @@ module Guard
|
|||||||
end
|
end
|
||||||
|
|
||||||
def get_guard_class(name)
|
def get_guard_class(name)
|
||||||
try_to_load_gem name
|
try_to_load_gem(name)
|
||||||
self.const_get(self.constants.find { |klass_name| klass_name.to_s.downcase == name.to_s.downcase.gsub('-', '') })
|
self.const_get(self.constants.find { |klass_name| klass_name.to_s.downcase == name.to_s.downcase.gsub('-', '') })
|
||||||
rescue TypeError
|
rescue TypeError
|
||||||
UI.error "Could not find load find gem 'guard-#{name}' or find class Guard::#{name}"
|
UI.error "Could not find load find gem 'guard-#{name}' or find class Guard::#{name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def try_to_load_gem(name)
|
def try_to_load_gem(name)
|
||||||
require "guard/#{name.downcase}"
|
require "guard/#{name.to_s.downcase}"
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -89,6 +89,19 @@ describe Guard do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe ".try_to_load_gem" do
|
||||||
|
class Guard::Classname
|
||||||
|
end
|
||||||
|
|
||||||
|
it "reports an error if the class is not found" do
|
||||||
|
Guard.get_guard_class('classname').should be_true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "reports an error if the class is not found" do
|
||||||
|
Guard.get_guard_class(:classname).should be_true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe ".locate_guard" do
|
describe ".locate_guard" do
|
||||||
it "returns the path of a Guard gem" do
|
it "returns the path of a Guard gem" do
|
||||||
if Gem::Version.create(Gem::VERSION) >= Gem::Version.create('1.8.0')
|
if Gem::Version.create(Gem::VERSION) >= Gem::Version.create('1.8.0')
|
||||||
|
Loading…
Reference in New Issue
Block a user