Sha256: 9e3b537c8d9ba309f4a4d13c0662af94df6612344bf52c974e734e9937e86290

Contents?: true

Size: 1.17 KB

Versions: 25

Compression:

Stored size: 1.17 KB

Contents

require 'rails/generators'

module Umlaut
  class AssetHooks < Rails::Generators::Base
    
    def add_to_stylesheet_manifest
      existing = IO.read("app/assets/stylesheets/application.css")
      unless existing.include?('Umlaut')
        after = 
          if existing.include?("require_self")
            "require_self"
          else
            "/*"
          end
          
        insert_into_file "app/assets/stylesheets/application.css", :after => after do
          %q{
 *
 * The base Umlaut styles:
 *= require 'umlaut'
 *}
        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

25 entries across 25 versions & 1 rubygems

Version Path
umlaut-4.1.7 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.6 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.5 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.4 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.3 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.2 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.1 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.0 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.0.pre3 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.0.pre.2 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.1.0.pre.alpha.1 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.3 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.2 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.1 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.0 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.0.beta5 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.0.beta4 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.0.beta3 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.0.beta2 lib/generators/umlaut/asset_hooks_generator.rb
umlaut-4.0.0.beta1 lib/generators/umlaut/asset_hooks_generator.rb