Sha256: f9d0597457ac1f3a4ad3db2afd1065e3302e425b459dc81396d7be2dbb630a32

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

require "licensed"
require "thor"

module Licensed
  class CLI < Thor

    desc "cache", "Cache the licenses of dependencies"
    method_option :force, :type => :boolean,
      :desc => "Overwrite licenses even if version has not changed."
    method_option :offline, :type => :boolean,
      :desc => "Do not make network calls."
    method_option "license-dir", :type => :string,
      :desc => "Path to license storage directory (defaults to vendor/licenses)"
    def cache
      Licensed.use_github = false if options[:offline]
      run Licensed::Command::Cache.new(config), force: options[:force]
    end

    desc "verify", "Verify licenses of dependencies"
    method_option "license-dir", :type => :string,
      :desc => "Path to license storage directory (defaults to vendor/licenses)"
    def verify
      run Licensed::Command::Verify.new(config)
    end

    desc "list", "List dependencies"
    method_option "license-dir", :type => :string,
      :desc => "Path to license storage directory (defaults to vendor/licenses)"
    def list
      run Licensed::Command::List.new(config)
    end

    private

    def config
      @config ||= Configuration.new(options)
    end

    def run(command, *args)
      command.run(*args)
      exit command.success?
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
licensed-0.11.1 lib/licensed/cli.rb
licensed-0.11.0 lib/licensed/cli.rb