roger_yuicompressor 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ N2M3NWMxYzI1ODVmZDgzODhkNzQ2YjE0ZGFlZTQzMTMyYjI1MWViOA==
5
+ data.tar.gz: !binary |-
6
+ ZTgwNjFjZmI3MmUyN2YxNWE2Y2E0OTc5ZGNlM2FhMTY4YzljOTc2ZA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ OTVlN2VjOWNlMDFhYmJmOWU4MTYzODA4OTM4Y2Q3MWQ2NDlhMzgzYzNmNGM1
10
+ NDI1YTg4Y2U5MTUyMTJhZjlmMzgwNDIxNTcwNTQzZjM0NWJlNTViOTJhNzVm
11
+ MjdhYjFjOTAzNmQ5NzIzMjIwODI3YzQ0OTg1MGQ1NDhjZWNhYjM=
12
+ data.tar.gz: !binary |-
13
+ Y2I0NDUyZmNjYWM2ZjVmZjY2YmEzNDA4MzQ2YjMyNWIxMGFhOTY3MDM0OWNk
14
+ MmNmOTJkNjAyNTZmNDUyZjNiNTBjYWYzM2Q5MDc1NDYzNzIzY2MzNGZmMDhj
15
+ ZTUxOTFjZDBjNjJjYjE5NDNhMDBhNWMxNzVjMGFmMTJmNjFlZmY=
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## Version 1.0.0
4
+ * First version extracted from Roger
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 DigitPaint
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # Roger YUICompressor
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/roger_yuicompressor.png)](http://badge.fury.io/rb/roger_yuicompressor)
4
+ [![Build Status](https://travis-ci.org/DigitPaint/roger_yuicompressor.png?branch=master)](https://travis-ci.org/DigitPaint/roger_yuicompressor)
5
+
6
+ YUICompressor processor for Roger
7
+
8
+ ## Changes and versions
9
+
10
+ Have a look at the [CHANGELOG](CHANGELOG.md) to see what's new.
11
+
12
+ ## Contributors
13
+
14
+ [View contributors](https://github.com/digitpaint/roger_yuicompressor/graphs/contributors)
15
+
16
+ ## License
17
+
18
+ MIT License, see [LICENSE](LICENSE) for more info.
@@ -0,0 +1,57 @@
1
+ module RogerYuicompressor
2
+ class Yuicompressor < Roger::Release::Processors::Base
3
+
4
+ # Compresses all JS and CSS files, it will keep all lines before
5
+ #
6
+ # /* -------------------------------------------------------------------------------- */
7
+ #
8
+ # (80 dashes)
9
+ #
10
+ # @options options [Array] match Files to match, default to ["**/*.{css,js}"]
11
+ # @options options [Regexp] :delimiter An array of header delimiters. Defaults to the one above. The delimiter will be removed from the output.
12
+ # @options options [Array[Regexp]] :skip An array of file regular expressions to specifiy which files to skip. Defaults to [/javascripts\/vendor\/.\*.js\Z/, /_doc\/.*/]
13
+ def call(release, options={})
14
+ options = {
15
+ :match => ["**/*.{css,js}"],
16
+ :skip => [/javascripts\/vendor\/.*\.js\Z/, /_doc\/.*/],
17
+ :delimiter => Regexp.escape("/* -------------------------------------------------------------------------------- */")
18
+ }.update(options)
19
+
20
+ compressor_options = {:line_break => 80}
21
+ css_compressor = YUI::CssCompressor.new(compressor_options)
22
+ js_compressor = YUI::JavaScriptCompressor.new(compressor_options)
23
+
24
+ release.log self, "Minifying #{options[:match].inspect}"
25
+
26
+ # Add version numbers and minify the files
27
+ release.get_files(options[:match], options[:skip]).each do |f|
28
+ type = f[/\.([^.]+)\Z/,1]
29
+
30
+ data = File.read(f);
31
+ File.open(f,"w") do |fh|
32
+
33
+ # Extract header and store for later use
34
+ header = data[/\A(.+?)\n#{options[:delimiter]}\s*\n/m,1]
35
+ minified = [header]
36
+
37
+ # Actual minification
38
+ release.debug self, "Minifying #{f}"
39
+ case type
40
+ when "css"
41
+ minified << css_compressor.compress(data)
42
+ when "js"
43
+ minified << js_compressor.compress(data)
44
+ else
45
+ release.warn self, "Error minifying: encountered unknown type \"#{type}\""
46
+ minified << data
47
+ end
48
+
49
+ fh.write minified.join("\n")
50
+ end
51
+ end
52
+
53
+ end
54
+ end
55
+ end
56
+
57
+ Roger::Release::Processors.register(:yuicompressor, RogerYuicompressor::Yuicompressor)
@@ -0,0 +1,8 @@
1
+ module RogerYuicompressor
2
+ end
3
+
4
+ # Dependencies
5
+ require 'yui/compressor'
6
+
7
+ # Load modules
8
+ require File.dirname(__FILE__) + "/roger_yuicompressor/processor"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "roger_yuicompressor"
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_yuicompressor"
10
+ s.summary = "Processor for using yuicompressor to minify CSS/JS"
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("yui-compressor", [">= 0"])
24
+ end
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: roger_yuicompressor
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: yui-compressor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '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'
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_yuicompressor.rb
53
+ - lib/roger_yuicompressor/processor.rb
54
+ - roger_yuicompressor.gemspec
55
+ homepage: http://github.com/digitpaint/roger_yuicompressor
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ! '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubyforge_project:
75
+ rubygems_version: 2.1.5
76
+ signing_key:
77
+ specification_version: 4
78
+ summary: Processor for using yuicompressor to minify CSS/JS
79
+ test_files: []