Sha256: 59a8d6930c32396b85c0e273169433a5e290ff0c9a689623f8e3e9d82ec3d5b2

Contents?: true

Size: 987 Bytes

Versions: 3

Compression:

Stored size: 987 Bytes

Contents

require 'eucalypt/eucalypt-generate/namespaces/generate-controller/generators/controller'
require 'eucalypt/app'
require 'eucalypt/errors'
require 'eucalypt/helpers'

module Eucalypt
  class Generate < Thor
    include Eucalypt::Helpers
    using Colorize
    option :spec, type: :boolean, default: true, desc: "Include a controller spec file"
    option :rest, aliases: '-r', type: :boolean, default: false,  desc: "Generate REST routes for the controller"
    desc "controller [NAME]", "Generates a controller".colorize(:grey)
    def controller(name)
      directory = File.expand_path('.')
      if Eucalypt.app? directory
        controller = Eucalypt::Generators::Controller.new
        controller.destination_root = directory
        controller.generate(
          name: name,
          spec: options[:spec],
          rest: options[:rest],
          policy: false,
          headless: false
        )
      else
        Eucalypt::Error.wrong_directory
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eucalypt-0.2.2 lib/eucalypt/eucalypt-generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.2.1 lib/eucalypt/eucalypt-generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.2.0 lib/eucalypt/eucalypt-generate/namespaces/generate-controller/cli/generate-controller.rb