Sha256: 09ba9aa2d62a9302530afdbcb2a9b5e8b12c6be10588197ccacc07665a915711

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

module Pelusa
  # The cli is a class responsible of handling all the command line interface
  # logic.
  #
  class Cli
    def initialize(args=ARGV)
      @args = args
    end

    def run
      _files = files
      if _files.empty?
        warn "\n  No files specified -- PROCESS ALL THE FILES!\n"
        _files = Dir["**/*.rb"]
      end

      Pelusa.run(_files)
    end

    def files
      if glob = @args.detect { |arg| arg =~ /\*/ }
        return Dir[glob]
      end
      _files = @args.select { |arg| arg =~ /\.rb/ }
      _files = Dir[Pelusa.configuration.sources] if _files.empty?
      _files
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pelusa-0.1.1 lib/pelusa/cli.rb
pelusa-0.1.0 lib/pelusa/cli.rb