Sha256: 3d41c4b048509eafacca16c5a11aa51b52db77dbde4b1ce3bbd81d4a0bc42764

Contents?: true

Size: 1.54 KB

Versions: 16

Compression:

Stored size: 1.54 KB

Contents

# encoding: utf-8

module Adhearsion
  module Generators
    class PluginGenerator < Generator

      argument :plugin_name, :type => :string

      def self.short_desc
        "A plugin template. 'plugin_name' should be the disired plugin module name, either CamelCase or under_scored."
      end

      def create_plugin
        @plugin_file = @plugin_name.underscore
        @plugin_name = @plugin_name.camelize
        self.destination_root = '.'

        empty_directory @plugin_file
        empty_directory "#{@plugin_file}/lib"
        empty_directory "#{@plugin_file}/lib/#{@plugin_file}"
        empty_directory "#{@plugin_file}/spec"

        template 'plugin-template.gemspec.tt', "#{@plugin_file}/#{@plugin_file}.gemspec"
        template 'Rakefile.tt', "#{@plugin_file}/Rakefile"
        template 'README.md.tt', "#{@plugin_file}/README.md"
        template 'Gemfile.tt', "#{@plugin_file}/Gemfile"

        template 'lib/plugin-template.rb.tt', "#{@plugin_file}/lib/#{@plugin_file}.rb"
        template 'lib/plugin-template/version.rb.tt', "#{@plugin_file}/lib/#{@plugin_file}/version.rb"
        template 'lib/plugin-template/plugin.rb.tt', "#{@plugin_file}/lib/#{@plugin_file}/plugin.rb"
        template 'lib/plugin-template/controller_methods.rb.tt', "#{@plugin_file}/lib/#{@plugin_file}/controller_methods.rb"

        template 'spec/spec_helper.rb.tt', "#{@plugin_file}/spec/spec_helper.rb"
        template 'spec/plugin-template/controller_methods_spec.rb.tt', "#{@plugin_file}/spec/#{@plugin_file}/controller_methods_spec.rb"
      end

    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
adhearsion-2.4.0 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.4.0.beta3 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.4.0.beta2 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.4.0.beta1 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.3.5 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.3.4 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.3.3 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.3.2 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.3.1 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.3.0 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.2.1 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.2.0 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.1.3 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.1.2 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.1.1 lib/adhearsion/generators/plugin/plugin_generator.rb
adhearsion-2.1.0 lib/adhearsion/generators/plugin/plugin_generator.rb