Sha256: 2e588361b9d523b5f3cfcf14783a4302a4268127e1ea3e6aa1e7f1559705bb14
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'bundler/setup' require 'optparse' require 'reality/zapwhite' @check_only = false @generate_gitattributes = true @exclude_patterns = [] @rules = [] @base_directory = Dir.pwd OptionParser.new do |opts| opts.banner = 'Usage: zapwhite [options] directory' opts.on('-c', '--check-only', 'Run check and emit messages but do not change files') do @check_only = true end opts.on('-g', '--[no-]generate-gitattributes', 'Generate the .gitattributes file based on files present on filesystem') do |generate_gitattributes| @generate_gitattributes = generate_gitattributes end opts.on('-d', '--directory DIR', 'Base directory of git repository') do |base_directory| @base_directory = base_directory end opts.on('-e', '--exclude-pattern PATTERN', 'Replace default exclude patterns with pattern(s) specified.') do |pattern| @exclude_patterns << pattern end opts.on('-r', '--rule RULE', 'Additional rule(s) (a.k.a. lines) to add when generating .gitattributes file.') do |rule| @rules << rule end end.parse! unless ARGV.empty? puts "Unhandled options: #{ARGV.inspect}" exit -1 end runner = Reality::Zapwhite.new(File.expand_path(@base_directory)) runner.check_only = @check_only runner.generate_gitattributes = @generate_gitattributes runner.additional_gitattribute_rules = @rules unless @exclude_patterns.empty? runner.exclude_patterns.clear @exclude_patterns.each do |exclude_pattern| runner.exclude_patterns << exclude_pattern end end exit runner.run
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
zapwhite-2.6.0 | bin/zapwhite |
zapwhite-2.5.0 | bin/zapwhite |