lib/dynaspan.rb in dynaspan-0.1.1 vs lib/dynaspan.rb in dynaspan-0.1.2.beta1
- old
+ new
@@ -1,12 +1,32 @@
require 'dynaspan/version'
+
module Dynaspan
- case ::Rails.version.to_s
- when /^4/
- require 'dynaspan/engine'
- when /^3\.[12]/
- require 'dynaspan/engine3'
- when /^3\.[0]/
- require 'dynaspan/railtie'
+ ASSETS = %W(dynaspan/*.js dynaspan/*.css dynaspan/*.png dynaspan/*.gif dynaspan/*.html dynaspan/*.md)
+ INITIALIZER = "initializer 'dynaspan.assets.precompile', group: :all do |app| app.config.assets.precompile += Dynaspan::ASSETS; end"
+
+ class Engine < ::Rails::Engine
+ isolate_namespace Dynaspan
+
+ eval Dynaspan::INITIALIZER
+
+ initializer 'dynaspan.action_controller' do |app|
+ ActiveSupport.on_load :action_controller do
+ helper Dynaspan::ApplicationHelper
+ end
+ end
+
+ if ::Rails.version.to_s =~ /^4/
+ rake_tasks do
+ load "dynaspan/tasks.rake"
+ end
+ end
end
+
+ if ::Rails.version.to_s =~ /^3\.[0]/
+ class Railtie < ::Rails::Railtie
+ eval Dynaspan::INITIALIZER
+ end
+ end
end
+