Files
linguist/script/licensor
Brandon Keepers 0d469e2966 Add licensor
2015-10-20 17:44:31 -04:00

44 lines
909 B
Ruby
Executable File

#!/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