Sha256: feedc117c794b46982871b47aa3bb51642257dd9764f221bb2b71ee4e66dcd26

Contents?: true

Size: 805 Bytes

Versions: 12

Compression:

Stored size: 805 Bytes

Contents

# -*- encoding : utf-8 -*-

require 'rails/generators'

class Hyrax::AssetsGenerator < Rails::Generators::Base
  desc """
    This generator installs the hyrax CSS assets into your application
       """

  source_root File.expand_path('../templates', __FILE__)

  def remove_blacklight_css
    remove_file "app/assets/stylesheets/blacklight.scss"
  end

  def inject_css
    copy_file "hyrax.scss", "app/assets/stylesheets/hyrax.scss"
  end

  def inject_js
    return if hyrax_javascript_installed?
    insert_into_file 'app/assets/javascripts/application.js', after: '//= require_tree .' do
      <<-EOF.strip_heredoc

        //= require hyrax
      EOF
    end
  end

  private

    def hyrax_javascript_installed?
      IO.read("app/assets/javascripts/application.js").include?('hyrax')
    end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
hyrax-2.0.3 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.2 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.1 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.rc3 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.rc2 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.rc1 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.beta5 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.beta4 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.beta3 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.beta2 lib/generators/hyrax/assets_generator.rb
hyrax-2.0.0.beta1 lib/generators/hyrax/assets_generator.rb