assets-compiler 0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/assets-compiler.rb +1 -2
- data/lib/assets/compiler.rb +12 -1
- data/lib/assets/compiler/javascript.rb +2 -0
- data/lib/assets/compiler/plugin/rails.rb +22 -21
- data/lib/assets/compiler/version.rb +1 -1
- metadata +4 -4
data/lib/assets-compiler.rb
CHANGED
@@ -1,2 +1 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require 'assets/compiler'
|
data/lib/assets/compiler.rb
CHANGED
@@ -1,10 +1,19 @@
|
|
1
|
+
require 'assets/compiler/checker'
|
2
|
+
require 'assets/compiler/base'
|
3
|
+
require 'assets/compiler/javascript'
|
4
|
+
require 'assets/compiler/plugin/rack'
|
5
|
+
require 'assets/compiler/plugin/rails'
|
6
|
+
|
1
7
|
module Assets
|
2
8
|
module Compiler
|
3
9
|
extend self
|
4
10
|
|
5
11
|
attr_accessor :config, :compilers
|
6
12
|
|
7
|
-
DEFAULTS = {
|
13
|
+
DEFAULTS = {
|
14
|
+
:compilers => {},
|
15
|
+
:always_check => false
|
16
|
+
}
|
8
17
|
|
9
18
|
def init!(options)
|
10
19
|
self.config = options.reverse_merge(DEFAULTS)
|
@@ -14,6 +23,8 @@ module Assets
|
|
14
23
|
compilers << Base.create(key, paths)
|
15
24
|
end
|
16
25
|
|
26
|
+
Plugin::Rails.extend! if defined?(RAILS_GEM_VERSION) && config[:always_check]
|
27
|
+
|
17
28
|
compile!
|
18
29
|
end
|
19
30
|
|
@@ -1,25 +1,26 @@
|
|
1
1
|
# Taken from nex3 sass
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
Rails.configuration.middleware.use(Assets::Compiler::Plugin::Rack)
|
2
|
+
module Assets
|
3
|
+
module Compiler
|
4
|
+
module Plugin
|
5
|
+
module Rails
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
def self.extend!
|
8
|
+
# Rails >= 3.0
|
9
|
+
if defined?(ActionController::Metal)
|
10
|
+
require 'assets/compiler/plugin/rack'
|
11
|
+
Rails.configuration.middleware.use(Assets::Compiler::Plugin::Rack)
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
# Rails >= 2.3
|
14
|
+
elsif defined?(ActionController::Dispatcher) && defined?(ActionController::Dispatcher.middleware)
|
15
|
+
require 'assets/compiler/plugin/rack'
|
16
|
+
ActionController::Dispatcher.middleware.use(Assets::Compiler::Plugin::Rack)
|
17
|
+
|
18
|
+
else
|
19
|
+
raise StandardError, 'This version of rails is not supported'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
25
26
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assets-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 2
|
9
|
+
version: "0.2"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jonathan Tropper
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-22 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|