Class: BlacklightOembed::Install
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- BlacklightOembed::Install
- Defined in:
- lib/generators/blacklight_oembed/install_generator.rb
Instance Method Summary collapse
- #assets ⇒ Object
- #configuration ⇒ Object
- #inject_oembed_configuration ⇒ Object
- #inject_routes ⇒ Object
Instance Method Details
#assets ⇒ Object
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 |
#configuration ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# 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 if ENV['CI_TEST_LEGACY_CONFIGURATION'].present? || Gem::Version.new(Blacklight::VERSION) < Gem::Version.new('8.0') <<-EOF config.show.oembed_field = :oembed_url_ssm config.show.partials.insert(1, :oembed) EOF else <<-EOF config.show.oembed_field = :oembed_url_ssm config.show.render_oembed_using_async_javascript = true config.show.embed_component = Blacklight::Oembed::DocumentOembedComponent EOF end end end |
#inject_oembed_configuration ⇒ Object
17 18 19 |
# File 'lib/generators/blacklight_oembed/install_generator.rb', line 17 def copy_file "oembed_providers.rb", "config/initializers/oembed_providers.rb" end |
#inject_routes ⇒ Object
13 14 15 |
# File 'lib/generators/blacklight_oembed/install_generator.rb', line 13 def inject_routes route "mount Blacklight::Oembed::Engine, at: 'oembed'" end |