mirror of https://github.com/licensee/licensee.git
run rubocop
This commit is contained in:
parent
df0737334c
commit
1981678146
|
@ -23,7 +23,7 @@ class LicenseeCLI < Thor
|
|||
rows << if project.license
|
||||
['License:', project.license.name]
|
||||
elsif !project.licenses.empty?
|
||||
["Licenses:", project.licenses.map(&:name)]
|
||||
['Licenses:', project.licenses.map(&:name)]
|
||||
else
|
||||
['License:', set_color('None', :red)]
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ class LicenseeCLI < Thor
|
|||
unless project.matched_files.empty?
|
||||
rows << ['Matched files:', project.matched_files.map(&:filename).join(', ')]
|
||||
end
|
||||
|
||||
|
||||
print_table rows
|
||||
|
||||
project.matched_files.each do |matched_file|
|
||||
|
@ -62,9 +62,10 @@ class LicenseeCLI < Thor
|
|||
|
||||
if project.license_file && (options[:license] || options[:diff])
|
||||
license = options[:license] || closest_license_key(project.license_file)
|
||||
invoke(:diff, nil,
|
||||
license: license, license_to_diff: project.license_file
|
||||
) if license
|
||||
if license
|
||||
invoke(:diff, nil,
|
||||
license: license, license_to_diff: project.license_file)
|
||||
end
|
||||
end
|
||||
|
||||
exit !project.licenses.empty?
|
||||
|
|
|
@ -58,7 +58,7 @@ class LicenseeCLI < Thor
|
|||
if options[:license]
|
||||
error "#{options[:license]} is not a valid license"
|
||||
else
|
||||
error "You must provide an expected license"
|
||||
error 'You must provide an expected license'
|
||||
end
|
||||
|
||||
error "Valid licenses: #{Licensee::License.all(hidden: true).map(&:key).join(', ')}"
|
||||
|
|
|
@ -18,10 +18,10 @@ Gem::Specification.new do |gem|
|
|||
gem.bindir = 'bin'
|
||||
gem.executables << 'licensee'
|
||||
|
||||
gem.add_dependency('dotenv', '~> 2.0')
|
||||
gem.add_dependency('octokit', '~> 4.8.0')
|
||||
gem.add_dependency('rugged', '~> 0.24')
|
||||
gem.add_dependency('thor', '~> 0.19')
|
||||
gem.add_dependency('dotenv', '~> 2.0')
|
||||
|
||||
gem.add_development_dependency('coveralls', '~> 0.8')
|
||||
gem.add_development_dependency('mustache', '>= 0.9', '< 2.0')
|
||||
|
|
|
@ -12,32 +12,32 @@ RSpec.describe 'command line invocation' do
|
|||
let(:status) { output[2] }
|
||||
let(:hash) { '46cdc03462b9af57968df67b450cc4372ac41f53' }
|
||||
|
||||
context "detection" do
|
||||
context 'detection' do
|
||||
let(:subcommand) { 'detect' }
|
||||
|
||||
let(:expected) {
|
||||
let(:expected) do
|
||||
{
|
||||
"License" => "MIT License",
|
||||
"Matched files" => "LICENSE.md, licensee.gemspec",
|
||||
"LICENSE.md" => {
|
||||
"Content hash" => hash,
|
||||
"Attribution" => "Copyright (c) 2014-2017 Ben Balter",
|
||||
"Confidence" => "100.00%",
|
||||
"Matcher" => "Licensee::Matchers::Exact",
|
||||
"License" => "MIT License"
|
||||
'License' => 'MIT License',
|
||||
'Matched files' => 'LICENSE.md, licensee.gemspec',
|
||||
'LICENSE.md' => {
|
||||
'Content hash' => hash,
|
||||
'Attribution' => 'Copyright (c) 2014-2017 Ben Balter',
|
||||
'Confidence' => '100.00%',
|
||||
'Matcher' => 'Licensee::Matchers::Exact',
|
||||
'License' => 'MIT License'
|
||||
},
|
||||
"licensee.gemspec" => {
|
||||
"Confidence" => "90.00%",
|
||||
"Matcher" => "Licensee::Matchers::Gemspec",
|
||||
"License" => "MIT License"
|
||||
'licensee.gemspec' => {
|
||||
'Confidence' => '90.00%',
|
||||
'Matcher' => 'Licensee::Matchers::Gemspec',
|
||||
'License' => 'MIT License'
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
{
|
||||
"No arguments" => [],
|
||||
"Project root" => [project_root],
|
||||
"License path" => [File.expand_path('LICENSE.md', project_root)]
|
||||
'No arguments' => [],
|
||||
'Project root' => [project_root],
|
||||
'License path' => [File.expand_path('LICENSE.md', project_root)]
|
||||
}.each do |name, args|
|
||||
context "When given #{name}" do
|
||||
let(:arguments) { args }
|
||||
|
@ -46,12 +46,12 @@ RSpec.describe 'command line invocation' do
|
|||
expect(status.exitstatus).to eql(0)
|
||||
end
|
||||
|
||||
it "returns the exected values" do
|
||||
it 'returns the exected values' do
|
||||
hash = expected.dup
|
||||
|
||||
if name == "License path"
|
||||
hash.delete("licensee.gemspec")
|
||||
hash["Matched files"] = "LICENSE.md"
|
||||
if name == 'License path'
|
||||
hash.delete('licensee.gemspec')
|
||||
hash['Matched files'] = 'LICENSE.md'
|
||||
end
|
||||
|
||||
expect(parsed_output).to eql(hash)
|
||||
|
@ -60,10 +60,10 @@ RSpec.describe 'command line invocation' do
|
|||
end
|
||||
end
|
||||
|
||||
context "version" do
|
||||
context 'version' do
|
||||
let(:subcommand) { 'version' }
|
||||
|
||||
it "returns the version" do
|
||||
it 'returns the version' do
|
||||
expect(stdout).to include(Licensee::VERSION)
|
||||
end
|
||||
|
||||
|
@ -72,12 +72,12 @@ RSpec.describe 'command line invocation' do
|
|||
end
|
||||
end
|
||||
|
||||
context "license-path" do
|
||||
context 'license-path' do
|
||||
let(:subcommand) { 'license-path' }
|
||||
let(:arguments) { [project_root] }
|
||||
|
||||
it "returns the license path" do
|
||||
expect(stdout).to match(File.join(project_root, "LICENSE.md"))
|
||||
it 'returns the license path' do
|
||||
expect(stdout).to match(File.join(project_root, 'LICENSE.md'))
|
||||
end
|
||||
|
||||
it 'Returns a zero exit code' do
|
||||
|
|
Loading…
Reference in New Issue