Sha256: b7819d35103b8878890adee822c841f51ffa2fd0d4178d09b39a8847f0325c84

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

require 'rails/generators'

module Umlaut
  class AssetHooks < Rails::Generators::Base
    
    def add_to_stylesheet_manifest
      unless IO.read("app/assets/stylesheets/application.css").include?('Umlaut')
        insert_into_file "app/assets/stylesheets/application.css", :after => "/*" do
          %q{ 
 * The base Umlaut styles:
 *= require 'umlaut'         
          }
        end
        append_to_file("app/assets/stylesheets/application.css") do
          %q{
          
  /* Umlaut needs a jquery-ui theme CSS. Here's an easy way to get one,
     you can replace with another theme. */
  @import url(http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-lightness/jquery-ui.css);
          }
        end
      else
        say_status("skipped", "Your application.css already references Umlaut", :yellow)
      end
    end
    
    def add_to_javascript_manifest
      unless IO.read("app/assets/javascripts/application.js").include?('Umlaut')
        prepend_to_file "app/assets/javascripts/application.js" do
          %q{
 // Umlaut javascript required for proper functionality. The 'umlaut' file
 // also forces require of jquery and jquery-ui, dependencies. 
 //= require 'umlaut'          
          }           
        end
      else
        say_status("skipped", "Your application.js already references Umlaut", :yellow)
      end
        
    end
    
    
  end  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
umlaut-3.0.0alpha6 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-3.0.0alpha5 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-3.0.0alpha4 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-3.0.0alpha3 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-3.0.0alpha2 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-3.0.0alpha1 lib/generators/umlaut/asset_hooks_generator.rb