Class: PoiseRuby::Resources::BundleInstall::Provider
- Inherits:
-
Chef::Provider
- Object
- Chef::Provider
- PoiseRuby::Resources::BundleInstall::Provider
- Includes:
- Poise, PoiseRuby::RubyCommandMixin
- Defined in:
- lib/poise_ruby/resources/bundle_install.rb
Overview
The default provider for the bundle_install
resource.
Instance Method Summary collapse
-
#action_install ⇒ Object
Install bundler and the gems in the Gemfile.
-
#action_update ⇒ Object
Install bundler and update the gems in the Gemfile.
-
#bundler_binary ⇒ String
Return the absolute path to the correct bundle binary to run.
-
#gemfile_path ⇒ String
Find the absolute path to the Gemfile.
Instance Method Details
#action_install ⇒ Object
Install bundler and the gems in the Gemfile.
118 119 120 |
# File 'lib/poise_ruby/resources/bundle_install.rb', line 118 def action_install run_bundler('install') end |
#action_update ⇒ Object
Install bundler and update the gems in the Gemfile.
123 124 125 |
# File 'lib/poise_ruby/resources/bundle_install.rb', line 123 def action_update run_bundler('update') end |
#bundler_binary ⇒ String
Return the absolute path to the correct bundle binary to run.
130 131 132 |
# File 'lib/poise_ruby/resources/bundle_install.rb', line 130 def bundler_binary @bundler_binary ||= ::File.join(poise_gem_bindir, 'bundle') end |
#gemfile_path ⇒ String
Find the absolute path to the Gemfile. This mirrors bundler's internal search logic by scanning up to parent folder as needed.
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/poise_ruby/resources/bundle_install.rb', line 138 def gemfile_path @gemfile_path ||= begin path = ::File.(new_resource.path) if ::File.file?(path) # We got a path to a real file, use that. path else # Walk back until path==dirname(path) meaning we are at the root while path != (next_path = ::File.dirname(path)) possible_path = ::File.join(path, 'Gemfile') return possible_path if ::File.file?(possible_path) path = next_path end end end end |