Sha256: 41f660aba6e5635ed6469fce8c14e360287b67dca85cfc06e24e69fb9a63ffab

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

require 'thor'

module Grapethor
  class CLI < Thor
    include Thor::Actions
    include Grapethor::Utils

    check_unknown_options!

    def self.exit_on_failure?
      true
    end


    desc 'version', 'Displays Grapethor version'
    map %w[-v --version] => :version
    def version
      say "Grapethor #{VERSION}"
    end


    # register(class_name, subcommand_alias, usage_list_string, description_string, options={})
    register(Grapethor::New, 'new', 'new NAME', 'Creates new Grape application', options)
    commands['new'].options = Grapethor::New.class_options

    register(Grapethor::Api, 'api', 'api VERSION', 'Creates new API within application', options)
    commands['api'].options = Grapethor::Api.class_options

    register(Grapethor::Endpoint, 'endpoint', 'endpoint RESOURCE [NAME]', 'Creates new Endpoint within API', options)
    commands['endpoint'].options = Grapethor::Endpoint.class_options

    register(Grapethor::Resource, 'resource', 'resource NAME', 'Creates new Resource within API', options)
    commands['resource'].options = Grapethor::Resource.class_options
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
grapethor-0.2.3 lib/grapethor/generators/cli.rb
grapethor-0.2.2 lib/grapethor/generators/cli.rb
grapethor-0.2.1 lib/grapethor/generators/cli.rb
grapethor-0.2.0 lib/grapethor/generators/cli.rb