roger_autoprefixer 1.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.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NzZhNTAxZjkyZWJhZWIwMTMxMzdjOTE5ZTgwOWY5ZjU1NjRmMWEwMw==
5
+ data.tar.gz: !binary |-
6
+ Y2YxZThiNDY1MGRlODA4NzQzMjI1OTFiNDU0ZmE2OTEzMjY3OTQ3Mg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NzA3Y2YwYWY0OGU1ZmFjMjM4NWMxNDY2MmQ0MmI1M2RhOGM1NTcyODU0MWE1
10
+ YTMxZDJhMGI3NzRmY2U2OWE4NDc3YzNlMWFkYTg3M2FiNTdjZDE2N2E3ODdi
11
+ YWUzNTgwNGMyNjZjODIyN2NkMGRkYjRkMGViNjJjMDE3MjA4ODg=
12
+ data.tar.gz: !binary |-
13
+ MmQxMDU5YmY5ZDQ1NjM3ZmJmNmIwZmY4Y2RjZWFlZDVlNjcyYWJlNDc3MjU4
14
+ OWQwM2VmNjM2ZDgzYzgyODNlMGI4ZjA5ZjhlZGNiZWIwOWRkYjdkZjFkZWE1
15
+ Zjk4NWIxN2Q5NjE4MzUyZTI4NzZmMjlmYjlhZjQ1ZmIyZWM2N2I=
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## Version 1.0.0
4
+ * Make the autoprefixer work with Roger!
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Flurin Egger, DigitPaint (http://www.digitpaint.nl)
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Roger Autoprefixer
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/roger_autoprefixer.png)](http://badge.fury.io/rb/roger_autoprefixer)
4
+
5
+ Autoprefixer Middleware and Processor for Roger
6
+
7
+ ## Changes and versions
8
+
9
+ Have a look at the [CHANGELOG](CHANGELOG.md) to see what's new.
10
+
11
+ ## Contributors
12
+
13
+ [View contributors](https://github.com/digitpaint/roger_autoprefixer/graphs/contributors)
14
+
15
+ ## License
16
+
17
+ MIT License, see [LICENSE](LICENSE) for more info.
@@ -0,0 +1,9 @@
1
+ module RogerAutoprefixer
2
+ end
3
+
4
+ # Dependencies
5
+ require 'autoprefixer-rails'
6
+
7
+ # Load modules
8
+ require File.dirname(__FILE__) + "/roger_autoprefixer/middleware"
9
+ require File.dirname(__FILE__) + "/roger_autoprefixer/processor"
@@ -0,0 +1,27 @@
1
+ module RogerAutoprefixer
2
+ class Middleware
3
+ def initialize(app, options={})
4
+ @app = app
5
+ @options = {
6
+ :skip => []
7
+ }.update(options)
8
+ end
9
+
10
+ def call(env)
11
+ status, headers, body = @app.call(env)
12
+
13
+ if status == 200 && headers["Content-Type"].to_s.include?("text/css") && !@options[:skip].detect{|r| r.match(env["PATH_INFO"]) }
14
+ body_str = []
15
+ body.each{|f| body_str << f }
16
+ body_str = body_str.join
17
+
18
+ # This is a dirty little hack to always enforce UTF8
19
+ body_str.force_encoding("UTF-8")
20
+
21
+ Rack::Response.new(AutoprefixerRails.compile(body_str), status, headers).finish
22
+ else
23
+ [status, headers, body]
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,30 @@
1
+ module RogerAutoprefixer
2
+ class Processor
3
+ # @option options [Array] :match An array of shell globs, defaults to ["stylesheets/**/*.scss"]
4
+ # @option options [Array] :skip An array of regexps which will be skipped, defaults to [/_.*\.scss\Z/], Attention! Skipped files will be deleted as well!
5
+ def call(release, options={})
6
+ options = {
7
+ :match => ["stylesheets/**/*.css"],
8
+ :skip => []
9
+ }.update(options)
10
+
11
+ match = options.delete(:match)
12
+ skip = options.delete(:skip)
13
+
14
+ # Prefix CSS files
15
+ files = release.get_files(match)
16
+ files.each do |f|
17
+ if !skip.detect{|r| r.match(f) }
18
+ release.log(self, "Processing: #{f}")
19
+ # Compile SCSS
20
+ content = File.read(f)
21
+ File.open(f, "w") do |fh|
22
+ fh.write AutoprefixerRails.compile(content)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ Roger::Release::Processors.register(:autoprefixer, RogerAutoprefixer::Processor)
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "roger_autoprefixer"
5
+ s.version = "1.0.0"
6
+
7
+ s.authors = ["Flurin Egger"]
8
+ s.email = ["info@digitpaint.nl", "flurin@digitpaint.nl"]
9
+ s.homepage = "http://github.com/digitpaint/roger_autoprefixer"
10
+ s.summary = "Rack middleware and processor for using autoprefixer with Roger."
11
+ s.licenses = ["MIT"]
12
+
13
+ s.date = Time.now.strftime("%Y-%m-%d")
14
+
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
+ s.require_paths = ["lib"]
19
+
20
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
21
+
22
+ s.add_dependency("roger", ["~> 0.11.0"])
23
+ s.add_dependency("autoprefixer-rails", ["~> 0.8.0"])
24
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: roger_autoprefixer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Flurin Egger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: roger
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.11.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.11.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: autoprefixer-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.8.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 0.8.0
41
+ description:
42
+ email:
43
+ - info@digitpaint.nl
44
+ - flurin@digitpaint.nl
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - CHANGELOG.md
50
+ - LICENSE
51
+ - README.md
52
+ - lib/roger_autoprefixer.rb
53
+ - lib/roger_autoprefixer/middleware.rb
54
+ - lib/roger_autoprefixer/processor.rb
55
+ - roger_autoprefixer.gemspec
56
+ homepage: http://github.com/digitpaint/roger_autoprefixer
57
+ licenses:
58
+ - MIT
59
+ metadata: {}
60
+ post_install_message:
61
+ rdoc_options: []
62
+ require_paths:
63
+ - lib
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.1.5
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: Rack middleware and processor for using autoprefixer with Roger.
80
+ test_files: []