forked from octocat/linguist
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlicensed
More file actions
executable file
·46 lines (37 loc) · 933 Bytes
/
licensed
File metadata and controls
executable file
·46 lines (37 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env ruby
# TODO: push these changes to licensor gem
require "bundler/setup"
require "licensed/cli"
module Licensed
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}"
Licensed::Dependency.new(directory, {
"type" => type,
"name" => File.basename(directory)
})
end
end
end
end
end
source = Licensed::Source::Filesystem.new("vendor/grammars/*/", type: "grammar")
config = Licensed::Configuration.new
config.sources << source
command = if ARGV[0] == "verify"
Licensed::Command::Verify.new(config)
else
Licensed::Command::Cache.new(config)
end
command.run
exit command.success?