Class: Licensed::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/licensed/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

If an error occurs (e.g. a missing command or argument), exit 1.



56
57
58
# File 'lib/licensed/cli.rb', line 56

def self.exit_on_failure?
  true
end

Instance Method Details

#cacheObject



13
14
15
# File 'lib/licensed/cli.rb', line 13

def cache
  run Licensed::Commands::Cache.new(config: config), force: options[:force]
end

#listObject



27
28
29
# File 'lib/licensed/cli.rb', line 27

def list
  run Licensed::Commands::List.new(config: config)
end

#migrateObject



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/licensed/cli.rb', line 43

def migrate
  case options["from"]
  when "v1"
    Licensed::Migrations::V2.migrate(options["config"])
  else
    shell = Thor::Base.shell.new
    shell.say "Unrecognized option from=#{options["from"]}", :red
    CLI.command_help(shell, "migrate")
    exit 1
  end
end

#statusObject



20
21
22
# File 'lib/licensed/cli.rb', line 20

def status
  run Licensed::Commands::Status.new(config: config)
end

#versionObject



34
35
36
# File 'lib/licensed/cli.rb', line 34

def version
  puts Licensed::VERSION
end