Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Rails 2 and 3 Integration
  • Loading branch information
Peter Wagenet committed Nov 26, 2011
1 parent 105c571 commit 2580cd8
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/rake-pipeline.rb
Expand Up @@ -4,6 +4,13 @@
require "rake-pipeline/dsl" require "rake-pipeline/dsl"
require "rake-pipeline/matcher" require "rake-pipeline/matcher"
require "rake-pipeline/error" require "rake-pipeline/error"

if defined?(Rails::Railtie)
require "rake-pipeline/railtie"
elsif defined?(Rails)
require "rake-pipeline/rails_plugin"
end

require "thread" require "thread"


# Use the Rake namespace # Use the Rake namespace
Expand Down
8 changes: 8 additions & 0 deletions lib/rake-pipeline/rails_plugin.rb
@@ -0,0 +1,8 @@
require 'rake-pipeline/middleware'

Rails.configuration.after_initialize do
if defined?(RAKEP_ENABLED) && RAKEP_ENABLED
assetfile = defined?(RAKEP_ASSETFILE) ? RAKEP_ASSETFILE : 'Assetfile'
Rails.configuration.middleware.use(Rake::Pipeline::Middleware, assetfile)
end
end
14 changes: 14 additions & 0 deletions lib/rake-pipeline/railtie.rb
@@ -0,0 +1,14 @@
module Rake
class Pipeline
class Railtie < ::Rails::Railtie
config.rake_pipeline_enabled = false
config.rake_pipeline_assetfile = File.join(RAILS_ROOT, 'Assetfile')

initializer do |app|
if config.rake_pipeline_enabled
config.middleware.use(Rake::Pipeline::Middleware, config.rake_pipeline_assetfile)
end
end
end
end
end
2 changes: 2 additions & 0 deletions rails/init.rb
@@ -0,0 +1,2 @@
# For Rails 2
require 'rake-pipeline'

0 comments on commit 2580cd8

Please sign in to comment.