Sha256: 5bea8b07a53f8055569bb06ae18b99cfe8bc81beca22f139462b4b35b98d16b4

Contents?: true

Size: 1.62 KB

Versions: 8

Compression:

Stored size: 1.62 KB

Contents

require_relative 'abstract_migration_generator'

class Sufia::Models::Upgrade400Generator < Sufia::Models::AbstractMigrationGenerator
  source_root File.expand_path('../templates', __FILE__)

  desc """
This generator for upgrading sufia-models from 3.7.2 to 4.0 makes the following changes to your application:
 1. Creates several database migrations if they do not exist in /db/migrate
 2. Runs the mailboxer upgrade generator
 3. Adds analytics to the sufia.rb configuration file
 4. Runs full-text generator
       """

  def banner
    say_status("info", "UPGRADING SUFIA MODELS", :blue)
  end

  # Setup the database migrations
  def copy_migrations
    [
      'create_tinymce_assets.rb',
      'create_content_blocks.rb',
      'create_featured_works.rb'
    ].each do |file|
      better_migration_template file
    end
  end

  # Upgrade mailboxer
  def install_mailboxer
    generate "mailboxer:namespacing_compatibility"
    generate "mailboxer:install -s"
  end

  # Add config file for Google Analytics
  def add_analytics_config
    copy_file 'config/analytics.yml', 'config/analytics.yml'
  end

  # Add Google Analytics option to Sufia config
  def inject_analytics_initializer
    inject_into_file 'config/initializers/sufia.rb', after: /^Sufia\.config do.*$/ do
      "\n  # Enable displaying usage statistics in the UI\n" +
        "  # Defaults to FALSE\n" +
        "  # Requires a Google Analytics id and OAuth2 keyfile.  See README for more info\n" +
        "  #config.analytics = false\n"
    end
  end

  # Sets up full-text indexing (Solr config + jars)
  def full_text_indexing
    generate "sufia:models:fulltext"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-models-6.7.0 lib/generators/sufia/models/upgrade400_generator.rb
sufia-models-6.6.1 lib/generators/sufia/models/upgrade400_generator.rb
sufia-models-6.6.0 lib/generators/sufia/models/upgrade400_generator.rb
sufia-models-6.5.0 lib/generators/sufia/models/upgrade400_generator.rb
sufia-models-6.4.0 lib/generators/sufia/models/upgrade400_generator.rb
sufia-models-6.3.0 lib/generators/sufia/models/upgrade400_generator.rb
sufia-models-6.2.0 lib/generators/sufia/models/upgrade400_generator.rb
sufia-models-6.1.0 lib/generators/sufia/models/upgrade400_generator.rb