Sha256: 37376b8aa484f58af7b35b557364c7649243841aeb32ceda69f73bb7847f19c8
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
# frozen_string_literal: true module Appifier module Helpers module Gem # facility to find a file in gem path # @param [String] _gem a Gem name # @param [String] _file a file relative path in the gem # @return [String] the path of the file, if found. # @return [False] if not found 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 end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
appifier-0.3.0 | lib/appifier/helpers/gem.rb |
appifier-0.2.0 | lib/appifier/helpers/gem.rb |
appifier-0.1.2 | lib/appifier/helpers/gem.rb |
appifier-0.1.1 | lib/appifier/helpers/gem.rb |