Sha256: 9cc549468e1327980ca8ab4a349de74db7b34fd18340a120906f00bdace5411f

Contents?: true

Size: 1.71 KB

Versions: 17

Compression:

Stored size: 1.71 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(Hydra.root, "lib", "generators", "hydra", "assets_generator.rb")
#       Hydra::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 Hydra
  class Assets < Rails::Generators::Base
    source_root File.expand_path('../templates', __FILE__)
  
    def assets
      if use_asset_pipeline?
        insert_into_file "app/assets/stylesheets/application.css", :after => " *= require_self" do
%q{
 *
 * Required by Hydra
 *= require 'hydra/styles'         
}
        end

        insert_into_file "app/assets/javascripts/application.js", :after => "//= require jquery_ujs" do
%q{
// Required by Hydra
//= require 'jquery.hydraMetadata.js'         
//= require 'jquery.ui.datepicker.js'      
}          
        end
        directory("../../../../app/assets/images/blacklight", "public/images/blacklight")
      else
        # directories are relative to the source_root 
        directory("../../../../assets/images", "public/images")
        directory("../../../../assets/stylesheets", "public/stylesheets") 
        directory("../../../../assets/javascripts", "public/javascripts") 
      end
    end

    private
    def use_asset_pipeline?
      (Rails::VERSION::MAJOR >= 3 and Rails::VERSION::MINOR >= 1) and Rails.application.config.assets.enabled
    end
    
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
hydra-head-3.1.4 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.3 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.2 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.1 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0.rc2 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0.rc1 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0.pre5 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0.pre4 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0.pre3 lib/generators/hydra/assets_generator.rb
hydra-head-3.0.1 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0.pre2 lib/generators/hydra/assets_generator.rb
hydra-head-3.0.0 lib/generators/hydra/assets_generator.rb
hydra-head-3.1.0.pre1 lib/generators/hydra/assets_generator.rb
hydra-head-3.0.0.rc2 lib/generators/hydra/assets_generator.rb
hydra-head-3.0.0.rc1 lib/generators/hydra/assets_generator.rb
hydra-head-3.0.0pre4 lib/generators/hydra/assets_generator.rb