Sha256: 2ec91b02560e9166834e215f69c0d086c93dd95e5c75da0e49d04915a43930a4
Contents?: true
Size: 1000 Bytes
Versions: 2
Compression:
Stored size: 1000 Bytes
Contents
require 'rubygems' require 'thor' class Maid::App < Thor default_task 'clean' desc 'clean', 'Clean based on rules' method_option :rules, :type => :string, :aliases => %w[-r] method_option :noop, :type => :boolean, :aliases => %w[-n --dry-run] method_option :silent, :type => :boolean, :aliases => %w[-s] def clean maid = Maid::Maid.new(maid_options(options)) say "Logging actions to #{maid.log_path.inspect}" unless options.silent? || options.noop? maid.clean end desc 'version', 'print version number' def version say Maid::VERSION end no_tasks do def maid_options(options) h = {} if options['noop'] # You're testing, so a simple log goes to STDOUT and no actions are taken h[:file_options] = {:noop => true} h[:log_path] = STDOUT h[:log_formatter] = lambda { |_, _, _, msg| "#{msg}\n" } end if options['rules'] h[:rules_path] = options['rules'] end h end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
maid-0.1.0.beta2 | lib/maid/app.rb |
maid-0.1.0.beta1 | lib/maid/app.rb |