Sha256: 027f0d981590799a773e6eda83f749d002e27c253d163a28be2c3444d0596f1c

Contents?: true

Size: 775 Bytes

Versions: 62

Compression:

Stored size: 775 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
    command_classes = []
    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

62 entries across 62 versions & 1 rubygems

Version Path
rubber-2.6.1 lib/rubber/cli.rb
rubber-2.6.0 lib/rubber/cli.rb
rubber-2.5.5 lib/rubber/cli.rb
rubber-2.5.4 lib/rubber/cli.rb
rubber-2.5.3 lib/rubber/cli.rb
rubber-2.5.2 lib/rubber/cli.rb
rubber-2.5.1 lib/rubber/cli.rb
rubber-2.5.0 lib/rubber/cli.rb
rubber-2.4.2 lib/rubber/cli.rb
rubber-2.4.1 lib/rubber/cli.rb
rubber-2.4.0 lib/rubber/cli.rb
rubber-2.3.1 lib/rubber/cli.rb
rubber-2.3.0 lib/rubber/cli.rb
rubber-2.2.4 lib/rubber/cli.rb
rubber-2.2.3 lib/rubber/cli.rb
rubber-2.2.2 lib/rubber/cli.rb
rubber-2.2.1 lib/rubber/cli.rb
rubber-2.2.0 lib/rubber/cli.rb
rubber-2.1.2 lib/rubber/cli.rb
rubber-2.1.1 lib/rubber/cli.rb