Sha256: ad6237ca5eb2c655924e6c1353e520372d61c8373c7872b56a0346cc39ac88b2

Contents?: true

Size: 708 Bytes

Versions: 36

Compression:

Stored size: 708 Bytes

Contents

require 'optparse'
class Rack::App::CLI

  require 'rack/app/cli/fetcher'
  require 'rack/app/cli/command'
  require 'rack/app/cli/default_commands'
  require 'rack/app/cli/runner'

  class << self

    def start(argv)
      runner.start(argv)
    end

    def runner
      Rack::App::CLI::Runner.new(rack_app)
    end

    def rack_app
      Rack::App::CLI::Fetcher.rack_app
    end

  end

  def merge!(cli)
    commands.merge!(cli.commands)
    self
  end

  def commands
    @commands ||= {}
  end

  protected

  def command(name, &block)
    command_prototype = Class.new(Rack::App::CLI::Command)
    command_prototype.class_exec(&block)
    commands[name.to_s.to_sym]= command_prototype.new
  end

end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
rack-app-11.0.2 lib/rack/app/cli.rb
rack-app-11.0.1 lib/rack/app/cli.rb
rack-app-11.0.0 lib/rack/app/cli.rb
rack-app-10.0.0 lib/rack/app/cli.rb
rack-app-9.0.0 lib/rack/app/cli.rb
rack-app-8.1.0 lib/rack/app/cli.rb
rack-app-8.0.1 lib/rack/app/cli.rb
rack-app-8.0.0 lib/rack/app/cli.rb
mountapi-0.11.1 vendor/bundle/ruby/2.7.0/gems/rack-app-7.7.0/lib/rack/app/cli.rb
rack-app-7.7.0 lib/rack/app/cli.rb
rack-app-7.6.5 lib/rack/app/cli.rb
rack-app-7.6.4 lib/rack/app/cli.rb
rack-app-7.6.3 lib/rack/app/cli.rb
rack-app-7.6.2 lib/rack/app/cli.rb
rack-app-7.6.1 lib/rack/app/cli.rb
rack-app-7.6.0 lib/rack/app/cli.rb
rack-app-7.5.2 lib/rack/app/cli.rb
rack-app-7.5.1 lib/rack/app/cli.rb
rack-app-7.5.0 lib/rack/app/cli.rb
rack-app-7.4.0 lib/rack/app/cli.rb