-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
317 additions
and
317 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative '../../support/feature_helper' | ||
|
||
describe 'Restricted licenses' do | ||
# As a lawyer | ||
# I want to restrict certain licenses | ||
# So that any dependencies with only these licenses cannot be approved | ||
|
||
let(:developer) { LicenseFinder::TestingDSL::User.new } | ||
let(:lawyer) { LicenseFinder::TestingDSL::User.new } | ||
|
||
before do | ||
developer.create_empty_project | ||
lawyer.execute_command 'license_finder restricted_licenses add BSD' | ||
developer.execute_command 'license_finder dependencies add restricted_dep BSD' | ||
end | ||
|
||
specify 'prevent packages from being approved' do | ||
developer.execute_command 'license_finder approval add restricted_dep' | ||
|
||
lawyer.run_license_finder | ||
expect(lawyer).to be_seeing 'restricted_dep' | ||
end | ||
|
||
specify 'override the permitted licenses' do | ||
developer.execute_command 'license_finder permitted_licenses add BSD' | ||
|
||
lawyer.run_license_finder | ||
expect(lawyer).to be_seeing 'restricted_dep' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module LicenseFinder | ||
module CLI | ||
class PermittedLicenses < Base | ||
extend Subcommand | ||
include MakesDecisions | ||
|
||
desc 'list', 'List all the permitted licenses' | ||
def list | ||
say 'Permitted Licenses:', :blue | ||
say_each(decisions.permitted, &:name) | ||
end | ||
|
||
auditable | ||
desc 'add LICENSE...', 'Add one or more licenses to the permitted licenses' | ||
def add(*licenses) | ||
assert_some licenses | ||
modifying { licenses.each { |l| decisions.permit(l, txn) } } | ||
say "Added #{licenses.join(', ')} to the permitted licenses" | ||
end | ||
|
||
auditable | ||
desc 'remove LICENSE...', 'Remove one or more licenses from the permitted licenses' | ||
def remove(*licenses) | ||
assert_some licenses | ||
modifying { licenses.each { |l| decisions.unpermit(l, txn) } } | ||
say "Removed #{licenses.join(', ')} from the license permitted licenses" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# frozen_string_literal: true | ||
|
||
module LicenseFinder | ||
module CLI | ||
class RestrictedLicenses < Base | ||
extend Subcommand | ||
include MakesDecisions | ||
|
||
desc 'list', 'List all the restricted licenses' | ||
def list | ||
say 'Restricted Licenses:', :blue | ||
say_each(decisions.restricted, &:name) | ||
end | ||
|
||
auditable | ||
desc 'add LICENSE...', 'Add one or more licenses to the restricted licenses' | ||
def add(*licenses) | ||
assert_some licenses | ||
modifying { licenses.each { |l| decisions.restrict(l, txn) } } | ||
say "Added #{licenses.join(', ')} to the restricted licenses" | ||
end | ||
|
||
auditable | ||
desc 'remove LICENSE...', 'Remove one or more licenses from the restricted licenses' | ||
def remove(*licenses) | ||
assert_some licenses | ||
modifying { licenses.each { |l| decisions.unrestrict(l, txn) } } | ||
say "Removed #{licenses.join(', ')} from the restricted licenses" | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.