Module: Spoom::Context::Bundle
Overview
Bundle features for a context
Instance Method Summary collapse
- #bundle(command, version: nil, capture_err: true) ⇒ Object
- #bundle_exec(command, version: nil, capture_err: true) ⇒ Object
- #bundle_install!(version: nil, capture_err: true) ⇒ Object
- #gem_version_from_gemfile_lock(gem) ⇒ Object
- #read_gemfile ⇒ Object
- #write_gemfile!(contents, append: false) ⇒ Object
Instance Method Details
#bundle(command, version: nil, capture_err: true) ⇒ Object
27 28 29 30 |
# File 'lib/spoom/context/bundle.rb', line 27 def bundle(command, version: nil, capture_err: true) command = "_#{version}_ #{command}" if version exec("bundle #{command}", capture_err: capture_err) end |
#bundle_exec(command, version: nil, capture_err: true) ⇒ Object
40 41 42 |
# File 'lib/spoom/context/bundle.rb', line 40 def bundle_exec(command, version: nil, capture_err: true) bundle("exec #{command}", version: version, capture_err: capture_err) end |
#bundle_install!(version: nil, capture_err: true) ⇒ Object
34 35 36 |
# File 'lib/spoom/context/bundle.rb', line 34 def bundle_install!(version: nil, capture_err: true) bundle("install", version: version, capture_err: capture_err) end |
#gem_version_from_gemfile_lock(gem) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/spoom/context/bundle.rb', line 48 def gem_version_from_gemfile_lock(gem) return nil unless file?("Gemfile.lock") content = read("Gemfile.lock").match(/^ #{gem} \(.*(\d+\.\d+\.\d+).*\)/) return nil unless content content[1] end |
#read_gemfile ⇒ Object
15 16 17 |
# File 'lib/spoom/context/bundle.rb', line 15 def read_gemfile read("Gemfile") end |
#write_gemfile!(contents, append: false) ⇒ Object
21 22 23 |
# File 'lib/spoom/context/bundle.rb', line 21 def write_gemfile!(contents, append: false) write!("Gemfile", contents, append: append) end |