web_assets 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/web_assets.rb +0 -1
- data/lib/web_assets/can_log.rb +34 -0
- data/lib/web_assets/client_interface.rb +11 -1
- data/lib/web_assets/runner.rb +3 -13
- data/lib/web_assets/script_processor.rb +5 -0
- data/lib/web_assets/stylesheet_processor.rb +6 -0
- data/lib/web_assets/version.rb +1 -1
- data/lib/web_assets.rb +2 -0
- data/web_assets.gemspec +5 -5
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1e6b59a404f17c63dfe51901217c05dc4585bff
|
4
|
+
data.tar.gz: fb316adc5028f2af9ce634bd09fad33037c47605
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84242383dc6ed0854dafb72cc15831feb7bb41661f2df40ccca9c04451567dc414bc2065da6742ecc29802edfa0886349018f9a551a719e29eea357762c7d7a3
|
7
|
+
data.tar.gz: ef0e77c2d0e13c725673c35364d3ad884a7357aea63a75880f26b072edc4d012fae6a4a053826cd59bbeb73607b3a3b4516ee1670a577097b76bc447c783a586
|
data/bin/web_assets.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require "logger"
|
2
|
+
|
3
|
+
module WebAssets
|
4
|
+
|
5
|
+
module CanLog
|
6
|
+
|
7
|
+
def self.included base
|
8
|
+
base.extend ClassMethods
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
|
13
|
+
def debug= value
|
14
|
+
@debug = value
|
15
|
+
end
|
16
|
+
|
17
|
+
def debug?
|
18
|
+
@debug
|
19
|
+
end
|
20
|
+
|
21
|
+
def logger
|
22
|
+
@logger ||= begin
|
23
|
+
logger = Logger.new debug? ? "web_assets.log" : STDERR
|
24
|
+
logger.level = debug? ? Logger::DEBUG : Logger::ERROR
|
25
|
+
logger
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
@@ -11,35 +11,45 @@ module WebAssets
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def listen
|
14
|
-
Kernel.receive input, output do |request|
|
14
|
+
Kernel.receive input, output do |request|
|
15
|
+
WebAssets.logger.debug "ClientInterface#listen: request = #{request.inspect}"
|
16
|
+
process request
|
17
|
+
end
|
15
18
|
end
|
16
19
|
|
17
20
|
private
|
18
21
|
|
19
22
|
def process request
|
20
23
|
request.when [:append_javascript_path, String] do |path|
|
24
|
+
WebAssets.logger.debug "ClientInterface#process: append_javascript_path = #{path.inspect}"
|
21
25
|
reply request, api.append_javascript_path(path)
|
22
26
|
end
|
23
27
|
|
24
28
|
request.when [:append_stylesheet_path, String] do |path|
|
29
|
+
WebAssets.logger.debug "ClientInterface#process: append_stylesheet_path = #{path.inspect}"
|
25
30
|
reply request, api.append_stylesheet_path(path)
|
26
31
|
end
|
27
32
|
|
28
33
|
request.when [:javascript_filenames, String] do |filename|
|
34
|
+
WebAssets.logger.debug "ClientInterface#process: javascript_filenames = #{filename.inspect}"
|
29
35
|
reply request, api.javascript_filenames(filename)
|
30
36
|
end
|
31
37
|
|
32
38
|
request.when [:javascript_content, Array] do |filename, options|
|
39
|
+
WebAssets.logger.debug "ClientInterface#process: javascript_content = #{filename.inspect}"
|
33
40
|
reply request, api.javascript_content(filename, options)
|
34
41
|
end
|
35
42
|
|
36
43
|
request.when [:stylesheet_content, Array] do |filename, options|
|
44
|
+
WebAssets.logger.debug "ClientInterface#process: stylesheet_content = #{filename.inspect}"
|
37
45
|
reply request, api.stylesheet_content(filename, options)
|
38
46
|
end
|
39
47
|
end
|
40
48
|
|
41
49
|
def reply request, response
|
50
|
+
WebAssets.logger.debug "ClientInterface#reply: #send! #{response.inspect}"
|
42
51
|
request.send! response
|
52
|
+
WebAssets.logger.debug "ClientInterface#reply: #receive_loop"
|
43
53
|
request.receive_loop
|
44
54
|
end
|
45
55
|
|
data/lib/web_assets/runner.rb
CHANGED
@@ -6,17 +6,15 @@ module WebAssets
|
|
6
6
|
|
7
7
|
def initialize arguments
|
8
8
|
options = CommandLine.new(arguments).parse
|
9
|
-
|
9
|
+
WebAssets.debug = options.fetch :debug, false
|
10
10
|
@libs = options.fetch :libs, []
|
11
11
|
end
|
12
12
|
|
13
|
-
def debug?
|
14
|
-
@debug
|
15
|
-
end
|
16
|
-
|
17
13
|
def run
|
14
|
+
WebAssets.logger.debug "Runner#run: >>>"
|
18
15
|
load_libs
|
19
16
|
listen_to_client
|
17
|
+
WebAssets.logger.debug "Runner#run: <<<"
|
20
18
|
end
|
21
19
|
|
22
20
|
private
|
@@ -31,14 +29,6 @@ module WebAssets
|
|
31
29
|
client_interface.listen
|
32
30
|
end
|
33
31
|
|
34
|
-
def logger
|
35
|
-
@logger ||= begin
|
36
|
-
logger = Logger.new debug? ? "web_assets.log" : STDERR
|
37
|
-
logger.level = debug? ? Logger::DEBUG : Logger::ERROR
|
38
|
-
logger
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
32
|
def script_processor
|
43
33
|
ScriptProcessor.new
|
44
34
|
end
|
@@ -13,12 +13,14 @@ module WebAssets
|
|
13
13
|
|
14
14
|
def set_path path
|
15
15
|
return [:error, "#{path} isn't an existing directory."] unless Dir.exists? path
|
16
|
+
WebAssets.logger.debug "ScriptProcessor#set_path #{path.inspect}"
|
16
17
|
environment.prepend_path path
|
17
18
|
:ok
|
18
19
|
end
|
19
20
|
|
20
21
|
def add_load_path path
|
21
22
|
return [:error, "#{path} isn't an existing directory."] unless Dir.exists? path
|
23
|
+
WebAssets.logger.debug "ScriptProcessor#add_load_path #{path.inspect}"
|
22
24
|
environment.append_path path
|
23
25
|
:ok
|
24
26
|
end
|
@@ -29,17 +31,20 @@ module WebAssets
|
|
29
31
|
|
30
32
|
def filenames filename
|
31
33
|
return [] unless bundle = environment[filename]
|
34
|
+
WebAssets.logger.debug "ScriptProcessor#filenames #{filename.inspect}"
|
32
35
|
bundle.to_a.map(&:logical_path)
|
33
36
|
end
|
34
37
|
|
35
38
|
def digest_filename filename
|
36
39
|
return "" unless bundle = environment[filename]
|
40
|
+
WebAssets.logger.debug "ScriptProcessor#digest_filename #{filename.inspect}"
|
37
41
|
bundle.digest_path
|
38
42
|
end
|
39
43
|
|
40
44
|
def content filename, options
|
41
45
|
environment.js_compressor = options[:minify] ? :uglifier : nil
|
42
46
|
return "" unless bundle = environment[filename]
|
47
|
+
WebAssets.logger.debug "ScriptProcessor#content #{filename.inspect}"
|
43
48
|
content = options[:bundle] ? bundle.to_s : bundle.body
|
44
49
|
options[:gzip] ? Gzipper.compress(content) : content
|
45
50
|
end
|
@@ -18,12 +18,14 @@ module WebAssets
|
|
18
18
|
|
19
19
|
def set_path path
|
20
20
|
return [:error, "#{path} isn't an existing directory."] unless Dir.exists? path
|
21
|
+
WebAssets.logger.debug "StylesheetProcessor#set_path #{path.inspect}"
|
21
22
|
@source_path = path
|
22
23
|
:ok
|
23
24
|
end
|
24
25
|
|
25
26
|
def add_load_path path
|
26
27
|
return [:error, "#{path} isn't an existing directory."] unless Dir.exists? path
|
28
|
+
WebAssets.logger.debug "StylesheetProcessor#add_load_path #{path.inspect}"
|
27
29
|
Sass.load_paths << path
|
28
30
|
:ok
|
29
31
|
end
|
@@ -34,12 +36,16 @@ module WebAssets
|
|
34
36
|
|
35
37
|
def content filename, options
|
36
38
|
filepath = full_path filename.sub(RE_EXTENSION, '')
|
39
|
+
WebAssets.logger.debug "StylesheetProcessor#content #{path.inspect}"
|
37
40
|
content = case
|
38
41
|
when File.exists?("#{filepath}.css")
|
42
|
+
WebAssets.logger.debug "StylesheetProcessor#content: File.read"
|
39
43
|
File.read "#{filepath}.css"
|
40
44
|
when File.exists?("#{filepath}.scss")
|
45
|
+
WebAssets.logger.debug "StylesheetProcessor#content: #render_sass_file/scss"
|
41
46
|
render_sass_file filepath, :scss, render_options(options)
|
42
47
|
when File.exists?("#{filepath}.sass")
|
48
|
+
WebAssets.logger.debug "StylesheetProcessor#content: #render_sass_file/sass"
|
43
49
|
render_sass_file filepath, :sass, render_options(options)
|
44
50
|
else
|
45
51
|
""
|
data/lib/web_assets/version.rb
CHANGED
data/lib/web_assets.rb
CHANGED
data/web_assets.gemspec
CHANGED
@@ -20,11 +20,11 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_dependency "compass",
|
24
|
-
spec.add_dependency "coffee-script",
|
25
|
-
spec.add_dependency "uglifier"
|
26
|
-
spec.add_dependency "sprockets",
|
27
|
-
spec.add_dependency "erlectricity",
|
23
|
+
spec.add_dependency "compass", "~> 0.12.2"
|
24
|
+
spec.add_dependency "coffee-script", "~> 2.2.0"
|
25
|
+
spec.add_dependency "uglifier", "~> 2.3.3"
|
26
|
+
spec.add_dependency "sprockets", "~> 2.10.0"
|
27
|
+
spec.add_dependency "erlectricity", "~> 1.1.1"
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.3"
|
30
30
|
spec.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mathieu Lajugie
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: compass
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: uglifier
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 2.3.3
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.3.3
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: sprockets
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,6 +168,7 @@ files:
|
|
168
168
|
- bin/web_assets.rb
|
169
169
|
- lib/web_assets.rb
|
170
170
|
- lib/web_assets/api.rb
|
171
|
+
- lib/web_assets/can_log.rb
|
171
172
|
- lib/web_assets/client_interface.rb
|
172
173
|
- lib/web_assets/command_line.rb
|
173
174
|
- lib/web_assets/gzipper.rb
|