evax 0.0.7 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/evax.rb +8 -7
- data/lib/evax/version.rb +1 -1
- data/test/evax_test.rb +29 -0
- data/test/fixtures/assets.yml +1 -1
- data/test/fixtures/assets_compress_off.yml +18 -0
- data/test/fixtures/assets_compress_on.yml +18 -0
- data/test/fixtures/css_one.compress_off.css +9 -0
- data/test/fixtures/css_two.compress_off.css +8 -0
- data/test/fixtures/javascripts/four.js +1 -1
- data/test/fixtures/javascripts/one.js +1 -1
- data/test/fixtures/javascripts/three.js +1 -1
- data/test/fixtures/javascripts/two.js +1 -1
- data/test/fixtures/js_one.compress_off.js +9 -0
- data/test/fixtures/js_one.js +3 -3
- data/test/fixtures/js_two.compress_off.js +3 -0
- metadata +73 -98
data/lib/evax.rb
CHANGED
@@ -17,7 +17,8 @@ class Evax
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def config
|
20
|
-
|
20
|
+
default_opts = { "compress" => true }
|
21
|
+
default_opts.merge(YAML::load_file( @config_file ))
|
21
22
|
end
|
22
23
|
|
23
24
|
def join( type, group_name )
|
@@ -33,19 +34,19 @@ class Evax
|
|
33
34
|
|
34
35
|
def build_js
|
35
36
|
config["javascripts"].each_key do |group_name|
|
36
|
-
|
37
|
-
|
37
|
+
result_string = join( :javascripts, group_name )
|
38
|
+
result_string = Evax.compress_js( result_string ) if config["compress"]
|
38
39
|
|
39
|
-
write_output( "#{group_name}.js",
|
40
|
+
write_output( "#{group_name}.js", result_string )
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
44
|
def build_css
|
44
45
|
config["stylesheets"].each_key do |group_name|
|
45
|
-
|
46
|
-
|
46
|
+
result_string = join( :stylesheets, group_name )
|
47
|
+
result_string = Evax.compress_css( result_string ) if config["compress"]
|
47
48
|
|
48
|
-
write_output( "#{group_name}.css",
|
49
|
+
write_output( "#{group_name}.css", result_string )
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
data/lib/evax/version.rb
CHANGED
data/test/evax_test.rb
CHANGED
@@ -14,9 +14,20 @@ class EvaxTest < Test::Unit::TestCase
|
|
14
14
|
def test_read_config_file
|
15
15
|
evax = Evax.new( "#{FIXTURES}/assets.yml")
|
16
16
|
assert_equal( "tmp/", evax.config["output_path"] )
|
17
|
+
assert_equal( true, evax.config["compress"] )
|
17
18
|
assert_equal( 2, evax.config["javascripts"].size )
|
18
19
|
end
|
19
20
|
|
21
|
+
def test_read_config_file_compress_on
|
22
|
+
evax = Evax.new( "#{FIXTURES}/assets_compress_on.yml")
|
23
|
+
assert_equal( true, evax.config["compress"] )
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_read_config_file_compress_off
|
27
|
+
evax = Evax.new( "#{FIXTURES}/assets_compress_off.yml")
|
28
|
+
assert_equal( false, evax.config["compress"] )
|
29
|
+
end
|
30
|
+
|
20
31
|
def test_join
|
21
32
|
evax = Evax.new( "#{FIXTURES}/assets.yml", "/wadus" )
|
22
33
|
|
@@ -71,6 +82,15 @@ class EvaxTest < Test::Unit::TestCase
|
|
71
82
|
evax.build_js
|
72
83
|
end
|
73
84
|
|
85
|
+
def test_build_js_compress_off
|
86
|
+
evax = Evax.new( "#{FIXTURES}/assets_compress_off.yml", "#{File.dirname(__FILE__)}/.." )
|
87
|
+
Evax.expects( :compress_js ).never
|
88
|
+
evax.expects( :write_output ).with( "js_one.js", File.read( "#{FIXTURES}/js_one.compress_off.js" ) )
|
89
|
+
evax.expects( :write_output ).with( "js_two.js", File.read( "#{FIXTURES}/js_two.compress_off.js" ) )
|
90
|
+
|
91
|
+
evax.build_js
|
92
|
+
end
|
93
|
+
|
74
94
|
def test_build_css
|
75
95
|
evax = Evax.new( "#{FIXTURES}/assets.yml", "#{File.dirname(__FILE__)}/.." )
|
76
96
|
evax.expects( :write_output ).with( "css_one.css", File.read( "#{FIXTURES}/css_one.compress.css" ) )
|
@@ -79,6 +99,15 @@ class EvaxTest < Test::Unit::TestCase
|
|
79
99
|
evax.build_css
|
80
100
|
end
|
81
101
|
|
102
|
+
def test_build_css_off
|
103
|
+
evax = Evax.new( "#{FIXTURES}/assets_compress_off.yml", "#{File.dirname(__FILE__)}/.." )
|
104
|
+
Evax.expects( :compress_css ).never
|
105
|
+
evax.expects( :write_output ).with( "css_one.css", File.read( "#{FIXTURES}/css_one.compress_off.css" ) )
|
106
|
+
evax.expects( :write_output ).with( "css_two.css", File.read( "#{FIXTURES}/css_two.compress_off.css" ) )
|
107
|
+
|
108
|
+
evax.build_css
|
109
|
+
end
|
110
|
+
|
82
111
|
def test_build_only_css_if_js_not_configured
|
83
112
|
evax = Evax.new( "#{FIXTURES}/assets_without_javascripts.yml", "#{File.dirname(__FILE__)}/.." )
|
84
113
|
|
data/test/fixtures/assets.yml
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
compress: off
|
2
|
+
output_path: tmp/
|
3
|
+
|
4
|
+
javascripts:
|
5
|
+
js_one:
|
6
|
+
- test/fixtures/javascripts/one.js
|
7
|
+
- test/fixtures/javascripts/two.js
|
8
|
+
- test/fixtures/javascripts/three.js
|
9
|
+
js_two:
|
10
|
+
- test/fixtures/javascripts/four.js
|
11
|
+
|
12
|
+
stylesheets:
|
13
|
+
css_one:
|
14
|
+
- test/fixtures/stylesheets/one.css
|
15
|
+
- test/fixtures/stylesheets/two.css
|
16
|
+
css_two:
|
17
|
+
- test/fixtures/stylesheets/three.css
|
18
|
+
- test/fixtures/stylesheets/four.css
|
@@ -0,0 +1,18 @@
|
|
1
|
+
compress: on
|
2
|
+
output_path: tmp/
|
3
|
+
|
4
|
+
javascripts:
|
5
|
+
js_one:
|
6
|
+
- test/fixtures/javascripts/one.js
|
7
|
+
- test/fixtures/javascripts/two.js
|
8
|
+
- test/fixtures/javascripts/three.js
|
9
|
+
js_two:
|
10
|
+
- test/fixtures/javascripts/four.js
|
11
|
+
|
12
|
+
stylesheets:
|
13
|
+
css_one:
|
14
|
+
- test/fixtures/stylesheets/one.css
|
15
|
+
- test/fixtures/stylesheets/two.css
|
16
|
+
css_two:
|
17
|
+
- test/fixtures/stylesheets/three.css
|
18
|
+
- test/fixtures/stylesheets/four.css
|
data/test/fixtures/js_one.js
CHANGED
metadata
CHANGED
@@ -1,112 +1,83 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: evax
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 7
|
9
|
-
version: 0.0.7
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.9
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Fernando Guillen
|
13
9
|
- Juan Vidal
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
13
|
+
date: 2011-12-22 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
22
16
|
name: bundler
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &70293863557040 !ruby/object:Gem::Requirement
|
25
18
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
segments:
|
30
|
-
- 1
|
31
|
-
- 0
|
32
|
-
- 0
|
33
|
-
- rc
|
34
|
-
- 6
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
35
22
|
version: 1.0.0.rc.6
|
36
23
|
type: :development
|
37
|
-
version_requirements: *id001
|
38
|
-
- !ruby/object:Gem::Dependency
|
39
|
-
name: rake
|
40
24
|
prerelease: false
|
41
|
-
|
25
|
+
version_requirements: *70293863557040
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: rake
|
28
|
+
requirement: &70293863554720 !ruby/object:Gem::Requirement
|
42
29
|
none: false
|
43
|
-
requirements:
|
44
|
-
- -
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 9
|
49
|
-
- 2
|
50
|
-
- 2
|
30
|
+
requirements:
|
31
|
+
- - =
|
32
|
+
- !ruby/object:Gem::Version
|
51
33
|
version: 0.9.2.2
|
52
34
|
type: :development
|
53
|
-
version_requirements: *id002
|
54
|
-
- !ruby/object:Gem::Dependency
|
55
|
-
name: mocha
|
56
35
|
prerelease: false
|
57
|
-
|
36
|
+
version_requirements: *70293863554720
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: mocha
|
39
|
+
requirement: &70293863552720 !ruby/object:Gem::Requirement
|
58
40
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
segments:
|
63
|
-
- 0
|
64
|
-
- 10
|
65
|
-
- 0
|
41
|
+
requirements:
|
42
|
+
- - =
|
43
|
+
- !ruby/object:Gem::Version
|
66
44
|
version: 0.10.0
|
67
45
|
type: :development
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: delorean
|
71
46
|
prerelease: false
|
72
|
-
|
47
|
+
version_requirements: *70293863552720
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: delorean
|
50
|
+
requirement: &70293863550860 !ruby/object:Gem::Requirement
|
73
51
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
segments:
|
78
|
-
- 1
|
79
|
-
- 1
|
80
|
-
- 1
|
52
|
+
requirements:
|
53
|
+
- - =
|
54
|
+
- !ruby/object:Gem::Version
|
81
55
|
version: 1.1.1
|
82
56
|
type: :development
|
83
|
-
version_requirements: *id004
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: uglifier
|
86
57
|
prerelease: false
|
87
|
-
|
58
|
+
version_requirements: *70293863550860
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: uglifier
|
61
|
+
requirement: &70293863541740 !ruby/object:Gem::Requirement
|
88
62
|
none: false
|
89
|
-
requirements:
|
90
|
-
- -
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
segments:
|
93
|
-
- 1
|
94
|
-
- 1
|
95
|
-
- 0
|
63
|
+
requirements:
|
64
|
+
- - =
|
65
|
+
- !ruby/object:Gem::Version
|
96
66
|
version: 1.1.0
|
97
67
|
type: :runtime
|
98
|
-
|
99
|
-
|
100
|
-
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *70293863541740
|
70
|
+
description: ! " Evax is a simple asset packaging library for Ruby,\n providing
|
71
|
+
JavaScript/CSS concatenation and compression\n using UglifyJS and a really simple
|
72
|
+
regex based CSS\n compressor. Just because enough is enough.\n"
|
73
|
+
email:
|
101
74
|
- fguillen.mail@gmail.com
|
102
75
|
- juanjicho@gmail.com
|
103
|
-
executables:
|
76
|
+
executables:
|
104
77
|
- evax
|
105
78
|
extensions: []
|
106
|
-
|
107
79
|
extra_rdoc_files: []
|
108
|
-
|
109
|
-
files:
|
80
|
+
files:
|
110
81
|
- .gitignore
|
111
82
|
- .rvmrc.example
|
112
83
|
- Gemfile
|
@@ -122,71 +93,75 @@ files:
|
|
122
93
|
- lib/evax/version.rb
|
123
94
|
- test/evax_test.rb
|
124
95
|
- test/fixtures/assets.yml
|
96
|
+
- test/fixtures/assets_compress_off.yml
|
97
|
+
- test/fixtures/assets_compress_on.yml
|
125
98
|
- test/fixtures/assets_without_javascripts.yml
|
126
99
|
- test/fixtures/assets_without_stylesheets.yml
|
127
100
|
- test/fixtures/css_one.compress.css
|
101
|
+
- test/fixtures/css_one.compress_off.css
|
128
102
|
- test/fixtures/css_one.css
|
129
103
|
- test/fixtures/css_two.compress.css
|
104
|
+
- test/fixtures/css_two.compress_off.css
|
130
105
|
- test/fixtures/javascripts/four.js
|
131
106
|
- test/fixtures/javascripts/one.js
|
132
107
|
- test/fixtures/javascripts/three.js
|
133
108
|
- test/fixtures/javascripts/two.js
|
134
109
|
- test/fixtures/js_one.compress.js
|
110
|
+
- test/fixtures/js_one.compress_off.js
|
135
111
|
- test/fixtures/js_one.js
|
136
112
|
- test/fixtures/js_two.compress.js
|
113
|
+
- test/fixtures/js_two.compress_off.js
|
137
114
|
- test/fixtures/stylesheets/four.css
|
138
115
|
- test/fixtures/stylesheets/one.css
|
139
116
|
- test/fixtures/stylesheets/three.css
|
140
117
|
- test/fixtures/stylesheets/two.css
|
141
118
|
- test/logger_test.rb
|
142
119
|
- test/test_helper.rb
|
143
|
-
has_rdoc: true
|
144
120
|
homepage: https://github.com/SponsorPay/Evax
|
145
121
|
licenses: []
|
146
|
-
|
147
122
|
post_install_message:
|
148
123
|
rdoc_options: []
|
149
|
-
|
150
|
-
require_paths:
|
124
|
+
require_paths:
|
151
125
|
- lib
|
152
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
153
127
|
none: false
|
154
|
-
requirements:
|
155
|
-
- -
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
|
158
|
-
|
159
|
-
version: "0"
|
160
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
133
|
none: false
|
162
|
-
requirements:
|
163
|
-
- -
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
|
166
|
-
- 0
|
167
|
-
version: "0"
|
134
|
+
requirements:
|
135
|
+
- - ! '>='
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: '0'
|
168
138
|
requirements: []
|
169
|
-
|
170
139
|
rubyforge_project: evax
|
171
|
-
rubygems_version: 1.
|
140
|
+
rubygems_version: 1.8.10
|
172
141
|
signing_key:
|
173
142
|
specification_version: 3
|
174
143
|
summary: Very simple assets compressor
|
175
|
-
test_files:
|
144
|
+
test_files:
|
176
145
|
- test/evax_test.rb
|
177
146
|
- test/fixtures/assets.yml
|
147
|
+
- test/fixtures/assets_compress_off.yml
|
148
|
+
- test/fixtures/assets_compress_on.yml
|
178
149
|
- test/fixtures/assets_without_javascripts.yml
|
179
150
|
- test/fixtures/assets_without_stylesheets.yml
|
180
151
|
- test/fixtures/css_one.compress.css
|
152
|
+
- test/fixtures/css_one.compress_off.css
|
181
153
|
- test/fixtures/css_one.css
|
182
154
|
- test/fixtures/css_two.compress.css
|
155
|
+
- test/fixtures/css_two.compress_off.css
|
183
156
|
- test/fixtures/javascripts/four.js
|
184
157
|
- test/fixtures/javascripts/one.js
|
185
158
|
- test/fixtures/javascripts/three.js
|
186
159
|
- test/fixtures/javascripts/two.js
|
187
160
|
- test/fixtures/js_one.compress.js
|
161
|
+
- test/fixtures/js_one.compress_off.js
|
188
162
|
- test/fixtures/js_one.js
|
189
163
|
- test/fixtures/js_two.compress.js
|
164
|
+
- test/fixtures/js_two.compress_off.js
|
190
165
|
- test/fixtures/stylesheets/four.css
|
191
166
|
- test/fixtures/stylesheets/one.css
|
192
167
|
- test/fixtures/stylesheets/three.css
|