Sha256: 388e1265632fe5b1647dbfd42fba84d0b116380f9fdfea6e35be283cc80c4c11

Contents?: true

Size: 1.24 KB

Versions: 51

Compression:

Stored size: 1.24 KB

Contents

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

      desc "Creates an EffectiveAssets 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 "effective_assets.rb", "config/initializers/effective_assets.rb"
      end

      def copy_uploader
        template "asset_uploader.rb", "app/uploaders/asset_uploader.rb"
      end

      def create_migration_file
        @assets_table_name = ':' + EffectiveAssets.assets_table_name.to_s
        @attachments_table_name = ':' + EffectiveAssets.attachments_table_name.to_s
        migration_template '../../../db/migrate/01_create_effective_assets.rb.erb', 'db/migrate/create_effective_assets.rb'
      end

      def install_delayed_jobs
        run "rails generate delayed_job:active_record"
      end

      def show_readme
        readme "README" if behavior == :invoke
      end
    end
  end
end

Version data entries

51 entries across 51 versions & 1 rubygems

Version Path
effective_assets-1.7.7 lib/generators/effective_assets/install_generator.rb
effective_assets-1.7.6 lib/generators/effective_assets/install_generator.rb
effective_assets-1.7.5 lib/generators/effective_assets/install_generator.rb
effective_assets-1.7.4 lib/generators/effective_assets/install_generator.rb
effective_assets-1.7.3 lib/generators/effective_assets/install_generator.rb
effective_assets-1.7.2 lib/generators/effective_assets/install_generator.rb
effective_assets-1.7.1 lib/generators/effective_assets/install_generator.rb
effective_assets-1.7.0 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.9 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.8 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.7 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.6 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.5 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.4 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.3 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.2 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.1 lib/generators/effective_assets/install_generator.rb
effective_assets-1.6.0 lib/generators/effective_assets/install_generator.rb
effective_assets-1.5.9 lib/generators/effective_assets/install_generator.rb
effective_assets-1.5.8 lib/generators/effective_assets/install_generator.rb