cdn_sumo_sprockets_rails2 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,24 @@
|
|
1
|
+
require 'sprockets'
|
2
|
+
|
3
|
+
module CdnSumoSprockets
|
4
|
+
def self.new
|
5
|
+
sprockets = Sprockets::Environment.new
|
6
|
+
sprockets.append_path(File.join('.', "app/assets/javascripts"))
|
7
|
+
sprockets.append_path(File.join('.', "app/assets/stylesheets"))
|
8
|
+
sprockets.append_path(File.join('.', "app/assets/images"))
|
9
|
+
sprockets
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.root
|
13
|
+
Pathname.new('.')
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.public_path
|
17
|
+
root.join("public")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
1
22
|
require 'cdn_sumo_sprockets_rails2/rails2/asset_helpers'
|
2
23
|
require 'cdn_sumo_sprockets_rails2/rails2/asset_pipeline'
|
3
24
|
require 'cdn_sumo_sprockets_rails2/rails2/middleware'
|
@@ -13,4 +34,4 @@ if defined?(ActionController)
|
|
13
34
|
"#{request.protocol}#{request.host_with_port}"
|
14
35
|
end
|
15
36
|
}
|
16
|
-
end
|
37
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'sprockets'
|
2
1
|
|
3
2
|
module Rails
|
4
3
|
class << self
|
@@ -7,15 +6,11 @@ module Rails
|
|
7
6
|
end
|
8
7
|
|
9
8
|
def initialize_pipeline
|
10
|
-
sprockets =
|
11
|
-
sprockets.append_path(File.join(Rails.root, "app/assets/javascripts"))
|
12
|
-
sprockets.append_path(File.join(Rails.root, "app/assets/stylesheets"))
|
13
|
-
sprockets.append_path(File.join(Rails.root, "app/assets/images"))
|
14
|
-
|
9
|
+
sprockets = CdnSumoSprockets.new
|
15
10
|
sprockets.context_class.instance_eval do
|
16
11
|
include ActionView::Helpers
|
17
12
|
end
|
18
13
|
sprockets
|
19
14
|
end
|
20
15
|
end
|
21
|
-
end
|
16
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require "fileutils"
|
4
4
|
require 'pathname'
|
5
5
|
require 'sprockets'
|
6
|
+
require 'cdn_sumo_sprockets_rails2'
|
6
7
|
|
7
8
|
namespace :assets do
|
8
9
|
def ruby_rake_task(task, fork = true)
|
@@ -36,12 +37,9 @@ namespace :assets do
|
|
36
37
|
namespace :precompile do
|
37
38
|
def internal_precompile(digest = nil)
|
38
39
|
|
39
|
-
|
40
|
-
# sprockets hooks get executed
|
41
|
-
_ = ActionView::Base
|
42
|
-
base_dir = Rails.root.join("public", "assets")
|
40
|
+
base_dir = CdnSumoSprockets.root.join("public", "assets")
|
43
41
|
manifest_file = base_dir.join("manifest.json")
|
44
|
-
sprockets =
|
42
|
+
sprockets = CdnSumoSprockets.new
|
45
43
|
manifest = Sprockets::Manifest.new(sprockets, manifest_file)
|
46
44
|
manifest.compile
|
47
45
|
|
@@ -74,12 +72,12 @@ namespace :assets do
|
|
74
72
|
|
75
73
|
namespace :clean do
|
76
74
|
task :all => ["assets:environment", "tmp:cache:clear"] do
|
77
|
-
public_asset_path =
|
75
|
+
public_asset_path = CdnSumoSprockets.public_path.join("assets")
|
78
76
|
rm_rf public_asset_path, :secure => true
|
79
77
|
end
|
80
78
|
end
|
81
79
|
|
82
80
|
task :environment do
|
83
|
-
Rake::Task["environment"].invoke
|
81
|
+
#Rake::Task["environment"].invoke
|
84
82
|
end
|
85
83
|
end
|