Sha256: 4c17a39b5217821148dcf87fe078459f4c0d938c02f198d28c15189210fb8bea

Contents?: true

Size: 1.41 KB

Versions: 48

Compression:

Stored size: 1.41 KB

Contents

require "vagrant/plugin/manager"

module VagrantPlugins
  module CommandPlugin
    module Action
      class UpdateGems
        def initialize(app, env)
          @app    = app
        end

        def call(env)
          names = env[:plugin_name] || []

          if names.empty?
            env[:ui].info(I18n.t("vagrant.commands.plugin.updating"))
          else
            env[:ui].info(I18n.t("vagrant.commands.plugin.updating_specific",
                                 names: names.join(", ")))
          end

          manager = Vagrant::Plugin::Manager.instance
          installed_plugins = manager.installed_plugins
          new_specs       = manager.update_plugins(names)
          updated_plugins = manager.installed_plugins

          updated = {}
          installed_plugins.each do |name, info|
            update = updated_plugins[name]
            if update && update["installed_gem_version"] != info["installed_gem_version"]
              updated[name] = update["installed_gem_version"]
            end
          end

          if updated.empty?
            env[:ui].success(I18n.t("vagrant.commands.plugin.up_to_date"))
          end

          updated.each do |name, version|
            env[:ui].success(I18n.t("vagrant.commands.plugin.updated",
                                    name: name, version: version.to_s))
          end

          # Continue
          @app.call(env)
        end
      end
    end
  end
end

Version data entries

48 entries across 44 versions & 5 rubygems

Version Path
vagrant-unbundled-2.3.6.0 plugins/commands/plugin/action/update_gems.rb
tamtam-vagrant-reload-1.2.1 vendor/cache/vagrant-2092df529ae7/plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.3.3.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.3.2.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.19.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.18.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.16.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.14.0 plugins/commands/plugin/action/update_gems.rb
vagrant-aws-mkubenka-0.7.2.pre.24 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-22795b161bf6/plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.10.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.9.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.8.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.7.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.6.2 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.6.1 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.6.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.5.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.4.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.3.0 plugins/commands/plugin/action/update_gems.rb
vagrant-unbundled-2.2.2.0 plugins/commands/plugin/action/update_gems.rb