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.12.2 lib/rubber/cli.rb
rubber-2.12.1 lib/rubber/cli.rb
rubber-2.12.0 lib/rubber/cli.rb
rubber-2.11.0 lib/rubber/cli.rb
rubber-2.10.2 lib/rubber/cli.rb
rubber-2.10.1 lib/rubber/cli.rb
rubber-2.10.0 lib/rubber/cli.rb
rubber-2.9.0 lib/rubber/cli.rb
rubber-2.8.1 lib/rubber/cli.rb
rubber-2.8.0 lib/rubber/cli.rb
rubber-2.7.5 lib/rubber/cli.rb
rubber-2.7.4 lib/rubber/cli.rb
rubber-2.7.3 lib/rubber/cli.rb
rubber-2.7.2 lib/rubber/cli.rb
rubber-2.7.1 lib/rubber/cli.rb
rubber-2.7.0 lib/rubber/cli.rb
rubber-2.6.5 lib/rubber/cli.rb
rubber-2.6.4 lib/rubber/cli.rb
rubber-2.6.3 lib/rubber/cli.rb
rubber-2.6.2 lib/rubber/cli.rb