Sha256: 92199a98722333ab0ead8532042e576bd21bc90a17e04df7a44600573165081f

Contents?: true

Size: 774 Bytes

Versions: 20

Compression:

Stored size: 774 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', "lib/#{@controller_name.underscore}.rb"
        template 'spec/controller_spec.rb', "spec/#{@controller_name.underscore}_spec.rb"
      end

    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
adhearsion-2.4.0 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.4.0.beta3 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.4.0.beta2 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.4.0.beta1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.3.5 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.3.4 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.3.3 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.3.2 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.3.1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.3.0 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.2.1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.2.0 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.1.3 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.1.2 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.1.1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.1.0 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.0.1 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.0.0 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.0.0.rc5 lib/adhearsion/generators/controller/controller_generator.rb
adhearsion-2.0.0.rc4 lib/adhearsion/generators/controller/controller_generator.rb