Class: BlacklightOembed::Install

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
lib/generators/blacklight_oembed/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#assetsObject



8
9
10
11
# File 'lib/generators/blacklight_oembed/install_generator.rb', line 8

def assets
  copy_file "blacklight_oembed.css.scss", "app/assets/stylesheets/blacklight_oembed.css.scss"
  copy_file "blacklight_oembed.js", "app/assets/javascripts/blacklight_oembed.js"
end

#configurationObject



21
22
23
24
25
26
27
28
29
# File 'lib/generators/blacklight_oembed/install_generator.rb', line 21

def configuration
  inject_into_file 'app/controllers/catalog_controller.rb', after: "configure_blacklight do |config|" do
    <<-EOF

      config.show.oembed_field = :oembed_url_ssm
      config.show.partials.insert(1, :oembed)
    EOF
  end
end

#inject_oembed_configurationObject



17
18
19
# File 'lib/generators/blacklight_oembed/install_generator.rb', line 17

def inject_oembed_configuration
  copy_file "oembed_providers.rb", "config/initializers/oembed_providers.rb"
end

#inject_routesObject



13
14
15
# File 'lib/generators/blacklight_oembed/install_generator.rb', line 13

def inject_routes
  route "mount Blacklight::Oembed::Engine, at: 'oembed'"
end