Sha256: cdde428bd1b20b53b44895dd8210b212f496c42000b045a292e81c2ec88f8aad

Contents?: true

Size: 921 Bytes

Versions: 17

Compression:

Stored size: 921 Bytes

Contents

module EffectiveTrash
  module Generators
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      desc 'Creates an EffectiveTrash initializer in your application.'

      source_root File.expand_path('../../templates', __FILE__)

      def self.next_migration_number(dirname)
        if not ActiveRecord::Base.timestamped_migrations
          Time.new.utc.strftime("%Y%m%d%H%M%S")
        else
          "%.3d" % (current_migration_number(dirname) + 1)
        end
      end

      def copy_initializer
        template ('../' * 3) + 'config/effective_trash.rb', 'config/initializers/effective_trash.rb'
      end

      def create_migration_file
        @trash_table_name = ':' + EffectiveTrash.trash_table_name.to_s

        migration_template ('../' * 3) + 'db/migrate/01_create_effective_trash.rb.erb', 'db/migrate/create_effective_trash.rb'
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
effective_trash-0.4.5 lib/generators/effective_trash/install_generator.rb
effective_trash-0.4.4 lib/generators/effective_trash/install_generator.rb
effective_trash-0.4.3 lib/generators/effective_trash/install_generator.rb
effective_trash-0.4.2 lib/generators/effective_trash/install_generator.rb
effective_trash-0.4.1 lib/generators/effective_trash/install_generator.rb
effective_trash-0.4.0 lib/generators/effective_trash/install_generator.rb
effective_trash-0.3.3 lib/generators/effective_trash/install_generator.rb
effective_trash-0.3.2 lib/generators/effective_trash/install_generator.rb
effective_trash-0.3.1 lib/generators/effective_trash/install_generator.rb
effective_trash-0.3.0 lib/generators/effective_trash/install_generator.rb
effective_trash-0.2.6 lib/generators/effective_trash/install_generator.rb
effective_trash-0.2.5 lib/generators/effective_trash/install_generator.rb
effective_trash-0.2.4 lib/generators/effective_trash/install_generator.rb
effective_trash-0.2.3 lib/generators/effective_trash/install_generator.rb
effective_trash-0.2.2 lib/generators/effective_trash/install_generator.rb
effective_trash-0.2.1 lib/generators/effective_trash/install_generator.rb
effective_trash-0.2.0 lib/generators/effective_trash/install_generator.rb