Sha256: 4bcdd33011afdc2978478eae43473fba4e550c189f0084114ffabd53aecf8358

Contents?: true

Size: 978 Bytes

Versions: 21

Compression:

Stored size: 978 Bytes

Contents

require '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

21 entries across 21 versions & 1 rubygems

Version Path
eucalypt-0.8.0 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.7.2 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.7.1 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.7.0 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.6.2 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.6.1 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.6.0 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.5.4 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.5.3 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.5.2 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.5.1 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.5.0 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.4.2 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.4.1 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.4.0 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.3.5 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.3.4 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.3.3 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.3.2 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb
eucalypt-0.3.1 lib/eucalypt/generate/namespaces/generate-controller/cli/generate-controller.rb