Sha256: 590a69ffd54a530ad40b140ec5ca717c0e87064e59bb6b4b7748e9d28ba67ecd

Contents?: true

Size: 782 Bytes

Versions: 12

Compression:

Stored size: 782 Bytes

Contents

# encoding: utf-8

module Adhearsion
  module Generators
    class ControllerGenerator < Generator

      argument :controller_name, :type => :string

      def self.short_desc
        "A call controller template. 'controller_name' should be the disired class name, either CamelCase or under_scored."
      end

      def create_controller
        raise Exception, "Generator commands need to be run in an Adhearsion app directory" unless ScriptAhnLoader.in_ahn_application?('.')
        self.destination_root = '.'
        empty_directory 'lib'
        empty_directory 'spec'
        template 'lib/controller.rb.erb', "lib/#{@controller_name.underscore}.rb"
        template 'spec/controller_spec.rb.erb', "spec/#{@controller_name.underscore}_spec.rb"
      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
adhearsion-2.6.4 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.6.3 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-3.0.0.rc1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-3.0.0.beta2 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-3.0.0.beta1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.6.2 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.6.1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.6.0 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.5.4 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.5.3 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.5.2 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.5.0 lib/adhearsion/generators/controller/controller_generator.rb