Sha256: 490a208f385f0898da16cc363191aad499af64ad2397307d48d0daaf45524bd9

Contents?: true

Size: 1.15 KB

Versions: 8

Compression:

Stored size: 1.15 KB

Contents

require 'rails/generators'

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

  # if you need to generate any additional configuration
  # into the test app, this generator will be run immediately
  # after setting up the application

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

  def browse_everything_config
    generate "browse_everything:config"
  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/sufia.rb",
              "config.analytics = false", "config.analytics = true"
  end

  def add_sufia_assets
    insert_into_file 'app/assets/stylesheets/application.css', after: ' *= require_self' do
      "\n *= require sufia"
    end

    gsub_file 'app/assets/javascripts/application.js',
              '//= require_tree .', '//= require sufia'
  end
    
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sufia-5.0.0 spec/test_app_templates/lib/generators/test_app_generator.rb
sufia-5.0.0.rc1 spec/test_app_templates/lib/generators/test_app_generator.rb
sufia-4.3.1 spec/test_app_templates/lib/generators/test_app_generator.rb
sufia-4.2.0 spec/test_app_templates/lib/generators/test_app_generator.rb
sufia-4.1.0 spec/test_app_templates/lib/generators/test_app_generator.rb
sufia-4.0.1 spec/test_app_templates/lib/generators/test_app_generator.rb
sufia-4.0.0 spec/test_app_templates/lib/generators/test_app_generator.rb
sufia-4.0.0.rc2 spec/test_app_templates/lib/generators/test_app_generator.rb