Sha256: 0bd38dc04c25c875a506c921b4477be469ec16e3d8e50a32d0c52d168c8adef8

Contents?: true

Size: 537 Bytes

Versions: 2

Compression:

Stored size: 537 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
      @args.select { |arg| arg =~ /\.rb/ }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pelusa-0.0.2 lib/pelusa/cli.rb
pelusa-0.0.1 lib/pelusa/cli.rb