rack-zippy 1.2.1 → 2.0.0
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.
- data/.gitignore +1 -1
- data/CHANGELOG.md +10 -0
- data/Gemfile +2 -1
- data/Guardfile +7 -0
- data/README.md +56 -3
- data/lib/rack-zippy.rb +34 -82
- data/lib/rack-zippy/asset_compiler.rb +39 -0
- data/lib/rack-zippy/serveable_file.rb +138 -0
- data/lib/rack-zippy/version.rb +1 -1
- data/test/asset_server_test.rb +331 -353
- data/test/null_asset_compiler_test.rb +14 -0
- data/test/public/foo/bar.html +8 -0
- data/test/public/foo/index.html +11 -0
- data/test/public/index.html +8 -0
- data/test/public/thanks.html +1 -0
- data/test/rails_asset_compiler_test.rb +46 -0
- data/test/serveable_file_test.rb +468 -0
- data/test/test_helper.rb +40 -2
- metadata +17 -8
data/test/test_helper.rb
CHANGED
@@ -6,7 +6,7 @@ Bundler.require :default, :development
|
|
6
6
|
require 'test/unit'
|
7
7
|
require 'rack/test'
|
8
8
|
|
9
|
-
module
|
9
|
+
module RailsEnvironmentStub
|
10
10
|
|
11
11
|
@@public_path = '/default/path/to/public/set/in/test_helper'
|
12
12
|
|
@@ -25,4 +25,42 @@ module Rails
|
|
25
25
|
@@public_path = path
|
26
26
|
end
|
27
27
|
|
28
|
-
|
28
|
+
def self.version
|
29
|
+
return 'Rails.version stub'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class TestCase < ::Test::Unit::TestCase
|
35
|
+
|
36
|
+
DURATIONS_IN_SECS = {:year => 31536000, :month => 2678400, :day => 86400}.freeze
|
37
|
+
|
38
|
+
def ensure_correct_working_directory
|
39
|
+
is_project_root_working_directory = ::File.exists?('rack-zippy.gemspec')
|
40
|
+
if is_project_root_working_directory
|
41
|
+
@original_dir = Dir.pwd
|
42
|
+
Dir.chdir 'test'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def revert_to_original_working_directory
|
47
|
+
Dir.chdir @original_dir if @original_dir
|
48
|
+
end
|
49
|
+
|
50
|
+
def asset_root
|
51
|
+
"#{Dir.pwd}/public"
|
52
|
+
end
|
53
|
+
|
54
|
+
def enter_rails_env
|
55
|
+
Object.send(:const_set, :Rails, ::RailsEnvironmentStub) unless defined?(::Rails)
|
56
|
+
end
|
57
|
+
|
58
|
+
def exit_rails_env
|
59
|
+
Object.send(:remove_const, :Rails)
|
60
|
+
end
|
61
|
+
|
62
|
+
def in_rails_env?
|
63
|
+
return defined?(::Rails)
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-zippy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07
|
12
|
+
date: 2014-12-07 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Rack middleware for serving static gzipped assets generated by the Rails
|
15
15
|
asset pipeline
|
@@ -22,13 +22,17 @@ files:
|
|
22
22
|
- .gitignore
|
23
23
|
- CHANGELOG.md
|
24
24
|
- Gemfile
|
25
|
+
- Guardfile
|
25
26
|
- LICENSE
|
26
27
|
- README.md
|
27
28
|
- Rakefile
|
28
29
|
- lib/rack-zippy.rb
|
30
|
+
- lib/rack-zippy/asset_compiler.rb
|
31
|
+
- lib/rack-zippy/serveable_file.rb
|
29
32
|
- lib/rack-zippy/version.rb
|
30
33
|
- rack-zippy.gemspec
|
31
34
|
- test/asset_server_test.rb
|
35
|
+
- test/null_asset_compiler_test.rb
|
32
36
|
- test/public/assets/application.css
|
33
37
|
- test/public/assets/application.css.gz
|
34
38
|
- test/public/assets/application.js
|
@@ -37,8 +41,13 @@ files:
|
|
37
41
|
- test/public/assets/favicon.ico
|
38
42
|
- test/public/assets/rails.png
|
39
43
|
- test/public/favicon.ico
|
44
|
+
- test/public/foo/bar.html
|
45
|
+
- test/public/foo/index.html
|
46
|
+
- test/public/index.html
|
40
47
|
- test/public/robots.txt
|
41
48
|
- test/public/thanks.html
|
49
|
+
- test/rails_asset_compiler_test.rb
|
50
|
+
- test/serveable_file_test.rb
|
42
51
|
- test/test_helper.rb
|
43
52
|
- video-player.png
|
44
53
|
homepage: https://github.com/eliotsykes/rack-zippy
|
@@ -54,18 +63,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
54
63
|
- - ! '>='
|
55
64
|
- !ruby/object:Gem::Version
|
56
65
|
version: '0'
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
hash: 1496083500993811016
|
60
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
67
|
none: false
|
62
68
|
requirements:
|
63
69
|
- - ! '>='
|
64
70
|
- !ruby/object:Gem::Version
|
65
71
|
version: '0'
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
hash: 1496083500993811016
|
69
72
|
requirements: []
|
70
73
|
rubyforge_project:
|
71
74
|
rubygems_version: 1.8.23.2
|
@@ -75,6 +78,7 @@ summary: Rack middleware for serving static gzipped assets generated by the Rail
|
|
75
78
|
asset pipeline
|
76
79
|
test_files:
|
77
80
|
- test/asset_server_test.rb
|
81
|
+
- test/null_asset_compiler_test.rb
|
78
82
|
- test/public/assets/application.css
|
79
83
|
- test/public/assets/application.css.gz
|
80
84
|
- test/public/assets/application.js
|
@@ -83,6 +87,11 @@ test_files:
|
|
83
87
|
- test/public/assets/favicon.ico
|
84
88
|
- test/public/assets/rails.png
|
85
89
|
- test/public/favicon.ico
|
90
|
+
- test/public/foo/bar.html
|
91
|
+
- test/public/foo/index.html
|
92
|
+
- test/public/index.html
|
86
93
|
- test/public/robots.txt
|
87
94
|
- test/public/thanks.html
|
95
|
+
- test/rails_asset_compiler_test.rb
|
96
|
+
- test/serveable_file_test.rb
|
88
97
|
- test/test_helper.rb
|