Class: Bundleup::Commands
- Inherits:
-
Object
- Object
- Bundleup::Commands
- Extended by:
- Forwardable
- Defined in:
- lib/bundleup/commands.rb
Constant Summary collapse
- GEMFILE_ENTRY_REGEXP =
/\* (\S+) \((\S+)(?: (\S+))?\)/
- OUTDATED_2_1_REGEXP =
/\* (\S+) \(newest (\S+),.* requested (.*)\)/
- OUTDATED_2_2_REGEXP =
/^(\S+)\s\s+\S+\s\s+(\d\S+)\s\s+(\S.*?)(?:$|\s\s)/
Instance Method Summary collapse
Instance Method Details
#check? ⇒ Boolean
13 14 15 |
# File 'lib/bundleup/commands.rb', line 13 def check? shell.run?(%w[bundle check]) end |
#install ⇒ Object
17 18 19 |
# File 'lib/bundleup/commands.rb', line 17 def install shell.run(%w[bundle install]) end |
#list ⇒ Object
21 22 23 24 25 26 |
# File 'lib/bundleup/commands.rb', line 21 def list output = shell.capture(%w[bundle list]) output.scan(GEMFILE_ENTRY_REGEXP).each_with_object({}) do |(name, ver, sha), gems| gems[name] = sha || ver end end |
#outdated ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/bundleup/commands.rb', line 28 def outdated output = shell.capture(%w[bundle outdated], raise_on_error: false) expr = output.match?(/^Gem\s+Current\s+Latest/) ? OUTDATED_2_2_REGEXP : OUTDATED_2_1_REGEXP output.scan(expr).each_with_object({}) do |(name, newest, pin), gems| gems[name] = { newest:, pin: } end end |
#update(args = []) ⇒ Object
37 38 39 |
# File 'lib/bundleup/commands.rb', line 37 def update(args=[]) shell.run(%w[bundle update] + args) end |