Class: SafeUpdate::OutdatedGem
- Inherits:
-
Object
- Object
- SafeUpdate::OutdatedGem
- Defined in:
- lib/safe_update/outdated_gem.rb
Instance Attribute Summary collapse
-
#installed ⇒ Object
readonly
Returns the value of attribute installed.
-
#newest ⇒ Object
readonly
Returns the value of attribute newest.
-
#requested ⇒ Object
readonly
Returns the value of attribute requested.
Instance Method Summary collapse
-
#initialize(line) ⇒ OutdatedGem
constructor
line is a line from bundle outdated –parseable eg.
- #name ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(line) ⇒ OutdatedGem
line is a line from bundle outdated –parseable eg. react-rails (newest 1.6.0, installed 1.5.0, requested ~> 1.0) or. react-rails (newest 1.6.0, installed 1.5.0)
8 9 10 11 12 13 |
# File 'lib/safe_update/outdated_gem.rb', line 8 def initialize(line) @line = line if name.to_s.empty? fail "Unexpected output from `bundle outdated --parseable`: #{@line}" end end |
Instance Attribute Details
#installed ⇒ Object (readonly)
Returns the value of attribute installed.
3 4 5 |
# File 'lib/safe_update/outdated_gem.rb', line 3 def installed @installed end |
#newest ⇒ Object (readonly)
Returns the value of attribute newest.
3 4 5 |
# File 'lib/safe_update/outdated_gem.rb', line 3 def newest @newest end |
#requested ⇒ Object (readonly)
Returns the value of attribute requested.
3 4 5 |
# File 'lib/safe_update/outdated_gem.rb', line 3 def requested @requested end |
Instance Method Details
#name ⇒ Object
27 28 29 |
# File 'lib/safe_update/outdated_gem.rb', line 27 def name string_between(@line, '', ' (newest') end |
#update ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/safe_update/outdated_gem.rb', line 15 def update puts '-------------' puts "OUTDATED GEM: #{name}" puts " Newest: #{newest}. " puts "Installed: #{installed}." puts "Running `bundle update #{name}`..." `bundle update #{name}` puts "committing changes (message: '#{commit_message}')..." `git add Gemfile.lock` `git commit -m '#{commit_message}'` end |