Class: Rrm::Updater
- Inherits:
-
Object
- Object
- Rrm::Updater
- Defined in:
- lib/rrm/updater.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #all_repositories ⇒ Object
-
#initialize(options) ⇒ Updater
constructor
Needs options as a hash.
- #update_all ⇒ Object
Constructor Details
#initialize(options) ⇒ Updater
Needs options as a hash. Options follow the naming from the console application in bin/rrm. Example
{ :urls => [
[0] "[email protected]:kickban/form-kickban-fi.git"
],
:patch_next => false,
:patch_latest => true,
:minor_next => false,
:minor_latest => false,
:major_next => false,
:major_latest => false,
:update_gems => false
}
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/rrm/updater.rb', line 22 def initialize() $env_variables = [:env] @options = if [:major_latest] @level = :major_latest elsif [:major_next] @level = :major_next elsif [:minor_latest] @level = :minor_latest elsif [:minor_next] @level = :minor_next elsif [:patch_latest] @level = :patch_latest elsif [:patch_next] @level = :patch_next end end |
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
6 7 8 |
# File 'lib/rrm/updater.rb', line 6 def level @level end |
#options ⇒ Object
Returns the value of attribute options.
5 6 7 |
# File 'lib/rrm/updater.rb', line 5 def @options end |
Instance Method Details
#all_repositories ⇒ Object
67 68 69 |
# File 'lib/rrm/updater.rb', line 67 def all_repositories @all_repositories ||=fetch_all_repositories end |
#update_all ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/rrm/updater.rb', line 41 def update_all raise "Choose what to update" if @level.nil? Rrm.logger.debug "Available normal Ruby versions: #{Rrm.all_ruby_versions}" all_repositories.each do |repository| puts "#{repository.name} from #{repository.current_version} to #{repository.new_version}" end = TTY::ProgressBar.new("Running upgrades (:current of :total) [:bar]", total: all_repositories.size, width: 30) all_repositories.each do |repository| repository.update! .advance(1) end = TTY::ProgressBar.new("Pushing branches (:current of :total) [:bar]", total: all_repositories.size, width: 30) all_repositories.each do |repository| repository.push! .advance(1) end puts "Pushed branches:" all_repositories.each do |repository| puts "#{repository.branch_name} (#{repository.git.remote.url})" end end |