html_compress 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +1 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +22 -0
- data/README.md +25 -0
- data/Rakefile +1 -0
- data/html_compress.gemspec +25 -0
- data/lib/html_compress.rb +6 -0
- data/lib/html_compress/middleware.rb +25 -0
- data/lib/html_compress/railtie.rb +7 -0
- data/lib/html_compress/version.rb +3 -0
- data/spec/html_compress/middleware_spec.rb +0 -0
- data/spec/html_compress/railtie_spec.rb +0 -0
- data/spec/html_compress/version_spec.rb +0 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NDQxYWFmOThkNTE2ODhjNGQ5NTJmZGM3NTJmNmZkYjk1YjRiODFmYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjhjOTcwMmM3MjZmNDc1OGI3NTE1MmE3YWExZDA3Y2YzNWRhOGRkOA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTM5YTM4ODg5ZmE0NmE5ZWQwMjkxMWJmYTQ4MTkwNDU3NWJlYTUwMDE3NTY0
|
10
|
+
YjY3NTYyYmYzNWVlN2VmNzBlNzQ0NGJjNzcwOTUxNjM1OTkyNDEzMDFjMzE2
|
11
|
+
OWJkNjdmN2UyMjAyMDUxNmE3ZGNjNWJmOTFkMTUxMWMwNmQ3Mzk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZWEwNDBlZDVlZjEzYzRiNDFlZGExZjkxOTgyOWI0NWIyZWE0MTAyZGEyZmRj
|
14
|
+
Yjg4NWE4MDIzMDVmNDY3NWQ2YjE4NzhlMWIzMmU5NTA0MDhiY2ZkMGQ5NzRk
|
15
|
+
YjJmOWJhZTFjZTIyODI3MmNlNTI2ZjUwYzNiMjcwNjg3YzY5Mzg=
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Washington Botelho
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# HtmlCompress
|
2
|
+
|
3
|
+
It is a HTML compress rack middleware.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'html_compress'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install html_compress
|
18
|
+
|
19
|
+
## Contributing
|
20
|
+
|
21
|
+
1. Fork it
|
22
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
23
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
24
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
25
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'html_compress/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.authors = ['Washington Botelho']
|
9
|
+
s.description = 'A HTML compress rack middleware'
|
10
|
+
s.email = ['wbotelhos@gmail.com']
|
11
|
+
s.executables = s.files.grep(%r(^bin/)) { |f| File.basename f }
|
12
|
+
s.files = `git ls-files`.split("\n")
|
13
|
+
s.homepage = ''
|
14
|
+
s.license = 'MIT'
|
15
|
+
s.name = 'html_compress'
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.summary = 'A HTML compress rack middleware'
|
18
|
+
s.test_files = s.files.grep(%r(^(spec)/))
|
19
|
+
s.version = HtmlCompress::VERSION
|
20
|
+
|
21
|
+
s.add_dependency 'html_press', '~> 0.8.2'
|
22
|
+
|
23
|
+
s.add_development_dependency 'bundler', '~> 1.3'
|
24
|
+
s.add_development_dependency 'rake'
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'html_press'
|
2
|
+
|
3
|
+
module HtmlCompress
|
4
|
+
class Middleware
|
5
|
+
def initialize(app)
|
6
|
+
@app = app
|
7
|
+
end
|
8
|
+
|
9
|
+
def call(env)
|
10
|
+
status, headers, @response = @app.call env
|
11
|
+
|
12
|
+
content_type = headers['Content-Type']
|
13
|
+
|
14
|
+
compress_body! if content_type.present? && content_type.include?('text/html')
|
15
|
+
|
16
|
+
[status, headers, @response]
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def compress_body!
|
22
|
+
@response.body = HtmlPress.press @response.body
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: html_compress
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Washington Botelho
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: html_press
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.8.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.8.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: A HTML compress rack middleware
|
56
|
+
email:
|
57
|
+
- wbotelhos@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- .gitignore
|
63
|
+
- Gemfile
|
64
|
+
- LICENSE.txt
|
65
|
+
- README.md
|
66
|
+
- Rakefile
|
67
|
+
- html_compress.gemspec
|
68
|
+
- lib/html_compress.rb
|
69
|
+
- lib/html_compress/middleware.rb
|
70
|
+
- lib/html_compress/railtie.rb
|
71
|
+
- lib/html_compress/version.rb
|
72
|
+
- spec/html_compress/middleware_spec.rb
|
73
|
+
- spec/html_compress/railtie_spec.rb
|
74
|
+
- spec/html_compress/version_spec.rb
|
75
|
+
homepage: ''
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ! '>='
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
requirements: []
|
94
|
+
rubyforge_project:
|
95
|
+
rubygems_version: 2.1.9
|
96
|
+
signing_key:
|
97
|
+
specification_version: 4
|
98
|
+
summary: A HTML compress rack middleware
|
99
|
+
test_files:
|
100
|
+
- spec/html_compress/middleware_spec.rb
|
101
|
+
- spec/html_compress/railtie_spec.rb
|
102
|
+
- spec/html_compress/version_spec.rb
|