Class: Bundler::AutoUpdate::GemUpdater
- Inherits:
-
Object
- Object
- Bundler::AutoUpdate::GemUpdater
- Defined in:
- lib/bundler_auto_update.rb
Instance Attribute Summary collapse
-
#gem ⇒ Object
readonly
Returns the value of attribute gem.
-
#gemfile ⇒ Object
readonly
Returns the value of attribute gemfile.
-
#test_command ⇒ Object
readonly
Returns the value of attribute test_command.
Instance Method Summary collapse
- #auto_update ⇒ Object
-
#initialize(gem, gemfile, test_command) ⇒ GemUpdater
constructor
A new instance of GemUpdater.
-
#update(version_type) ⇒ Boolean
True on success or when already at latest version.
Constructor Details
#initialize(gem, gemfile, test_command) ⇒ GemUpdater
Returns a new instance of GemUpdater.
44 45 46 |
# File 'lib/bundler_auto_update.rb', line 44 def initialize(gem, gemfile, test_command) @gem, @gemfile, @test_command = gem, gemfile, test_command end |
Instance Attribute Details
#gem ⇒ Object (readonly)
Returns the value of attribute gem.
42 43 44 |
# File 'lib/bundler_auto_update.rb', line 42 def gem @gem end |
#gemfile ⇒ Object (readonly)
Returns the value of attribute gemfile.
42 43 44 |
# File 'lib/bundler_auto_update.rb', line 42 def gemfile @gemfile end |
#test_command ⇒ Object (readonly)
Returns the value of attribute test_command.
42 43 44 |
# File 'lib/bundler_auto_update.rb', line 42 def test_command @test_command end |
Instance Method Details
#auto_update ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/bundler_auto_update.rb', line 48 def auto_update if updatable? Logger.log "Updating #{gem.name}" update(:patch) and update(:minor) and update(:major) else Logger.log "#{gem.name} is not auto-updatable, passing it." end end |
#update(version_type) ⇒ Boolean
Returns true on success or when already at latest version.
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/bundler_auto_update.rb', line 58 def update(version_type) new_version = gem.last_version(version_type) if new_version == gem.version Logger.log_indent "Current gem already at latest #{version_type} version. Passing this update." return true end Logger.log_indent "Updating to #{version_type} version #{new_version}" gem.version = new_version (update_gemfile and run_test_suite and commit_new_version) or revert_to_previous_version end |