Class: Gemvault::BundlerGemfile
- Inherits:
-
Object
- Object
- Gemvault::BundlerGemfile
- Defined in:
- lib/gemvault/bundler_gemfile.rb
Overview
The Gemfile Bundler would load from a directory.
Mirrors Bundler::SharedHelpers#find_gemfile: BUNDLE_GEMFILE wins
when set and non-empty, otherwise the search walks up looking for
gems.rb then Gemfile in each directory. Reimplemented
rather than delegated because bundler is deliberately not a gemvault
dependency (see gemvault.gemspec) and gemvault doctor runs as a plain
CLI, outside any Bundler process.
One difference is deliberate. Bundler returns BUNDLE_GEMFILE
whatever it points at, existing or not -- bundler/inline relies on that,
setting it to a bare "Gemfile" purely to make Bundler treat the working
directory as the app root. The question here is whether bundle install
could work, so a value that does not name a file is ignored and the
walk-up search decides instead.
Constant Summary collapse
- NAMES =
Checked in this order within each directory, as Bundler checks them.
["gems.rb", "Gemfile"].freeze
Instance Method Summary collapse
-
#exist? ⇒ Boolean
Whether Bundler would find a Gemfile at all.
-
#initialize(dir: Dir.pwd, env: ENV) ⇒ BundlerGemfile
constructor
A new instance of BundlerGemfile.
-
#path ⇒ Object
:call-seq: path -> Pathname or nil.
Constructor Details
#initialize(dir: Dir.pwd, env: ENV) ⇒ BundlerGemfile
Returns a new instance of BundlerGemfile.
24 25 26 27 |
# File 'lib/gemvault/bundler_gemfile.rb', line 24 def initialize(dir: Dir.pwd, env: ENV) @dir = Pathname(dir) @env = env end |
Instance Method Details
#exist? ⇒ Boolean
Whether Bundler would find a Gemfile at all.
40 41 42 |
# File 'lib/gemvault/bundler_gemfile.rb', line 40 def exist? !path.nil? end |
#path ⇒ Object
:call-seq:
path -> Pathname or nil
The Gemfile Bundler would load, or nil when there is none.
33 34 35 36 37 |
# File 'lib/gemvault/bundler_gemfile.rb', line 33 def path return @path if defined?(@path) @path = from_env || search_up end |