Class: UpmSupport::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/upm_support.rb

Class Method Summary collapse

Class Method Details

.run(args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/upm_support.rb', line 9

def self.run(args)
  actions = %w[to_upm clean_upbring]
  action = args[0]

  migrations_file_path = File.join(File.dirname(__FILE__) + "/assets/migrations.json")

  migrations = JSON.parse(File.read(migrations_file_path))

  registry_uri = ENV.fetch('UPM_REGISTRY', 'https://upm.dragonbox.com')

  puts "Migrating action #{action}"

  case action
  when 'to_upm'
    Actions.migrate_dependencies_to_upm('.', migrations, registry_uri, force_upgrade: args.include?("--force-upgrade"))
  when 'clean_upbring'
    Actions.remove_deleted_uplift_assets('.')
  else
    raise "Unknown action #{action}. Use any of #{actions.join(',')}"
  end
end