Sha256: a929f87beb176604791bf3d04badbf1f653bb1cdebf6b6a2fa69519dcc8d8a7c
Contents?: true
Size: 1.78 KB
Versions: 3
Compression:
Stored size: 1.78 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'chutney' require 'chutney/formatter' require 'chutney/formatter/json_formatter' require 'chutney/formatter/pie_formatter' require 'chutney/formatter/rainbow_formatter' require 'optparse' formatters = Set.new # rubocop:disable Metrics/BlockLength OptionParser.new do |opts| opts.banner = 'Usage: chutney [files]' opts.on('-f', '--format [formatter]', 'One of JSONFormatter, PieFormatter or RainbowFormatter (default).') do |formatter| raise 'No Such Formatter' unless %w[JSONFormatter PieFormatter RainbowFormatter].include? formatter formatters << formatter end opts.on('-v', '--version', 'Display the version.') do puts Chutney::VERSION exit end opts.on('-l', '--linters', 'List the linter status by this configuration and exit') do pastel = Pastel.new chutney_config = Chutney::ChutneyLint.new.configuration max_name_length = chutney_config.keys.map(&:length).max + 1 chutney_config.each do |linter, value| print pastel.cyan(linter.ljust(max_name_length)) if value['Enabled'] puts pastel.green('enabled') else puts pastel.red('disabled') end end exit end end.parse! # rubocop:enable Metrics/BlockLength formatters << 'RainbowFormatter' if formatters.empty? files = ARGV.map { |pattern| Dir.glob(pattern) }.flatten files = Dir.glob('features/**/*.feature') if ARGV.empty? linter = Chutney::ChutneyLint.new(*files) report = linter.analyse formatters.each do |formatter| f = Object.const_get("Chutney::#{formatter}").new f.results = report f.format end basic_formatter = Chutney::Formatter.new basic_formatter.results = report if basic_formatter.files_with_issues.empty? exit(true) else exit(false) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chutney-3.6.0 | exe/chutney |
chutney-3.5.0 | exe/chutney |
chutney-3.3.0 | exe/chutney |