optimize-js 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +14 -8
- data/Appraisals +18 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +32 -0
- data/README.md +6 -4
- data/Rakefile +2 -0
- data/gemfiles/rails_3.gemfile +8 -0
- data/gemfiles/rails_3.gemfile.lock +108 -0
- data/gemfiles/rails_4_with_sprockets_2.gemfile +8 -0
- data/gemfiles/rails_4_with_sprockets_2.gemfile.lock +125 -0
- data/gemfiles/rails_4_with_sprockets_3.gemfile +8 -0
- data/gemfiles/rails_4_with_sprockets_3.gemfile.lock +125 -0
- data/gemfiles/rails_5.gemfile +7 -0
- data/gemfiles/rails_5.gemfile.lock +129 -0
- data/lib/optimize-js.rb +2 -2
- data/lib/optimize-js/version.rb +1 -1
- data/optimize-js.gemspec +4 -2
- data/test/fixtures/javascripts/application.js +1 -0
- data/test/test-optimize-js.rb +4 -2
- data/test/test-rails-integration.rb +74 -0
- data/test/test-sprockets-integration.rb +10 -0
- metadata +48 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 915f704285fce599270dc45534481e0ae1bc8bb1
|
4
|
+
data.tar.gz: d81dd20291c07af188f0bc7ffaae32a5a2f4a35a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94068f2bdf737177e24d7b3f4f77da29855f73e585b529e954ab645190591464b777a08a99da94d5b7ce64ecd6c988bddc9fdf79346f7d623c7283c46bb391e4
|
7
|
+
data.tar.gz: 3eb6f9f753f36fdff6810af70b116bee9f97a61f5ec71faa1aa693975e77afc93bcbd5b2956eb5df3638e1c9dfcf675367f5a9e98da7aeec6577c8db1a6a32fd
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
3
|
rvm:
|
4
|
+
- 2.0.0
|
5
|
+
- 2.1.10
|
6
|
+
- 2.2.5
|
4
7
|
- 2.3.1
|
5
8
|
|
6
9
|
cache: bundler
|
7
10
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
+
gemfile:
|
12
|
+
- gemfiles/rails_3.gemfile
|
13
|
+
- gemfiles/rails_4_with_sprockets_2.gemfile
|
14
|
+
- gemfiles/rails_4_with_sprockets_3.gemfile
|
15
|
+
- gemfiles/rails_5.gemfile
|
11
16
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
-
|
17
|
+
matrix:
|
18
|
+
exclude:
|
19
|
+
- rvm: 2.0.0
|
20
|
+
gemfile: gemfiles/rails_5.gemfile
|
21
|
+
- rvm: 2.1.10
|
22
|
+
gemfile: gemfiles/rails_5.gemfile
|
data/Appraisals
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
appraise 'rails-3' do
|
2
|
+
gem 'rails', '~> 3'
|
3
|
+
gem 'sprockets', '~> 2'
|
4
|
+
end
|
5
|
+
|
6
|
+
appraise 'rails-4-with-sprockets-2' do
|
7
|
+
gem 'rails', '~> 4'
|
8
|
+
gem 'sprockets', '~> 3'
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise 'rails-4-with-sprockets-3' do
|
12
|
+
gem 'rails', '~> 4'
|
13
|
+
gem 'sprockets', '~> 3'
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise 'rails-5' do
|
17
|
+
gem 'rails', '~> 5'
|
18
|
+
end
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
optimize-js (1.0)
|
5
|
+
execjs (>= 1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
appraisal (2.1.0)
|
11
|
+
bundler
|
12
|
+
rake
|
13
|
+
thor (>= 0.14.0)
|
14
|
+
execjs (2.7.0)
|
15
|
+
power_assert (0.3.1)
|
16
|
+
rake (10.5.0)
|
17
|
+
test-unit (3.1.9)
|
18
|
+
power_assert
|
19
|
+
thor (0.19.4)
|
20
|
+
|
21
|
+
PLATFORMS
|
22
|
+
ruby
|
23
|
+
|
24
|
+
DEPENDENCIES
|
25
|
+
appraisal (~> 2.1)
|
26
|
+
bundler (~> 1.7)
|
27
|
+
optimize-js!
|
28
|
+
rake (~> 10.0)
|
29
|
+
test-unit (~> 3.1)
|
30
|
+
|
31
|
+
BUNDLED WITH
|
32
|
+
1.13.2
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
## Ruby wrapper and Rails asset pipeline integration for [optimize-js](https://github.com/nolanlawson/optimize-js).
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/optimize-js.svg)](https://badge.fury.io/rb/optimize-js)
|
3
4
|
[![Build Status](https://travis-ci.org/yivo/optimize-js.svg?branch=master)](https://travis-ci.org/yivo/optimize-js)
|
4
5
|
|
5
6
|
## About
|
@@ -43,6 +44,7 @@ Gem will automatically register `OptimizeJS::SprocketsProcessor` using `register
|
|
43
44
|
2. Run: `bundle exec rake optimize_js`
|
44
45
|
|
45
46
|
This rake task will do several things:
|
47
|
+
|
46
48
|
1. Clone latest git tag
|
47
49
|
2. Install npm dependencies
|
48
50
|
3. Install browserify
|
@@ -57,10 +59,10 @@ This rake task will do several things:
|
|
57
59
|
2. Run tests: `bundle exec rake test`
|
58
60
|
|
59
61
|
## Things to work on
|
60
|
-
1. Write integration tests
|
61
|
-
2. Test on different versions of sprockets
|
62
|
-
3. Test on different versions of rails
|
63
|
-
4. Test on different versions of ruby
|
62
|
+
1. ~~Write integration tests.~~
|
63
|
+
2. ~~Test on different versions of sprockets.~~
|
64
|
+
3. ~~Test on different versions of rails.~~
|
65
|
+
4. ~~Test on different versions of ruby.~~
|
64
66
|
5. Sprockets without Rails.
|
65
67
|
6. Typos in README.
|
66
68
|
|
data/Rakefile
CHANGED
@@ -0,0 +1,108 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
optimize-js (1.0)
|
5
|
+
execjs (>= 1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (3.2.22.5)
|
11
|
+
actionpack (= 3.2.22.5)
|
12
|
+
mail (~> 2.5.4)
|
13
|
+
actionpack (3.2.22.5)
|
14
|
+
activemodel (= 3.2.22.5)
|
15
|
+
activesupport (= 3.2.22.5)
|
16
|
+
builder (~> 3.0.0)
|
17
|
+
erubis (~> 2.7.0)
|
18
|
+
journey (~> 1.0.4)
|
19
|
+
rack (~> 1.4.5)
|
20
|
+
rack-cache (~> 1.2)
|
21
|
+
rack-test (~> 0.6.1)
|
22
|
+
sprockets (~> 2.2.1)
|
23
|
+
activemodel (3.2.22.5)
|
24
|
+
activesupport (= 3.2.22.5)
|
25
|
+
builder (~> 3.0.0)
|
26
|
+
activerecord (3.2.22.5)
|
27
|
+
activemodel (= 3.2.22.5)
|
28
|
+
activesupport (= 3.2.22.5)
|
29
|
+
arel (~> 3.0.2)
|
30
|
+
tzinfo (~> 0.3.29)
|
31
|
+
activeresource (3.2.22.5)
|
32
|
+
activemodel (= 3.2.22.5)
|
33
|
+
activesupport (= 3.2.22.5)
|
34
|
+
activesupport (3.2.22.5)
|
35
|
+
i18n (~> 0.6, >= 0.6.4)
|
36
|
+
multi_json (~> 1.0)
|
37
|
+
appraisal (2.1.0)
|
38
|
+
bundler
|
39
|
+
rake
|
40
|
+
thor (>= 0.14.0)
|
41
|
+
arel (3.0.3)
|
42
|
+
builder (3.0.4)
|
43
|
+
erubis (2.7.0)
|
44
|
+
execjs (2.7.0)
|
45
|
+
hike (1.2.3)
|
46
|
+
i18n (0.7.0)
|
47
|
+
journey (1.0.4)
|
48
|
+
json (1.8.3)
|
49
|
+
mail (2.5.4)
|
50
|
+
mime-types (~> 1.16)
|
51
|
+
treetop (~> 1.4.8)
|
52
|
+
mime-types (1.25.1)
|
53
|
+
multi_json (1.12.1)
|
54
|
+
polyglot (0.3.5)
|
55
|
+
power_assert (0.3.1)
|
56
|
+
rack (1.4.7)
|
57
|
+
rack-cache (1.6.1)
|
58
|
+
rack (>= 0.4)
|
59
|
+
rack-ssl (1.3.4)
|
60
|
+
rack
|
61
|
+
rack-test (0.6.3)
|
62
|
+
rack (>= 1.0)
|
63
|
+
rails (3.2.22.5)
|
64
|
+
actionmailer (= 3.2.22.5)
|
65
|
+
actionpack (= 3.2.22.5)
|
66
|
+
activerecord (= 3.2.22.5)
|
67
|
+
activeresource (= 3.2.22.5)
|
68
|
+
activesupport (= 3.2.22.5)
|
69
|
+
bundler (~> 1.0)
|
70
|
+
railties (= 3.2.22.5)
|
71
|
+
railties (3.2.22.5)
|
72
|
+
actionpack (= 3.2.22.5)
|
73
|
+
activesupport (= 3.2.22.5)
|
74
|
+
rack-ssl (~> 1.3.2)
|
75
|
+
rake (>= 0.8.7)
|
76
|
+
rdoc (~> 3.4)
|
77
|
+
thor (>= 0.14.6, < 2.0)
|
78
|
+
rake (10.5.0)
|
79
|
+
rdoc (3.12.2)
|
80
|
+
json (~> 1.4)
|
81
|
+
sprockets (2.2.3)
|
82
|
+
hike (~> 1.2)
|
83
|
+
multi_json (~> 1.0)
|
84
|
+
rack (~> 1.0)
|
85
|
+
tilt (~> 1.1, != 1.3.0)
|
86
|
+
test-unit (3.1.9)
|
87
|
+
power_assert
|
88
|
+
thor (0.19.4)
|
89
|
+
tilt (1.4.1)
|
90
|
+
treetop (1.4.15)
|
91
|
+
polyglot
|
92
|
+
polyglot (>= 0.3.1)
|
93
|
+
tzinfo (0.3.52)
|
94
|
+
|
95
|
+
PLATFORMS
|
96
|
+
ruby
|
97
|
+
|
98
|
+
DEPENDENCIES
|
99
|
+
appraisal (~> 2.1)
|
100
|
+
bundler (~> 1.7)
|
101
|
+
optimize-js!
|
102
|
+
rails (~> 3)
|
103
|
+
rake (~> 10.0)
|
104
|
+
sprockets (~> 2)
|
105
|
+
test-unit (~> 3.1)
|
106
|
+
|
107
|
+
BUNDLED WITH
|
108
|
+
1.13.2
|
@@ -0,0 +1,125 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
optimize-js (1.0)
|
5
|
+
execjs (>= 1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (4.2.7.1)
|
11
|
+
actionpack (= 4.2.7.1)
|
12
|
+
actionview (= 4.2.7.1)
|
13
|
+
activejob (= 4.2.7.1)
|
14
|
+
mail (~> 2.5, >= 2.5.4)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
actionpack (4.2.7.1)
|
17
|
+
actionview (= 4.2.7.1)
|
18
|
+
activesupport (= 4.2.7.1)
|
19
|
+
rack (~> 1.6)
|
20
|
+
rack-test (~> 0.6.2)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
+
actionview (4.2.7.1)
|
24
|
+
activesupport (= 4.2.7.1)
|
25
|
+
builder (~> 3.1)
|
26
|
+
erubis (~> 2.7.0)
|
27
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
29
|
+
activejob (4.2.7.1)
|
30
|
+
activesupport (= 4.2.7.1)
|
31
|
+
globalid (>= 0.3.0)
|
32
|
+
activemodel (4.2.7.1)
|
33
|
+
activesupport (= 4.2.7.1)
|
34
|
+
builder (~> 3.1)
|
35
|
+
activerecord (4.2.7.1)
|
36
|
+
activemodel (= 4.2.7.1)
|
37
|
+
activesupport (= 4.2.7.1)
|
38
|
+
arel (~> 6.0)
|
39
|
+
activesupport (4.2.7.1)
|
40
|
+
i18n (~> 0.7)
|
41
|
+
json (~> 1.7, >= 1.7.7)
|
42
|
+
minitest (~> 5.1)
|
43
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
44
|
+
tzinfo (~> 1.1)
|
45
|
+
appraisal (2.1.0)
|
46
|
+
bundler
|
47
|
+
rake
|
48
|
+
thor (>= 0.14.0)
|
49
|
+
arel (6.0.3)
|
50
|
+
builder (3.2.2)
|
51
|
+
concurrent-ruby (1.0.2)
|
52
|
+
erubis (2.7.0)
|
53
|
+
execjs (2.7.0)
|
54
|
+
globalid (0.3.7)
|
55
|
+
activesupport (>= 4.1.0)
|
56
|
+
i18n (0.7.0)
|
57
|
+
json (1.8.3)
|
58
|
+
loofah (2.0.3)
|
59
|
+
nokogiri (>= 1.5.9)
|
60
|
+
mail (2.6.4)
|
61
|
+
mime-types (>= 1.16, < 4)
|
62
|
+
mime-types (3.1)
|
63
|
+
mime-types-data (~> 3.2015)
|
64
|
+
mime-types-data (3.2016.0521)
|
65
|
+
mini_portile2 (2.1.0)
|
66
|
+
minitest (5.10.1)
|
67
|
+
nokogiri (1.6.8.1)
|
68
|
+
mini_portile2 (~> 2.1.0)
|
69
|
+
power_assert (0.3.1)
|
70
|
+
rack (1.6.5)
|
71
|
+
rack-test (0.6.3)
|
72
|
+
rack (>= 1.0)
|
73
|
+
rails (4.2.7.1)
|
74
|
+
actionmailer (= 4.2.7.1)
|
75
|
+
actionpack (= 4.2.7.1)
|
76
|
+
actionview (= 4.2.7.1)
|
77
|
+
activejob (= 4.2.7.1)
|
78
|
+
activemodel (= 4.2.7.1)
|
79
|
+
activerecord (= 4.2.7.1)
|
80
|
+
activesupport (= 4.2.7.1)
|
81
|
+
bundler (>= 1.3.0, < 2.0)
|
82
|
+
railties (= 4.2.7.1)
|
83
|
+
sprockets-rails
|
84
|
+
rails-deprecated_sanitizer (1.0.3)
|
85
|
+
activesupport (>= 4.2.0.alpha)
|
86
|
+
rails-dom-testing (1.0.7)
|
87
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
88
|
+
nokogiri (~> 1.6.0)
|
89
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
90
|
+
rails-html-sanitizer (1.0.3)
|
91
|
+
loofah (~> 2.0)
|
92
|
+
railties (4.2.7.1)
|
93
|
+
actionpack (= 4.2.7.1)
|
94
|
+
activesupport (= 4.2.7.1)
|
95
|
+
rake (>= 0.8.7)
|
96
|
+
thor (>= 0.18.1, < 2.0)
|
97
|
+
rake (10.5.0)
|
98
|
+
sprockets (3.7.0)
|
99
|
+
concurrent-ruby (~> 1.0)
|
100
|
+
rack (> 1, < 3)
|
101
|
+
sprockets-rails (3.2.0)
|
102
|
+
actionpack (>= 4.0)
|
103
|
+
activesupport (>= 4.0)
|
104
|
+
sprockets (>= 3.0.0)
|
105
|
+
test-unit (3.1.9)
|
106
|
+
power_assert
|
107
|
+
thor (0.19.4)
|
108
|
+
thread_safe (0.3.5)
|
109
|
+
tzinfo (1.2.2)
|
110
|
+
thread_safe (~> 0.1)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
ruby
|
114
|
+
|
115
|
+
DEPENDENCIES
|
116
|
+
appraisal (~> 2.1)
|
117
|
+
bundler (~> 1.7)
|
118
|
+
optimize-js!
|
119
|
+
rails (~> 4)
|
120
|
+
rake (~> 10.0)
|
121
|
+
sprockets (~> 3)
|
122
|
+
test-unit (~> 3.1)
|
123
|
+
|
124
|
+
BUNDLED WITH
|
125
|
+
1.13.2
|
@@ -0,0 +1,125 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
optimize-js (1.0)
|
5
|
+
execjs (>= 1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actionmailer (4.2.7.1)
|
11
|
+
actionpack (= 4.2.7.1)
|
12
|
+
actionview (= 4.2.7.1)
|
13
|
+
activejob (= 4.2.7.1)
|
14
|
+
mail (~> 2.5, >= 2.5.4)
|
15
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
16
|
+
actionpack (4.2.7.1)
|
17
|
+
actionview (= 4.2.7.1)
|
18
|
+
activesupport (= 4.2.7.1)
|
19
|
+
rack (~> 1.6)
|
20
|
+
rack-test (~> 0.6.2)
|
21
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
22
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
23
|
+
actionview (4.2.7.1)
|
24
|
+
activesupport (= 4.2.7.1)
|
25
|
+
builder (~> 3.1)
|
26
|
+
erubis (~> 2.7.0)
|
27
|
+
rails-dom-testing (~> 1.0, >= 1.0.5)
|
28
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
29
|
+
activejob (4.2.7.1)
|
30
|
+
activesupport (= 4.2.7.1)
|
31
|
+
globalid (>= 0.3.0)
|
32
|
+
activemodel (4.2.7.1)
|
33
|
+
activesupport (= 4.2.7.1)
|
34
|
+
builder (~> 3.1)
|
35
|
+
activerecord (4.2.7.1)
|
36
|
+
activemodel (= 4.2.7.1)
|
37
|
+
activesupport (= 4.2.7.1)
|
38
|
+
arel (~> 6.0)
|
39
|
+
activesupport (4.2.7.1)
|
40
|
+
i18n (~> 0.7)
|
41
|
+
json (~> 1.7, >= 1.7.7)
|
42
|
+
minitest (~> 5.1)
|
43
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
44
|
+
tzinfo (~> 1.1)
|
45
|
+
appraisal (2.1.0)
|
46
|
+
bundler
|
47
|
+
rake
|
48
|
+
thor (>= 0.14.0)
|
49
|
+
arel (6.0.3)
|
50
|
+
builder (3.2.2)
|
51
|
+
concurrent-ruby (1.0.2)
|
52
|
+
erubis (2.7.0)
|
53
|
+
execjs (2.7.0)
|
54
|
+
globalid (0.3.7)
|
55
|
+
activesupport (>= 4.1.0)
|
56
|
+
i18n (0.7.0)
|
57
|
+
json (1.8.3)
|
58
|
+
loofah (2.0.3)
|
59
|
+
nokogiri (>= 1.5.9)
|
60
|
+
mail (2.6.4)
|
61
|
+
mime-types (>= 1.16, < 4)
|
62
|
+
mime-types (3.1)
|
63
|
+
mime-types-data (~> 3.2015)
|
64
|
+
mime-types-data (3.2016.0521)
|
65
|
+
mini_portile2 (2.1.0)
|
66
|
+
minitest (5.10.1)
|
67
|
+
nokogiri (1.6.8.1)
|
68
|
+
mini_portile2 (~> 2.1.0)
|
69
|
+
power_assert (0.3.1)
|
70
|
+
rack (1.6.5)
|
71
|
+
rack-test (0.6.3)
|
72
|
+
rack (>= 1.0)
|
73
|
+
rails (4.2.7.1)
|
74
|
+
actionmailer (= 4.2.7.1)
|
75
|
+
actionpack (= 4.2.7.1)
|
76
|
+
actionview (= 4.2.7.1)
|
77
|
+
activejob (= 4.2.7.1)
|
78
|
+
activemodel (= 4.2.7.1)
|
79
|
+
activerecord (= 4.2.7.1)
|
80
|
+
activesupport (= 4.2.7.1)
|
81
|
+
bundler (>= 1.3.0, < 2.0)
|
82
|
+
railties (= 4.2.7.1)
|
83
|
+
sprockets-rails
|
84
|
+
rails-deprecated_sanitizer (1.0.3)
|
85
|
+
activesupport (>= 4.2.0.alpha)
|
86
|
+
rails-dom-testing (1.0.7)
|
87
|
+
activesupport (>= 4.2.0.beta, < 5.0)
|
88
|
+
nokogiri (~> 1.6.0)
|
89
|
+
rails-deprecated_sanitizer (>= 1.0.1)
|
90
|
+
rails-html-sanitizer (1.0.3)
|
91
|
+
loofah (~> 2.0)
|
92
|
+
railties (4.2.7.1)
|
93
|
+
actionpack (= 4.2.7.1)
|
94
|
+
activesupport (= 4.2.7.1)
|
95
|
+
rake (>= 0.8.7)
|
96
|
+
thor (>= 0.18.1, < 2.0)
|
97
|
+
rake (10.5.0)
|
98
|
+
sprockets (3.7.0)
|
99
|
+
concurrent-ruby (~> 1.0)
|
100
|
+
rack (> 1, < 3)
|
101
|
+
sprockets-rails (3.2.0)
|
102
|
+
actionpack (>= 4.0)
|
103
|
+
activesupport (>= 4.0)
|
104
|
+
sprockets (>= 3.0.0)
|
105
|
+
test-unit (3.1.9)
|
106
|
+
power_assert
|
107
|
+
thor (0.19.4)
|
108
|
+
thread_safe (0.3.5)
|
109
|
+
tzinfo (1.2.2)
|
110
|
+
thread_safe (~> 0.1)
|
111
|
+
|
112
|
+
PLATFORMS
|
113
|
+
ruby
|
114
|
+
|
115
|
+
DEPENDENCIES
|
116
|
+
appraisal (~> 2.1)
|
117
|
+
bundler (~> 1.7)
|
118
|
+
optimize-js!
|
119
|
+
rails (~> 4)
|
120
|
+
rake (~> 10.0)
|
121
|
+
sprockets (~> 3)
|
122
|
+
test-unit (~> 3.1)
|
123
|
+
|
124
|
+
BUNDLED WITH
|
125
|
+
1.13.2
|
@@ -0,0 +1,129 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../
|
3
|
+
specs:
|
4
|
+
optimize-js (1.0)
|
5
|
+
execjs (>= 1)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
actioncable (5.0.0.1)
|
11
|
+
actionpack (= 5.0.0.1)
|
12
|
+
nio4r (~> 1.2)
|
13
|
+
websocket-driver (~> 0.6.1)
|
14
|
+
actionmailer (5.0.0.1)
|
15
|
+
actionpack (= 5.0.0.1)
|
16
|
+
actionview (= 5.0.0.1)
|
17
|
+
activejob (= 5.0.0.1)
|
18
|
+
mail (~> 2.5, >= 2.5.4)
|
19
|
+
rails-dom-testing (~> 2.0)
|
20
|
+
actionpack (5.0.0.1)
|
21
|
+
actionview (= 5.0.0.1)
|
22
|
+
activesupport (= 5.0.0.1)
|
23
|
+
rack (~> 2.0)
|
24
|
+
rack-test (~> 0.6.3)
|
25
|
+
rails-dom-testing (~> 2.0)
|
26
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
27
|
+
actionview (5.0.0.1)
|
28
|
+
activesupport (= 5.0.0.1)
|
29
|
+
builder (~> 3.1)
|
30
|
+
erubis (~> 2.7.0)
|
31
|
+
rails-dom-testing (~> 2.0)
|
32
|
+
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
33
|
+
activejob (5.0.0.1)
|
34
|
+
activesupport (= 5.0.0.1)
|
35
|
+
globalid (>= 0.3.6)
|
36
|
+
activemodel (5.0.0.1)
|
37
|
+
activesupport (= 5.0.0.1)
|
38
|
+
activerecord (5.0.0.1)
|
39
|
+
activemodel (= 5.0.0.1)
|
40
|
+
activesupport (= 5.0.0.1)
|
41
|
+
arel (~> 7.0)
|
42
|
+
activesupport (5.0.0.1)
|
43
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
44
|
+
i18n (~> 0.7)
|
45
|
+
minitest (~> 5.1)
|
46
|
+
tzinfo (~> 1.1)
|
47
|
+
appraisal (2.1.0)
|
48
|
+
bundler
|
49
|
+
rake
|
50
|
+
thor (>= 0.14.0)
|
51
|
+
arel (7.1.4)
|
52
|
+
builder (3.2.2)
|
53
|
+
concurrent-ruby (1.0.2)
|
54
|
+
erubis (2.7.0)
|
55
|
+
execjs (2.7.0)
|
56
|
+
globalid (0.3.7)
|
57
|
+
activesupport (>= 4.1.0)
|
58
|
+
i18n (0.7.0)
|
59
|
+
loofah (2.0.3)
|
60
|
+
nokogiri (>= 1.5.9)
|
61
|
+
mail (2.6.4)
|
62
|
+
mime-types (>= 1.16, < 4)
|
63
|
+
method_source (0.8.2)
|
64
|
+
mime-types (3.1)
|
65
|
+
mime-types-data (~> 3.2015)
|
66
|
+
mime-types-data (3.2016.0521)
|
67
|
+
mini_portile2 (2.1.0)
|
68
|
+
minitest (5.10.1)
|
69
|
+
nio4r (1.2.1)
|
70
|
+
nokogiri (1.6.8.1)
|
71
|
+
mini_portile2 (~> 2.1.0)
|
72
|
+
power_assert (0.4.1)
|
73
|
+
rack (2.0.1)
|
74
|
+
rack-test (0.6.3)
|
75
|
+
rack (>= 1.0)
|
76
|
+
rails (5.0.0.1)
|
77
|
+
actioncable (= 5.0.0.1)
|
78
|
+
actionmailer (= 5.0.0.1)
|
79
|
+
actionpack (= 5.0.0.1)
|
80
|
+
actionview (= 5.0.0.1)
|
81
|
+
activejob (= 5.0.0.1)
|
82
|
+
activemodel (= 5.0.0.1)
|
83
|
+
activerecord (= 5.0.0.1)
|
84
|
+
activesupport (= 5.0.0.1)
|
85
|
+
bundler (>= 1.3.0, < 2.0)
|
86
|
+
railties (= 5.0.0.1)
|
87
|
+
sprockets-rails (>= 2.0.0)
|
88
|
+
rails-dom-testing (2.0.1)
|
89
|
+
activesupport (>= 4.2.0, < 6.0)
|
90
|
+
nokogiri (~> 1.6.0)
|
91
|
+
rails-html-sanitizer (1.0.3)
|
92
|
+
loofah (~> 2.0)
|
93
|
+
railties (5.0.0.1)
|
94
|
+
actionpack (= 5.0.0.1)
|
95
|
+
activesupport (= 5.0.0.1)
|
96
|
+
method_source
|
97
|
+
rake (>= 0.8.7)
|
98
|
+
thor (>= 0.18.1, < 2.0)
|
99
|
+
rake (10.5.0)
|
100
|
+
sprockets (3.7.0)
|
101
|
+
concurrent-ruby (~> 1.0)
|
102
|
+
rack (> 1, < 3)
|
103
|
+
sprockets-rails (3.2.0)
|
104
|
+
actionpack (>= 4.0)
|
105
|
+
activesupport (>= 4.0)
|
106
|
+
sprockets (>= 3.0.0)
|
107
|
+
test-unit (3.2.3)
|
108
|
+
power_assert
|
109
|
+
thor (0.19.4)
|
110
|
+
thread_safe (0.3.5)
|
111
|
+
tzinfo (1.2.2)
|
112
|
+
thread_safe (~> 0.1)
|
113
|
+
websocket-driver (0.6.4)
|
114
|
+
websocket-extensions (>= 0.1.0)
|
115
|
+
websocket-extensions (0.1.2)
|
116
|
+
|
117
|
+
PLATFORMS
|
118
|
+
ruby
|
119
|
+
|
120
|
+
DEPENDENCIES
|
121
|
+
appraisal (~> 2.1)
|
122
|
+
bundler (~> 1.7)
|
123
|
+
optimize-js!
|
124
|
+
rails (~> 5)
|
125
|
+
rake (~> 10.0)
|
126
|
+
test-unit (~> 3.1)
|
127
|
+
|
128
|
+
BUNDLED WITH
|
129
|
+
1.13.2
|
data/lib/optimize-js.rb
CHANGED
@@ -6,13 +6,13 @@ require 'execjs'
|
|
6
6
|
module OptimizeJS
|
7
7
|
class << self
|
8
8
|
def perform(js, options = {})
|
9
|
-
@optimize_js ||= ExecJS.runtime.compile(js_path)
|
9
|
+
@optimize_js ||= ExecJS.runtime.compile(File.read(js_path))
|
10
10
|
raise OptimizeJS::CompileError unless @optimize_js
|
11
11
|
@optimize_js.call(js_function, js, options)
|
12
12
|
end
|
13
13
|
|
14
14
|
def js_path
|
15
|
-
File.
|
15
|
+
File.expand_path('../optimize-js.web.min.js', File.dirname(__FILE__))
|
16
16
|
end
|
17
17
|
|
18
18
|
def js_function
|
data/lib/optimize-js/version.rb
CHANGED
data/optimize-js.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.author = 'Yaroslav Konoplov'
|
11
11
|
s.email = 'eahome00@gmail.com'
|
12
12
|
s.summary = 'Ruby wrapper and Rails asset pipeline integration for optimize-js.'
|
13
|
-
s.description = 'optimize-js makes JavaScript
|
13
|
+
s.description = 'optimize-js makes JavaScript scripts initialize faster. This gem provides Ruby and Rails asset pipeline integration for optimize-js.'
|
14
14
|
s.homepage = 'https://github.com/yivo/optimize-js'
|
15
15
|
s.license = 'MIT'
|
16
16
|
|
@@ -22,5 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
|
23
23
|
s.add_dependency 'execjs', '>= 1'
|
24
24
|
s.add_development_dependency 'bundler', '~> 1.7'
|
25
|
-
s.add_development_dependency 'rake',
|
25
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
s.add_development_dependency 'appraisal', '~> 2.1'
|
27
|
+
s.add_development_dependency 'test-unit', '~> 3.1'
|
26
28
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
!function() {}();
|
data/test/test-optimize-js.rb
CHANGED
@@ -5,7 +5,9 @@ require 'optimize-js'
|
|
5
5
|
require 'test/unit'
|
6
6
|
|
7
7
|
class OptimizeJSTest < Test::Unit::TestCase
|
8
|
-
def
|
9
|
-
assert_equal '!
|
8
|
+
def test_api
|
9
|
+
assert_equal OptimizeJS.perform('!function() {}()'), '!(function() {})()'
|
10
|
+
assert_match /optimize-js\.web\.min\.js/, OptimizeJS.js_path
|
11
|
+
assert_match /optimize/, OptimizeJS.js_function
|
10
12
|
end
|
11
13
|
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'optimize-js'
|
5
|
+
require 'test/unit'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
class RailsIntegrationTest < Test::Unit::TestCase
|
9
|
+
def test_registration
|
10
|
+
app = create_rails_application
|
11
|
+
app.initialize!
|
12
|
+
|
13
|
+
assert app.assets.bundle_processors.key?('application/javascript')
|
14
|
+
assert Array === app.assets.bundle_processors['application/javascript']
|
15
|
+
assert app.assets.bundle_processors['application/javascript'].include?(OptimizeJS::SprocketsProcessor)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_compilation
|
19
|
+
app = create_rails_application
|
20
|
+
app.initialize!
|
21
|
+
task = create_sprockets_task(app)
|
22
|
+
|
23
|
+
task.instance_exec { manifest.compile(assets) }
|
24
|
+
assert_equal app.assets['application.js'].to_s.strip, '!(function() {})();'
|
25
|
+
end
|
26
|
+
|
27
|
+
def setup
|
28
|
+
super
|
29
|
+
clear_tmp
|
30
|
+
end
|
31
|
+
|
32
|
+
def teardown
|
33
|
+
super
|
34
|
+
clear_tmp
|
35
|
+
Rails.application = nil if defined?(Rails)
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
def create_rails_application
|
40
|
+
require 'rails'
|
41
|
+
require 'sprockets/railtie'
|
42
|
+
require 'optimize-js/railtie'
|
43
|
+
|
44
|
+
Class.new(Rails::Application) do
|
45
|
+
config.eager_load = false
|
46
|
+
config.assets.enabled = true
|
47
|
+
config.assets.gzip = false
|
48
|
+
config.assets.paths = [Rails.root.join('test/fixtures/javascripts').to_s]
|
49
|
+
config.assets.precompile = %w( 'application.js' )
|
50
|
+
config.paths['public'] = Rails.root.join('tmp').to_s
|
51
|
+
config.active_support.deprecation = :stderr
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_sprockets_task(app)
|
56
|
+
require 'sprockets/version' # Fix for sprockets 2.x
|
57
|
+
|
58
|
+
if Sprockets::VERSION.start_with?('2')
|
59
|
+
require 'rake/sprocketstask'
|
60
|
+
Rake::SprocketsTask.new do |t|
|
61
|
+
t.environment = app.assets
|
62
|
+
t.output = "#{app.config.paths['public']}#{app.config.assets.prefix}"
|
63
|
+
t.assets = app.config.assets.precompile
|
64
|
+
end
|
65
|
+
else
|
66
|
+
require 'sprockets/rails/task'
|
67
|
+
Sprockets::Rails::Task.new(app)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def clear_tmp
|
72
|
+
FileUtils.rm_rf(File.expand_path('../../tmp', __FILE__))
|
73
|
+
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optimize-js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yaroslav Konoplov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|
@@ -52,8 +52,36 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
|
56
|
-
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: appraisal
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.1'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: test-unit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.1'
|
83
|
+
description: optimize-js makes JavaScript scripts initialize faster. This gem provides
|
84
|
+
Ruby and Rails asset pipeline integration for optimize-js.
|
57
85
|
email: eahome00@gmail.com
|
58
86
|
executables: []
|
59
87
|
extensions: []
|
@@ -61,18 +89,31 @@ extra_rdoc_files: []
|
|
61
89
|
files:
|
62
90
|
- ".gitignore"
|
63
91
|
- ".travis.yml"
|
92
|
+
- Appraisals
|
64
93
|
- Gemfile
|
94
|
+
- Gemfile.lock
|
65
95
|
- LICENCE
|
66
96
|
- OPTIMIZE-JS-LICENCE
|
67
97
|
- README.md
|
68
98
|
- Rakefile
|
99
|
+
- gemfiles/rails_3.gemfile
|
100
|
+
- gemfiles/rails_3.gemfile.lock
|
101
|
+
- gemfiles/rails_4_with_sprockets_2.gemfile
|
102
|
+
- gemfiles/rails_4_with_sprockets_2.gemfile.lock
|
103
|
+
- gemfiles/rails_4_with_sprockets_3.gemfile
|
104
|
+
- gemfiles/rails_4_with_sprockets_3.gemfile.lock
|
105
|
+
- gemfiles/rails_5.gemfile
|
106
|
+
- gemfiles/rails_5.gemfile.lock
|
69
107
|
- lib/optimize-js.rb
|
70
108
|
- lib/optimize-js/railtie.rb
|
71
109
|
- lib/optimize-js/sprockets-processor.rb
|
72
110
|
- lib/optimize-js/version.rb
|
73
111
|
- optimize-js.gemspec
|
74
112
|
- optimize-js.web.min.js
|
113
|
+
- test/fixtures/javascripts/application.js
|
75
114
|
- test/test-optimize-js.rb
|
115
|
+
- test/test-rails-integration.rb
|
116
|
+
- test/test-sprockets-integration.rb
|
76
117
|
homepage: https://github.com/yivo/optimize-js
|
77
118
|
licenses:
|
78
119
|
- MIT
|
@@ -98,4 +139,7 @@ signing_key:
|
|
98
139
|
specification_version: 4
|
99
140
|
summary: Ruby wrapper and Rails asset pipeline integration for optimize-js.
|
100
141
|
test_files:
|
142
|
+
- test/fixtures/javascripts/application.js
|
101
143
|
- test/test-optimize-js.rb
|
144
|
+
- test/test-rails-integration.rb
|
145
|
+
- test/test-sprockets-integration.rb
|