Sha256: 169a4665175d696c505ce92c3356472f03743318123d01b6725dca37272db966
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
# encoding: utf-8 module Phare class CLI attr_reader :suite def initialize(env, argv) @env = env @argv = argv parse_options @suite = Phare::CheckSuite.new(@options) end def run if @env['SKIP_CODE_CHECK'] Phare.puts '--------------------------------------------------------' Phare.puts 'Skipping code style checking… Really? Well alright then…' Phare.puts '--------------------------------------------------------' exit 0 else if @suite.tap(&:run).status == 0 Phare.puts '------------------------------------------' Phare.puts 'Everything looks good, keep on committing!' Phare.puts '------------------------------------------' exit 0 else Phare.puts '------------------------------------------------------------------------' Phare.puts 'Something’s wrong with your code style. Please fix it before committing.' Phare.puts '------------------------------------------------------------------------' exit 1 end end end def parse_options @options = { directory: Dir.getwd } OptionParser.new do |opts| opts.banner = 'Usage: phare [options]' opts.on('--directory', 'The directory in which to run the checks (default is the current directory') do |directory| @options[:directory] = directory end opts.on('--skip x,y,z', 'Skip checks') do |checks| @options[:skip] = checks.split(',').map(&:to_sym) end opts.on('--only x,y,z', 'Only run the specified checks') do |checks| @options[:only] = checks.split(',').map(&:to_sym) end opts.on('--diff', 'Only run checks on modified files') do @options[:diff] = true end end.parse! @argv end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
phare-0.5.2 | lib/phare/cli.rb |
phare-0.5.1 | lib/phare/cli.rb |
phare-0.5 | lib/phare/cli.rb |