assets-compiler 0.1 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1 @@
1
- Dir.glob(File.join(File.dirname(__FILE__), 'assets', '**', '*.rb')).each { |source| require source }
2
-
1
+ require 'assets/compiler'
@@ -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,3 +1,5 @@
1
+ require 'closure-compiler'
2
+
1
3
  module Assets
2
4
  module Compiler
3
5
  class Javascript < Base
@@ -1,25 +1,26 @@
1
1
  # Taken from nex3 sass
2
- if defined?(Rails)
3
- # Rails >= 3.0
4
- if defined?(ActionController::Metal)
5
- require 'assets/compiler/plugin/rack'
6
- Rails.configuration.middleware.use(Assets::Compiler::Plugin::Rack)
2
+ module Assets
3
+ module Compiler
4
+ module Plugin
5
+ module Rails
7
6
 
8
- # Rails >= 2.3
9
- elsif defined?(ActionController::Dispatcher) && defined?(ActionController::Dispatcher.middleware)
10
- require 'assets/compiler/plugin/rack'
11
- ActionController::Dispatcher.middleware.use(Assets::Compiler::Plugin::Rack)
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
- else
14
- module ActionController
15
- class Base
16
- alias_method :sass_old_process, :process
17
- def process(*args)
18
- Sass::Plugin.check_for_updates
19
- Assets::Compiler.compile!
20
- sass_old_process(*args)
21
- end
22
- end
23
- end
24
- end
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
@@ -1,5 +1,5 @@
1
1
  module Assets
2
2
  module Compiler
3
- VERSION = "0.1"
3
+ VERSION = "0.2"
4
4
  end
5
5
  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: 9
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
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-11 00:00:00 -08:00
17
+ date: 2011-02-22 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency