Module: Listen::Compat::Loader
- Defined in:
- lib/listen/compat/wrapper.rb
Overview
Tries to require Listen using rubygems or vendored version
Class Method Summary collapse
- .compatible_version ⇒ Object
- .load! ⇒ Object
- .msg_about_gem_install ⇒ Object
- .older_than_193? ⇒ Boolean
- .try_rubygems ⇒ Object
Class Method Details
.compatible_version ⇒ Object
21 22 23 |
# File 'lib/listen/compat/wrapper.rb', line 21 def compatible_version !older_than_193? ? '~> 2.7' : '~> 1.1' end |
.load! ⇒ Object
9 10 11 |
# File 'lib/listen/compat/wrapper.rb', line 9 def load! defined?(gem) ? try_rubygems : try_without_rubygems end |
.msg_about_gem_install ⇒ Object
29 30 31 32 |
# File 'lib/listen/compat/wrapper.rb', line 29 def msg_about_gem_install format("Run \"gem install listen --version '%s'\" to get it.", compatible_version) end |
.older_than_193? ⇒ Boolean
25 26 27 |
# File 'lib/listen/compat/wrapper.rb', line 25 def older_than_193? Gem::Version.new(RUBY_VERSION) >= Gem::Version.new('1.9.3') end |
.try_rubygems ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/listen/compat/wrapper.rb', line 13 def try_rubygems gem 'listen', '>= 1.1.0', '< 3.0.0' require 'listen' rescue LoadError, Gem::LoadError => e e..replace(format("%s\n%s", e., msg_about_gem_install)) raise end |