assets_booster 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/asset_booster.gemspec +1 -0
- data/lib/assets_booster/compiler/yui_css.rb +18 -0
- data/lib/assets_booster/compiler/yui_js.rb +18 -0
- data/lib/assets_booster/packager.rb +1 -1
- data/lib/assets_booster/version.rb +1 -1
- data/spec/compiler/closure_spec.rb +1 -1
- data/spec/compiler/dummy_spec.rb +1 -1
- data/spec/compiler/jsmin_spec.rb +1 -1
- data/spec/compiler/rainpress_spec.rb +4 -1
- data/spec/compiler/uglify_spec.rb +1 -1
- data/spec/compiler/yui_css_spec.rb +17 -0
- data/spec/compiler/yui_js_spec.rb +16 -0
- data/spec/packager_spec.rb +3 -3
- metadata +23 -3
data/asset_booster.gemspec
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
module AssetsBooster
|
2
|
+
module Compiler
|
3
|
+
class YuiCss
|
4
|
+
def name
|
5
|
+
'YUI Compressor (CSS)'
|
6
|
+
end
|
7
|
+
|
8
|
+
def compile(code)
|
9
|
+
require "yui/compressor"
|
10
|
+
compressor = YUI::CssCompressor.new
|
11
|
+
compressor.compress(code)
|
12
|
+
rescue LoadError => e
|
13
|
+
raise LoadError, "To use the YUI JS/CSS Compressor, please install the yui-compressor gem first"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module AssetsBooster
|
2
|
+
module Compiler
|
3
|
+
class YuiJs
|
4
|
+
def name
|
5
|
+
'YUI Compressor (JS)'
|
6
|
+
end
|
7
|
+
|
8
|
+
def compile(code)
|
9
|
+
require "yui/compressor"
|
10
|
+
compressor = YUI::JavaScriptCompressor.new
|
11
|
+
compressor.compress(code)
|
12
|
+
rescue LoadError => e
|
13
|
+
raise LoadError, "To use the YUI JS/CSS Compressor, please install the yui-compressor gem first"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
@@ -5,7 +5,7 @@ module AssetsBooster
|
|
5
5
|
describe Closure do
|
6
6
|
it_behaves_like "a compiler" do
|
7
7
|
describe "compile" do
|
8
|
-
it "should compile
|
8
|
+
it "should compile javascript" do
|
9
9
|
subject.compile("var a = 'test'; alert(a);").should == 'var a="test";alert(a);'
|
10
10
|
end
|
11
11
|
end
|
data/spec/compiler/dummy_spec.rb
CHANGED
@@ -5,7 +5,7 @@ module AssetsBooster
|
|
5
5
|
describe Dummy do
|
6
6
|
it_behaves_like "a compiler" do
|
7
7
|
describe "compile" do
|
8
|
-
it "should
|
8
|
+
it "should do nothing" do
|
9
9
|
subject.compile("var a = 'test'; alert(a);").should == "var a = 'test'; alert(a);"
|
10
10
|
end
|
11
11
|
end
|
data/spec/compiler/jsmin_spec.rb
CHANGED
@@ -5,7 +5,7 @@ module AssetsBooster
|
|
5
5
|
describe JSMin do
|
6
6
|
it_behaves_like "a compiler" do
|
7
7
|
describe "compile" do
|
8
|
-
it "should compile
|
8
|
+
it "should compile javascript" do
|
9
9
|
subject.compile("var a = 'test'; alert(a);").should == "var a='test';alert(a);"
|
10
10
|
end
|
11
11
|
end
|
@@ -5,8 +5,11 @@ module AssetsBooster
|
|
5
5
|
describe Rainpress do
|
6
6
|
it_behaves_like "a compiler" do
|
7
7
|
describe "compile" do
|
8
|
-
it "should compile
|
8
|
+
it "should compile css" do
|
9
9
|
subject.compile("{ color: #ff0000; }").should == "{color:red}"
|
10
|
+
pending "rainpress is buggy, see https://github.com/sprsquish/rainpress/issues/1" do
|
11
|
+
subject.compile("a.en{background-position:0px 0px}").should == "a.en{background-position:0 0}"
|
12
|
+
end
|
10
13
|
end
|
11
14
|
end
|
12
15
|
end
|
@@ -5,7 +5,7 @@ module AssetsBooster
|
|
5
5
|
describe Uglify do
|
6
6
|
it_behaves_like "a compiler" do
|
7
7
|
describe "compile" do
|
8
|
-
it "should compile
|
8
|
+
it "should compile javascript" do
|
9
9
|
subject.compile("var a = 'test'; alert(a);").should == 'var a="test";alert(a)'
|
10
10
|
end
|
11
11
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'compiler/base'
|
2
|
+
require 'assets_booster/compiler/yui_css'
|
3
|
+
module AssetsBooster
|
4
|
+
module Compiler
|
5
|
+
describe YuiCss do
|
6
|
+
it_behaves_like "a compiler" do
|
7
|
+
describe "compile" do
|
8
|
+
it "should compile css" do
|
9
|
+
subject.compile("{ color: #ff0000; }").should == "{color:#f00}"
|
10
|
+
subject.compile("a.en{background-position:0px 0px}").should == "a.en{background-position:0 0}"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'compiler/base'
|
2
|
+
require 'assets_booster/compiler/yui_js'
|
3
|
+
module AssetsBooster
|
4
|
+
module Compiler
|
5
|
+
describe YuiJs do
|
6
|
+
it_behaves_like "a compiler" do
|
7
|
+
describe "compile" do
|
8
|
+
it "should compile javscript" do
|
9
|
+
subject.compile("var a = 'test'; alert(a);").should == 'var a="test";alert(a);'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
data/spec/packager_spec.rb
CHANGED
@@ -45,7 +45,7 @@ module AssetsBooster
|
|
45
45
|
'compiler' => "uglify",
|
46
46
|
},
|
47
47
|
'stylesheet' => {
|
48
|
-
'compiler' => "
|
48
|
+
'compiler' => "yui_css",
|
49
49
|
},
|
50
50
|
'environments' => %w(test),
|
51
51
|
}
|
@@ -60,7 +60,7 @@ module AssetsBooster
|
|
60
60
|
File.should_receive(:utime).with(13, 13, "/rails/public/stylesheets/base_packaged.css").twice
|
61
61
|
|
62
62
|
# compiling css
|
63
|
-
file.should_receive(:write).with("html{color
|
63
|
+
file.should_receive(:write).with("html{color:#f00}").once
|
64
64
|
|
65
65
|
# merging js
|
66
66
|
File.should_receive(:read).with("/rails/public/javascripts/jquery.js").once.and_return("var action = 'jquery'; alert('jquery')")
|
@@ -77,7 +77,7 @@ module AssetsBooster
|
|
77
77
|
|
78
78
|
subject.compile_all
|
79
79
|
@messages[0].should match(/Merging assets.*CSS Merger/)
|
80
|
-
@messages[1].should match(/Compiling.*
|
80
|
+
@messages[1].should match(/Compiling.*YUI Compressor/)
|
81
81
|
@messages[3].should match(/Merging assets.*Simple Merger/)
|
82
82
|
@messages[4].should match(/Compiling.*UglifyJS/)
|
83
83
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: assets_booster
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Corin Langosch
|
@@ -65,6 +65,22 @@ dependencies:
|
|
65
65
|
version: "1.0"
|
66
66
|
type: :development
|
67
67
|
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: yui-compressor
|
70
|
+
prerelease: false
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 51
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 9
|
80
|
+
- 4
|
81
|
+
version: 0.9.4
|
82
|
+
type: :development
|
83
|
+
version_requirements: *id004
|
68
84
|
description: Instead of sending down a dozen JavaScript and CSS files full of formatting and comments, this gem makes it simple to merge and compress these into one or more files, increasing speed and saving bandwidth.
|
69
85
|
email:
|
70
86
|
- info@netskin.com
|
@@ -91,6 +107,8 @@ files:
|
|
91
107
|
- lib/assets_booster/compiler/node-js/uglify.js
|
92
108
|
- lib/assets_booster/compiler/rainpress.rb
|
93
109
|
- lib/assets_booster/compiler/uglify.rb
|
110
|
+
- lib/assets_booster/compiler/yui_css.rb
|
111
|
+
- lib/assets_booster/compiler/yui_js.rb
|
94
112
|
- lib/assets_booster/merger/base.rb
|
95
113
|
- lib/assets_booster/merger/css.rb
|
96
114
|
- lib/assets_booster/merger/simple.rb
|
@@ -108,6 +126,8 @@ files:
|
|
108
126
|
- spec/compiler/jsmin_spec.rb
|
109
127
|
- spec/compiler/rainpress_spec.rb
|
110
128
|
- spec/compiler/uglify_spec.rb
|
129
|
+
- spec/compiler/yui_css_spec.rb
|
130
|
+
- spec/compiler/yui_js_spec.rb
|
111
131
|
- spec/merger/base.rb
|
112
132
|
- spec/merger/css_spec.rb
|
113
133
|
- spec/merger/simple_spec.rb
|