Class: Gel::DirectGem
Constant Summary
Constants inherited from StoreGem
StoreGem::EXTENSION_SUBDIR_TOKEN
Instance Attribute Summary
Attributes inherited from StoreGem
#extensions, #info, #name, #root, #version
Instance Method Summary collapse
-
#initialize(root, name, version = nil) ⇒ DirectGem
constructor
A new instance of DirectGem.
- #load_gemspec(filename) ⇒ Object
Methods inherited from StoreGem
#==, #bindir, #dependencies, #executables, #hash, #libs, #path, #require_paths, #satisfies?
Constructor Details
#initialize(root, name, version = nil) ⇒ DirectGem
Returns a new instance of DirectGem.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/gel/direct_gem.rb', line 8 def initialize(root, name, version = nil) root = File.(root) if File.exist?("#{root}/#{name}.gemspec") gemspec = load_gemspec("#{root}/#{name}.gemspec") elsif File.exist?("#{root}/#{name}/#{name}.gemspec") root = "#{root}/#{name}" gemspec = load_gemspec("#{root}/#{name}.gemspec") else super(root, name, version, [], bindir: "bin", executables: [], require_paths: ["lib"], dependencies: []) return end info = { bindir: gemspec.bindir || "bin", executables: gemspec.executables, require_paths: gemspec.require_paths || [gemspec.require_path].compact, dependencies: gemspec.runtime_dependencies, } super(root, name, version || gemspec.version, gemspec.extensions, info) end |
Instance Method Details
#load_gemspec(filename) ⇒ Object
4 5 6 |
# File 'lib/gel/direct_gem.rb', line 4 def load_gemspec(filename) Gel::GemspecParser.parse(File.read(filename), filename, isolate: false) end |