Module: Appifier::Helpers::Gem
- Defined in:
- lib/appifier/helpers/gem.rb
Instance Method Summary collapse
-
#search_file_in_gem(_gem, _file) ⇒ String, False
facility to find a file in gem path.
Instance Method Details
#search_file_in_gem(_gem, _file) ⇒ String, False
facility to find a file in gem path
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/appifier/helpers/gem.rb', line 11 def search_file_in_gem(_gem, _file) if ::Gem::Specification.respond_to?(:find_by_name) begin spec = ::Gem::Specification.find_by_name(_gem) rescue LoadError spec = nil end else spec = ::Gem.searcher.find(_gem) end if spec res = if ::Gem::Specification.respond_to?(:find_by_name) spec.lib_dirs_glob.split('/') else ::Gem.searcher.lib_dirs_for(spec).split('/') end res.pop services_path = res.join('/').concat("/#{_file}") return services_path if File.exist?(services_path) end false end |