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.

Returns:

  • (Boolean)


83
84
85
# File 'lib/licensed/cli.rb', line 83

def self.exit_on_failure?
  true
end

Instance Method Details

#cacheObject



15
16
17
18
# File 'lib/licensed/cli.rb', line 15

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

#envObject



61
62
63
# File 'lib/licensed/cli.rb', line 61

def env
  run Licensed::Commands::Environment.new(config: config), reporter: options[:format]
end

#listObject



36
37
38
# File 'lib/licensed/cli.rb', line 36

def list
  run Licensed::Commands::List.new(config: config), sources: options[:sources]
end

#migrateObject



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/licensed/cli.rb', line 70

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

#noticesObject



45
46
47
# File 'lib/licensed/cli.rb', line 45

def notices
  run Licensed::Commands::Notices.new(config: config), sources: options[:sources]
end

#statusObject



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

def status
  run Licensed::Commands::Status.new(config: config), sources: options[:sources], reporter: options[:format]
end

#versionObject



52
53
54
# File 'lib/licensed/cli.rb', line 52

def version
  puts Licensed::VERSION
end