Sha256: d97383d96051a70994fd7296288e49cbe650c7813550924db36250f39e6194a9

Contents?: true

Size: 737 Bytes

Versions: 5

Compression:

Stored size: 737 Bytes

Contents

module Spline

  require 'thor'
  Dir["#{File.dirname(__FILE__)}/commands/concrete_commands/*.rb"].each { |file| require_relative file }

  class SplineCli < Thor

    # Retrieve all classes from the Spline module that end with Command except Spline::Command abstract class
    # Register all those classes so they are available in the terminal as commands.
    # register(class_name, subcommand_alias, usage_list_string, description_string)
    commands = Spline.constants.select { |c| c.match(/\w+Command/) && Spline.const_get(c).is_a?(Class) }
    commands.each do |command|
      commandClass = Spline.const_get(command)
      register(commandClass, commandClass.alias, commandClass.usage, commandClass.description)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
spline-0.1.2 lib/spline/spline_cli.rb
spline-0.1.1 lib/spline/spline_cli.rb
spline-0.1.0 lib/spline/spline_cli.rb
spline-0.0.19 lib/spline/spline_cli.rb
spline-0.0.18 lib/spline/spline_cli.rb