Sha256: a5986b5bb171f4e41c26e31b2519d3aa7bc04bbeb93a656f67bfeb64e33e5766

Contents?: true

Size: 1.78 KB

Versions: 16

Compression:

Stored size: 1.78 KB

Contents

require 'thor'
require 'gris/generators'
require 'gris/version'

Gris.load_environment if defined?(Dotenv)

module Gris
  class CLI
    class Generate < Thor
      register(
        Generators::ApiGenerator,
        'api',
        'api <api_name>',
        'Create a Grape API, Model and Presenter'
      )

      register(
        Generators::MigrationGenerator,
        'migration',
        'migration <migration_name> [field[:type][:index] field[:type][:index]]',
        'Create a Database Migration'
      )
    end
  end
  class CLI
    class Base < Thor
      desc 'version', 'Returns the Gris version number'
      def version
        say Gris::VERSION
      end

      desc 'console [environment]', 'Start the Gris console'
      options aliases: 'c'
      def console(environment = nil)
        ENV['RACK_ENV'] = environment || 'development'

        require 'racksh/init'

        begin
          require 'pry'
          interpreter = Pry
        rescue LoadError
          require 'irb'
          require 'irb/completion'
          interpreter = IRB
          # IRB uses ARGV and does not expect these arguments.
          ARGV.delete('console')
          ARGV.delete(environment) if environment
        end

        Rack::Shell.init

        $0 = "#{$PROGRAM_NAME} console"
        interpreter.start
      end

      register(
        Generators::ScaffoldGenerator,
        'new',
        'new <app_name> [app_path]',
        'Creates a scaffold for a new Gris service'
      )

      desc 'generate api <api_name>', 'Create a Grape API, Model and Representer'
      subcommand 'generate api', Gris::CLI::Generate

      desc 'generate migration <migration_name> [field[:type][:index] field[:type][:index]]', 'Create a Database Migration'
      subcommand 'generate', Gris::CLI::Generate
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gris-0.1.7 lib/gris/cli.rb
gris-0.1.6 lib/gris/cli.rb
gris-0.1.5 lib/gris/cli.rb
gris-0.1.4 lib/gris/cli.rb
gris-0.1.3 lib/gris/cli.rb
gris-0.1.2 lib/gris/cli.rb
gris-0.1.1 lib/gris/cli.rb
gris-0.1.0 lib/gris/cli.rb
gris-0.0.9 lib/gris/cli.rb
gris-0.0.8 lib/gris/cli.rb
gris-0.0.7 lib/gris/cli.rb
gris-0.0.6 lib/gris/cli.rb
gris-0.0.5 lib/gris/cli.rb
gris-0.0.4 lib/gris/cli.rb
gris-0.0.3 lib/gris/cli.rb
gris-0.0.2 lib/gris/cli.rb