Sha256: fb9b98cb0aaab263f25693e841c2ded0d6243a540b4e3b85ef8a492ab7e15efb

Contents?: true

Size: 1.65 KB

Versions: 2

Compression:

Stored size: 1.65 KB

Contents

require 'rails/generators'

class TestAppGenerator < Rails::Generators::Base
  source_root "./spec/test_app_templates"

  def install_engine
    generate 'hyrax:install', '-f'
  end

  def create_generic_work
    generate 'hyrax:work GenericWork'
  end
  
  def create_atlas_work
    generate 'hyrax:work Atlas'
  end

  def comment_out_web_console
    gsub_file "Gemfile",
              "gem 'web-console'", "# gem 'web-console'"
  end

  def browse_everything_install
    generate "browse_everything:install --skip-assets"
  end

  def banner
    say_status("info", "ADDING OVERRIDES FOR TEST ENVIRONMENT", :blue)
  end

  def add_analytics_config
    append_file 'config/analytics.yml' do
      "\n" +
        "analytics:\n" +
        "  app_name: My App Name\n" +
        "  app_version: 0.0.1\n" +
        "  privkey_path: /tmp/privkey.p12\n" +
        "  privkey_secret: s00pers3kr1t\n" +
        "  client_email: oauth@example.org\n"
    end
  end

  def enable_analytics
    gsub_file "config/initializers/hyrax.rb",
              "config.analytics = false", "config.analytics = true"
  end

  def enable_i18n_translation_errors
    gsub_file "config/environments/development.rb",
              "# config.action_view.raise_on_missing_translations = true", "config.action_view.raise_on_missing_translations = true"
    gsub_file "config/environments/test.rb",
              "# config.action_view.raise_on_missing_translations = true", "config.action_view.raise_on_missing_translations = true"
  end

  def enable_arkivo_api
    generate 'hyrax:arkivo_api'
  end

  def relax_routing_constraint
    gsub_file 'config/initializers/arkivo_constraint.rb', 'false', 'true'
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
hyrax-1.0.0.rc1 spec/test_app_templates/lib/generators/test_app_generator.rb
test_hyrax-0.0.1.alpha spec/test_app_templates/lib/generators/test_app_generator.rb