Sha256: 25f8130eba226efda789e59682805e09213a781c5d5b7de6dfd1e5de4ff17e03

Contents?: true

Size: 804 Bytes

Versions: 10

Compression:

Stored size: 804 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

10 entries across 10 versions & 2 rubygems

Version Path
hyrax-1.1.1 lib/generators/hyrax/assets_generator.rb
hyrax-1.1.0 lib/generators/hyrax/assets_generator.rb
hyrax-1.0.5 lib/generators/hyrax/assets_generator.rb
hyrax-1.0.4 lib/generators/hyrax/assets_generator.rb
hyrax-1.0.3 lib/generators/hyrax/assets_generator.rb
hyrax-1.0.2 lib/generators/hyrax/assets_generator.rb
hyrax-1.0.1 lib/generators/hyrax/assets_generator.rb
hyrax-1.0.0.rc2 lib/generators/hyrax/assets_generator.rb
hyrax-1.0.0.rc1 lib/generators/hyrax/assets_generator.rb
test_hyrax-0.0.1.alpha lib/generators/hyrax/assets_generator.rb