mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Add licensor
This commit is contained in:
1
Gemfile
1
Gemfile
@@ -2,3 +2,4 @@ source 'https://rubygems.org'
|
||||
gemspec :name => "github-linguist"
|
||||
gemspec :name => "github-linguist-grammars"
|
||||
gem 'byebug' if RUBY_VERSION >= '2.0'
|
||||
gem 'licensor', :path => "../licensor"
|
||||
|
||||
43
script/licensor
Executable file
43
script/licensor
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env ruby
|
||||
|
||||
# TODO: push these changes to licensor gem
|
||||
|
||||
require "bundler/setup"
|
||||
require "licensor/cli"
|
||||
|
||||
module Licensor
|
||||
module Source
|
||||
class Filesystem
|
||||
attr_reader :type
|
||||
|
||||
def initialize(glob, type: "directory")
|
||||
@glob = glob
|
||||
@type = type
|
||||
end
|
||||
|
||||
def enabled?
|
||||
!Dir.glob(@glob).empty?
|
||||
end
|
||||
|
||||
def dependencies
|
||||
Dir.glob(@glob).map do |directory|
|
||||
puts "caching #{directory}"
|
||||
Licensor::Dependency.new(directory, {
|
||||
"type" => type,
|
||||
"name" => File.basename(directory)
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
source = Licensor::Source::Filesystem.new("vendor/grammars/*/", type: "grammar")
|
||||
config = Licensor::Configuration.new
|
||||
config.sources << source
|
||||
|
||||
if ARGV[0] == "verify"
|
||||
Licensor::Command::Verify.new(config).run
|
||||
else
|
||||
Licensor::Command::Cache.new(config).run(force: true)
|
||||
end
|
||||
14
vendor/licenses/config.yml
vendored
Normal file
14
vendor/licenses/config.yml
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
whitelist:
|
||||
- apache-2.0
|
||||
- bsd-2-clause
|
||||
- bsd-3-clause
|
||||
- mit
|
||||
|
||||
# These dependencies are explicitly ignored
|
||||
ignored:
|
||||
rubygem:
|
||||
- bundler
|
||||
|
||||
# These dependencies have been reviewed and approved.
|
||||
reviewed:
|
||||
rubygem:
|
||||
Reference in New Issue
Block a user