mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			47 lines
		
	
	
		
			933 B
		
	
	
	
		
			Ruby
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			933 B
		
	
	
	
		
			Ruby
		
	
	
		
			Executable File
		
	
	
	
	
#!/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?
 |