svgo_wrapper 0.0.1
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 +7 -0
- data/.gitignore +17 -0
- data/.rubocop.yml +12 -0
- data/.ruby-version +1 -0
- data/.simplecov +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +17 -0
- data/Guardfile +12 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +10 -0
- data/lib/svgo_wrapper.rb +63 -0
- data/lib/svgo_wrapper/constants.rb +13 -0
- data/lib/svgo_wrapper/error.rb +4 -0
- data/lib/svgo_wrapper/parser_error.rb +6 -0
- data/lib/svgo_wrapper/svgo_check.rb +30 -0
- data/lib/svgo_wrapper/version.rb +3 -0
- data/spec/lib/svgo_wrapper/constants_spec.rb +11 -0
- data/spec/lib/svgo_wrapper/svgo_check_spec.rb +19 -0
- data/spec/lib/svgo_wrapper/version_spec.rb +5 -0
- data/spec/lib/svgo_wrapper_spec.rb +177 -0
- data/spec/spec_helper.rb +15 -0
- data/svgo_wrapper.gemspec +22 -0
- data/tasks/coverage.rb +5 -0
- metadata +88 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5d28e56255a9c92c101eb2245cddb434becf08f4
|
4
|
+
data.tar.gz: ad9a828921e3f26868aaaa94f26d09a8cb12de93
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 910fd2cc795027853bad42d7e340fc44c75a5e1ef7fbd877a671dd57f16d28ecc47577617b6d0bc165cafc55f0f1a4ffeda2c4272a8c4390e9168c7f75807ea3
|
7
|
+
data.tar.gz: 749424df3f68830942b94b1b58c44067b6c2f83755c1890b3b93e98791482a5c82206ab1f54a62e1f73bcefc4ac91a9a9cabf661e23a7807ef7776f9b9ac022f
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Metrics/LineLength:
|
2
|
+
Max: 120
|
3
|
+
Style/AndOr:
|
4
|
+
EnforcedStyle: conditionals
|
5
|
+
Style/Documentation:
|
6
|
+
Enabled: false
|
7
|
+
Style/SignalException:
|
8
|
+
EnforcedStyle: only_raise
|
9
|
+
Style/SpaceInsideBlockBraces:
|
10
|
+
SpaceBeforeBlockParameters: false
|
11
|
+
Style/StringLiterals:
|
12
|
+
EnforcedStyle: double_quotes
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.5
|
data/.simplecov
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
SimpleCov.start { add_filter "/spec/" }
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
gemspec
|
3
|
+
|
4
|
+
group :development do
|
5
|
+
gem "byebug", "~> 3.5.1"
|
6
|
+
gem "guard", "~> 2.10.2"
|
7
|
+
gem "guard-rspec", "~> 4.4.2"
|
8
|
+
gem "guard-rubocop", "~> 1.2.0"
|
9
|
+
gem "libnotify", "~> 0.8.4"
|
10
|
+
gem "rubocop", "~> 0.28.0"
|
11
|
+
end
|
12
|
+
|
13
|
+
group :development, :test do
|
14
|
+
gem "rake", "~> 10.4.2"
|
15
|
+
gem "rspec", "~> 3.1.0"
|
16
|
+
gem "simplecov", "~> 0.9.1"
|
17
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
guard :rubocop, all_on_start: false do
|
2
|
+
watch(/^.+\.rb$/)
|
3
|
+
watch(/^(?:.+\/)?\.rubocop\.yml$/) {|m| File.dirname(m[0]) }
|
4
|
+
watch(/^(?:.+\/)?.+\.gemspec$/)
|
5
|
+
watch(/^(?:.+\/)?(?:Gem|Rake)file$/)
|
6
|
+
end
|
7
|
+
|
8
|
+
guard :rspec, cmd: "bundle exec rspec -fd" do
|
9
|
+
watch(/^spec\/.+_spec\.rb$/)
|
10
|
+
watch(/^lib\/(.+)\.rb$/) {|m| "spec/lib/#{m[1]}_spec.rb" }
|
11
|
+
watch("spec/spec_helper.rb") { "spec" }
|
12
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Gabriel de Oliveira
|
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,34 @@
|
|
1
|
+
# SvgoWrapper
|
2
|
+
|
3
|
+
This is a simple wrapper for the `svgo` command line tool.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "svgo_wrapper"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install svgo_wrapper
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
require "svgo_wrapper"
|
25
|
+
|
26
|
+
# Create a wrapper with enabled and disabled plugins.
|
27
|
+
# All attributes are optional.
|
28
|
+
wrapper = SvgoWrapper.new enabled: :removeTitle,
|
29
|
+
disabled: [:convertColors, :removeMetadata],
|
30
|
+
timeout: 10 # seconds
|
31
|
+
|
32
|
+
# Parse image data
|
33
|
+
wrapper.optimize_images_data " <svg> </svg> " #=> "<svg/>\n"
|
34
|
+
```
|
data/Rakefile
ADDED
data/lib/svgo_wrapper.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
require "set"
|
2
|
+
|
3
|
+
require "open4"
|
4
|
+
|
5
|
+
require "svgo_wrapper/constants"
|
6
|
+
require "svgo_wrapper/error"
|
7
|
+
require "svgo_wrapper/parser_error"
|
8
|
+
require "svgo_wrapper/svgo_check"
|
9
|
+
require "svgo_wrapper/version"
|
10
|
+
|
11
|
+
class SvgoWrapper
|
12
|
+
attr_reader :disabled_plugins, :enabled_plugins, :timeout
|
13
|
+
|
14
|
+
def initialize(enable: nil, disable: nil, timeout: DEFAULT_TIMEOUT)
|
15
|
+
self.enabled_plugins = enable
|
16
|
+
self.disabled_plugins = disable
|
17
|
+
self.plugin_args = generate_plugin_args(enabled: enabled_plugins, disabled: disabled_plugins)
|
18
|
+
self.timeout = timeout
|
19
|
+
end
|
20
|
+
|
21
|
+
def optimize_images_data(data)
|
22
|
+
begin
|
23
|
+
Open4.spawn ["svgo", *plugin_args, "-i", "-", "-o", "-"],
|
24
|
+
stdin: data,
|
25
|
+
stdout: output = "",
|
26
|
+
stdout_timeout: timeout
|
27
|
+
rescue Open4::SpawnError => e
|
28
|
+
raise Error, "Unexpected error (#{e.exitstatus})\n"
|
29
|
+
end
|
30
|
+
|
31
|
+
raise ParserError, output unless output.start_with? "<svg"
|
32
|
+
output
|
33
|
+
end
|
34
|
+
|
35
|
+
def timeout=(value)
|
36
|
+
if value.is_a? Numeric
|
37
|
+
@timeout = value
|
38
|
+
elsif @timeout.nil?
|
39
|
+
@timeout = DEFAULT_TIMEOUT
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
attr_accessor :plugin_args
|
46
|
+
|
47
|
+
def disabled_plugins=(values)
|
48
|
+
@disabled_plugins = filter_plugins(Set[*values]).freeze
|
49
|
+
end
|
50
|
+
|
51
|
+
def enabled_plugins=(values)
|
52
|
+
@enabled_plugins = filter_plugins(Set[*values]).freeze
|
53
|
+
end
|
54
|
+
|
55
|
+
def filter_plugins(plugins)
|
56
|
+
VALID_PLUGINS & plugins.map(&:to_sym)
|
57
|
+
end
|
58
|
+
|
59
|
+
def generate_plugin_args(enabled:, disabled:)
|
60
|
+
(disabled.map {|v| "--disable=#{v}".freeze } +
|
61
|
+
enabled.map {|v| "--enable=#{v}".freeze }).freeze
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require "set"
|
2
|
+
|
3
|
+
class SvgoWrapper
|
4
|
+
DEFAULT_TIMEOUT = 60 # seconds
|
5
|
+
|
6
|
+
VALID_PLUGINS = Set[:cleanupAttrs, :cleanupEnableBackground, :cleanupIDs, :cleanupNumericValues, :collapseGroups,
|
7
|
+
:convertColors, :convertPathData, :convertShapeToPath, :convertStyleToAttrs, :convertTransform,
|
8
|
+
:mergePaths, :moveElemsAttrsToGroup, :moveGroupAttrsToElems, :removeComments, :removeDesc,
|
9
|
+
:removeDoctype, :removeEditorsNSData, :removeEmptyAttrs, :removeEmptyContainers, :removeEmptyText,
|
10
|
+
:removeHiddenElems, :removeMetadata, :removeNonInheritableGroupAttrs, :removeRasterImages,
|
11
|
+
:removeTitle, :removeUnknownsAndDefaults, :removeUnusedNS, :removeUselessStrokeAndFill,
|
12
|
+
:removeViewBox, :removeXMLProcInst, :sortAttrs, :transformsWithOnePath].freeze
|
13
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require "open4"
|
2
|
+
require "svgo_wrapper/constants"
|
3
|
+
|
4
|
+
class SvgoWrapper
|
5
|
+
class << self
|
6
|
+
def svgo_present?
|
7
|
+
begin
|
8
|
+
Open4.spawn "svgo -i - -o -",
|
9
|
+
stdin: " <svg/>",
|
10
|
+
stdout: output = "",
|
11
|
+
stdout_timeout: 5
|
12
|
+
rescue
|
13
|
+
return false
|
14
|
+
end
|
15
|
+
|
16
|
+
output.start_with?("<svg")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
unless svgo_present?
|
21
|
+
# We will warn the user once if the `svgo` tool isn't present on this system when the gem is required. This check
|
22
|
+
# will not be performed again in the code for performance reasons.
|
23
|
+
# :nocov:
|
24
|
+
warn <<-EOS
|
25
|
+
WARNING: Required tool `svgo` not found on the system.
|
26
|
+
Please follow these instructions to install it: https://github.com/svg/svgo#how-to-use
|
27
|
+
EOS
|
28
|
+
# :nocov:
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe SvgoWrapper do
|
4
|
+
subject { described_class }
|
5
|
+
|
6
|
+
it "finds the `svgo` tool in the current system" do
|
7
|
+
expect(subject.svgo_present?).to be(true)
|
8
|
+
end
|
9
|
+
|
10
|
+
context "`svgo` tool does not exist" do
|
11
|
+
before(:each) do
|
12
|
+
allow(Open4).to receive(:spawn).and_raise
|
13
|
+
end
|
14
|
+
|
15
|
+
it "does not find the `svgo` tool in the current system" do
|
16
|
+
expect(subject.svgo_present?).to be(false)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,177 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe SvgoWrapper do
|
4
|
+
# The valid plugin sample consists of 3 existing plugins. The first and last ones are symbols, and the one in the
|
5
|
+
# middle is a string.
|
6
|
+
let(:sample_size) { 3 }
|
7
|
+
let(:valid_plugins) do
|
8
|
+
described_class::VALID_PLUGINS.to_a.sample(sample_size).map.with_index {|v, i| i.even? ? v : v.to_s }
|
9
|
+
end
|
10
|
+
let(:invalid_plugins) { valid_plugins + ["inv4lid", :plug1ns] }
|
11
|
+
let(:valid_plugins_as_symbols) { valid_plugins.map(&:to_sym) }
|
12
|
+
|
13
|
+
describe "valid_plugins" do
|
14
|
+
subject { valid_plugins }
|
15
|
+
|
16
|
+
it "consists of Symbols and Strings" do
|
17
|
+
expect(subject.map(&:class)).to eq([Symbol, String, Symbol])
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "enabled plugins" do
|
22
|
+
context "when none are passed" do
|
23
|
+
subject { described_class.new.enabled_plugins }
|
24
|
+
|
25
|
+
it { is_expected.to be_empty }
|
26
|
+
it { is_expected.to be_frozen }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when valid are passed" do
|
30
|
+
subject { described_class.new(enable: valid_plugins).enabled_plugins }
|
31
|
+
|
32
|
+
it { is_expected.to be_frozen }
|
33
|
+
it { is_expected.to contain_exactly(*valid_plugins_as_symbols) }
|
34
|
+
end
|
35
|
+
|
36
|
+
context "when invalid are passed" do
|
37
|
+
subject { described_class.new(enable: invalid_plugins).enabled_plugins }
|
38
|
+
|
39
|
+
it { is_expected.to be_frozen }
|
40
|
+
it { is_expected.to contain_exactly(*valid_plugins_as_symbols) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe "disabled plugins" do
|
45
|
+
context "when none are passed" do
|
46
|
+
subject { described_class.new.disabled_plugins }
|
47
|
+
|
48
|
+
it { is_expected.to be_empty }
|
49
|
+
it { is_expected.to be_frozen }
|
50
|
+
end
|
51
|
+
|
52
|
+
context "when valid are passed" do
|
53
|
+
subject { described_class.new(disable: valid_plugins).disabled_plugins }
|
54
|
+
|
55
|
+
it { is_expected.to be_frozen }
|
56
|
+
it { is_expected.to contain_exactly(*valid_plugins_as_symbols) }
|
57
|
+
end
|
58
|
+
|
59
|
+
context "when invalid are passed" do
|
60
|
+
subject { described_class.new(disable: invalid_plugins).disabled_plugins }
|
61
|
+
|
62
|
+
it { is_expected.to be_frozen }
|
63
|
+
it { is_expected.to contain_exactly(*valid_plugins_as_symbols) }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe "timeout" do
|
68
|
+
let(:default_timeout) { described_class::DEFAULT_TIMEOUT }
|
69
|
+
let(:valid_timeout) { 25.5 }
|
70
|
+
let(:invalid_timeout) { :XVIII }
|
71
|
+
|
72
|
+
context "when none is passed" do
|
73
|
+
subject { described_class.new }
|
74
|
+
|
75
|
+
it "has a default value" do
|
76
|
+
expect(subject.timeout).to eq(default_timeout)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "can set a new valid value" do
|
80
|
+
subject.timeout = invalid_timeout
|
81
|
+
expect(subject.timeout).to eq(default_timeout)
|
82
|
+
subject.timeout = valid_timeout
|
83
|
+
expect(subject.timeout).to eq(valid_timeout)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "when valid value is passed" do
|
88
|
+
let(:valid_timeout_2) { 32 }
|
89
|
+
|
90
|
+
subject { described_class.new(timeout: valid_timeout) }
|
91
|
+
|
92
|
+
it "has that value set" do
|
93
|
+
expect(subject.timeout).to eq(valid_timeout)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "can set a new valid value" do
|
97
|
+
subject.timeout = invalid_timeout
|
98
|
+
expect(subject.timeout).to eq(valid_timeout)
|
99
|
+
subject.timeout = valid_timeout_2
|
100
|
+
expect(subject.timeout).to eq(valid_timeout_2)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context "when invalid value is passed" do
|
105
|
+
subject { described_class.new(timeout: invalid_timeout) }
|
106
|
+
|
107
|
+
it "has a default value" do
|
108
|
+
expect(subject.timeout).to eq(default_timeout)
|
109
|
+
end
|
110
|
+
|
111
|
+
it "can set a new valid value" do
|
112
|
+
subject.timeout = invalid_timeout
|
113
|
+
expect(subject.timeout).to eq(default_timeout)
|
114
|
+
subject.timeout = valid_timeout
|
115
|
+
expect(subject.timeout).to eq(valid_timeout)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
describe "#optimize_images_data" do
|
121
|
+
let(:svg_image) { " <svg><metadata>My Metadata</metadata><title>My Title</title></svg>" }
|
122
|
+
|
123
|
+
context "without plugins" do
|
124
|
+
subject { described_class.new.optimize_images_data svg_image }
|
125
|
+
|
126
|
+
it { is_expected.to start_with("<svg") }
|
127
|
+
it { is_expected.to end_with("/svg>\n") }
|
128
|
+
end
|
129
|
+
|
130
|
+
context "using plugins" do
|
131
|
+
context "to remove the title and keep the metadata" do
|
132
|
+
subject { described_class.new(enable: :removeTitle, disable: [:removeMetadata]).optimize_images_data svg_image }
|
133
|
+
|
134
|
+
it { is_expected.to match(/My Metadata/) }
|
135
|
+
it { is_expected.not_to match(/My Title/) }
|
136
|
+
end
|
137
|
+
|
138
|
+
context "to keep the title and remove the metadata" do
|
139
|
+
subject { described_class.new(enable: [:removeMetadata], disable: :removeTitle).optimize_images_data svg_image }
|
140
|
+
|
141
|
+
it { is_expected.to match(/My Title/) }
|
142
|
+
it { is_expected.not_to match(/My Metadata/) }
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context "with incorrect data" do
|
147
|
+
let(:invalid_svg_image) { " <svg><title>This is wrong...</svg>" }
|
148
|
+
subject { described_class.new.optimize_images_data invalid_svg_image }
|
149
|
+
|
150
|
+
it "raises a parsing error" do
|
151
|
+
expect { subject }.to raise_error(described_class::ParserError, "Unexpected close tag\n")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
context "`svgo` tool unexpectedly fails" do
|
156
|
+
let(:mocked_status) do
|
157
|
+
# A mock of Process::Status
|
158
|
+
Object.new.tap do |o|
|
159
|
+
o.instance_eval do
|
160
|
+
define_singleton_method :signaled?, proc { false }
|
161
|
+
define_singleton_method :exitstatus, proc { 123 }
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
subject { described_class.new.optimize_images_data svg_image }
|
167
|
+
|
168
|
+
before(:each) do
|
169
|
+
allow(Open4).to receive(:spawn).and_raise(Open4::SpawnError.new("command example", mocked_status))
|
170
|
+
end
|
171
|
+
|
172
|
+
it "raises a general error" do
|
173
|
+
expect { subject }.to raise_error(described_class::Error, "Unexpected error (123)\n")
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "simplecov" unless ENV["COVERAGE"].nil?
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
|
4
|
+
require "svgo_wrapper"
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
config.color = true
|
8
|
+
config.order = :rand
|
9
|
+
config.expect_with :rspec do |c|
|
10
|
+
c.syntax = :expect
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Bind randomized execution to the current seed in RSpec (i.e. for Array#sample).
|
15
|
+
srand RSpec.configuration.seed
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "svgo_wrapper/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "svgo_wrapper"
|
8
|
+
spec.required_ruby_version = ">= 2.1"
|
9
|
+
spec.version = SvgoWrapper::VERSION
|
10
|
+
spec.authors = ["Gabriel de Oliveira"]
|
11
|
+
spec.email = ["gdeoliveira@tribune.com"]
|
12
|
+
spec.summary = "This is a simple wrapper for Kir Belevich's `svgo` tool."
|
13
|
+
spec.description = "This gem wraps the SVG image optimization tool by Kir Belevich (svgo).\n" \
|
14
|
+
"It supports enabling and disabling specific cleanup plugins before optimizing the image data."
|
15
|
+
spec.homepage = "https://github.com/tribune/svgo_wrapper"
|
16
|
+
spec.license = "MIT"
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.test_files = spec.files.grep(/^(test|spec|features)/)
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "open4", "~> 1.3.4"
|
22
|
+
end
|
data/tasks/coverage.rb
ADDED
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: svgo_wrapper
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gabriel de Oliveira
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: open4
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.3.4
|
27
|
+
description: |-
|
28
|
+
This gem wraps the SVG image optimization tool by Kir Belevich (svgo).
|
29
|
+
It supports enabling and disabling specific cleanup plugins before optimizing the image data.
|
30
|
+
email:
|
31
|
+
- gdeoliveira@tribune.com
|
32
|
+
executables: []
|
33
|
+
extensions: []
|
34
|
+
extra_rdoc_files: []
|
35
|
+
files:
|
36
|
+
- ".gitignore"
|
37
|
+
- ".rubocop.yml"
|
38
|
+
- ".ruby-version"
|
39
|
+
- ".simplecov"
|
40
|
+
- ".travis.yml"
|
41
|
+
- Gemfile
|
42
|
+
- Guardfile
|
43
|
+
- LICENSE.txt
|
44
|
+
- README.md
|
45
|
+
- Rakefile
|
46
|
+
- lib/svgo_wrapper.rb
|
47
|
+
- lib/svgo_wrapper/constants.rb
|
48
|
+
- lib/svgo_wrapper/error.rb
|
49
|
+
- lib/svgo_wrapper/parser_error.rb
|
50
|
+
- lib/svgo_wrapper/svgo_check.rb
|
51
|
+
- lib/svgo_wrapper/version.rb
|
52
|
+
- spec/lib/svgo_wrapper/constants_spec.rb
|
53
|
+
- spec/lib/svgo_wrapper/svgo_check_spec.rb
|
54
|
+
- spec/lib/svgo_wrapper/version_spec.rb
|
55
|
+
- spec/lib/svgo_wrapper_spec.rb
|
56
|
+
- spec/spec_helper.rb
|
57
|
+
- svgo_wrapper.gemspec
|
58
|
+
- tasks/coverage.rb
|
59
|
+
homepage: https://github.com/tribune/svgo_wrapper
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '2.1'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.4.5
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: This is a simple wrapper for Kir Belevich's `svgo` tool.
|
83
|
+
test_files:
|
84
|
+
- spec/lib/svgo_wrapper/constants_spec.rb
|
85
|
+
- spec/lib/svgo_wrapper/svgo_check_spec.rb
|
86
|
+
- spec/lib/svgo_wrapper/version_spec.rb
|
87
|
+
- spec/lib/svgo_wrapper_spec.rb
|
88
|
+
- spec/spec_helper.rb
|