Sha256: 1cd7daf39853765cddbae84458a3630b4ff1f01c8d418da9cbce92b4ab62ccd0

Contents?: true

Size: 750 Bytes

Versions: 13

Compression:

Stored size: 750 Bytes

Contents

require "clamp"

# require all the rubber commands
files = Dir[File.expand_path(File.join(File.dirname(__FILE__), 'commands/*.rb'))]
files.each do |f|
  require f
end

module Rubber

  class CLI < Clamp::Command
    
    # setup clamp subcommands for each rubber command
    Rubber::Commands.constants.each do |c|
      clazz = Rubber::Commands.const_get(c)
      if clazz.class == Class && clazz.ancestors.include?(Clamp::Command) &&
         clazz.respond_to?(:subcommand_name) && clazz.respond_to?(:subcommand_description)
        subcommand clazz.subcommand_name, clazz.subcommand_description, clazz
      end
    end
    
    option ["-v", "--version"], :flag, "print version" do
      puts Rubber.version
      exit 0
    end
    
  end
  
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
rubber-3.2.2 lib/rubber/cli.rb
rubber-3.2.1 lib/rubber/cli.rb
rubber-3.2.0 lib/rubber/cli.rb
rubber-3.1.0 lib/rubber/cli.rb
rubber-3.0.1 lib/rubber/cli.rb
rubber-3.0.0 lib/rubber/cli.rb
rubber-2.16.0 lib/rubber/cli.rb
rubber-2.15.2 lib/rubber/cli.rb
rubber-2.15.1 lib/rubber/cli.rb
rubber-2.15.0 lib/rubber/cli.rb
rubber-2.14.0 lib/rubber/cli.rb
rubber-2.13.1 lib/rubber/cli.rb
rubber-2.13.0 lib/rubber/cli.rb