Method: ConfCtl::Cli::Swpins::Core#update

Defined in:
lib/confctl/cli/swpins/core.rb

#updateObject



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/confctl/cli/swpins/core.rb', line 57

def update
  require_args!(optional: %w[sw])
  core = ConfCtl::Swpins::Core.get
  change_set = ConfCtl::Swpins::ChangeSet.new

  core.specs.each do |name, spec|
    next if args[0] && !ConfCtl::Pattern.match(args[0], name)

    if spec.from_channel?
      puts "Skipping #{spec.name} as it comes from channel #{spec.channel}"
    elsif spec.can_update?
      change_set.add(core, spec)
      spec_update_msg(core, spec) { spec.prefetch_update }
    else
      puts "#{spec.name} not configured for update"
    end
  end

  core.save
  core.pre_evaluate

  return unless opts[:commit]

  change_set.commit(
    type: opts[:downgrade] ? :downgrade : :upgrade,
    changelog: opts[:changelog]
  )
end