Sha256: 02034fd66d21a2319d300a82509f54a293a9bb645e8a74a88fdd744ceb204b92

Contents?: true

Size: 1.36 KB

Versions: 13

Compression:

Stored size: 1.36 KB

Contents

# -*- encoding : utf-8 -*-
# Copy Blacklight assets to public folder in current app. 
# If you want to do this on application startup, you can
# add this next line to your one of your environment files --
# generally you'd only want to do this in 'development', and can
# add it to environments/development.rb:
#       require File.join(Blacklight.root, "lib", "generators", "blacklight", "assets_generator.rb")
#       Blacklight::Assets.start(["--force", "--quiet"])


# Need the requires here so we can call the generator from environment.rb
# as suggested above. 
require 'rails/generators'
require 'rails/generators/base'
module Blacklight
  class Assets < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
  
    def assets
      copy_file "blacklight.css.scss", "app/assets/stylesheets/blacklight.css.scss"

      unless IO.read("app/assets/javascripts/application.js").include?('blacklight/blacklight')
        marker = IO.read("app/assets/javascripts/application.js").include?('turbolinks') ?
          '//= require turbolinks' : "//= require jquery_ujs"
        insert_into_file "app/assets/javascripts/application.js", :after => marker do
  %q{
//
// Required by Blacklight
//= require blacklight/blacklight}          
        end
      end

      directory("../../../../app/assets/images/blacklight", "app/assets/images/blacklight")
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
blacklight-4.9.0 lib/generators/blacklight/assets_generator.rb
blacklight-4.8.0 lib/generators/blacklight/assets_generator.rb
blacklight-4.7.0 lib/generators/blacklight/assets_generator.rb
blacklight-4.7.0.pre1 lib/generators/blacklight/assets_generator.rb
blacklight-4.6.3 lib/generators/blacklight/assets_generator.rb
blacklight-4.6.2 lib/generators/blacklight/assets_generator.rb
blacklight-4.6.1 lib/generators/blacklight/assets_generator.rb
blacklight-4.6.0 lib/generators/blacklight/assets_generator.rb
blacklight-4.5.0 lib/generators/blacklight/assets_generator.rb
blacklight-4.5.0.rc1 lib/generators/blacklight/assets_generator.rb
blacklight-4.4.2 lib/generators/blacklight/assets_generator.rb
blacklight-4.4.1 lib/generators/blacklight/assets_generator.rb
blacklight-4.4.0 lib/generators/blacklight/assets_generator.rb