svgeez 3.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +48 -0
- data/.github/dependabot.yml +8 -0
- data/.rubocop.yml +9 -7
- data/.ruby-version +1 -1
- data/.simplecov +7 -1
- data/CHANGELOG.md +33 -9
- data/CONTRIBUTING.md +4 -6
- data/Gemfile +11 -0
- data/README.md +13 -9
- data/Rakefile +1 -12
- data/lib/svgeez/builder.rb +3 -2
- data/lib/svgeez/command.rb +1 -0
- data/lib/svgeez/elements/svg_element.rb +3 -2
- data/lib/svgeez/elements/symbol_element.rb +4 -1
- data/lib/svgeez/optimizer.rb +4 -4
- data/lib/svgeez/version.rb +1 -1
- data/lib/svgeez.rb +1 -1
- data/svgeez.gemspec +9 -21
- metadata +12 -123
- data/.travis.yml +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39569e0fb1d9b64953a645003d68ac3e463960837697095050fd8bb14c7f946c
|
4
|
+
data.tar.gz: 1847211af2cd29865509668f514902809b7c96f9e146a7205cb44fa42737e811
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 512552baeff7b25a90a095bf82f21abd15ad2084fda594a0f60e9bf6f44d3a4428830d796787e7b091a7fd4e474b5b5a53ac949a34e7d65adcdad1442fa7eed3
|
7
|
+
data.tar.gz: 16d366949f2b0726c572d7d97d03f513a8cec3cdd8f918445dbf6c34971b28e82c82005982bc8716bbc35d7be4f0983eb98b4dedac0736a37b352f5cb77a1c61
|
@@ -0,0 +1,48 @@
|
|
1
|
+
version: 2.1
|
2
|
+
|
3
|
+
orbs:
|
4
|
+
ruby: circleci/ruby@1.1.2
|
5
|
+
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
parameters:
|
9
|
+
version:
|
10
|
+
type: string
|
11
|
+
executor:
|
12
|
+
name: ruby/default
|
13
|
+
tag: << parameters.version >>
|
14
|
+
steps:
|
15
|
+
- checkout
|
16
|
+
- run:
|
17
|
+
name: Generate Gemfile.lock
|
18
|
+
command: bundle lock
|
19
|
+
- ruby/install-deps
|
20
|
+
- run:
|
21
|
+
name: Install SVGO
|
22
|
+
command: sudo npm install -g svgo@1.3.2
|
23
|
+
- run:
|
24
|
+
name: Install CodeClimate test reporter
|
25
|
+
command: |
|
26
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
27
|
+
chmod +x ./cc-test-reporter
|
28
|
+
./cc-test-reporter before-build
|
29
|
+
- run:
|
30
|
+
name: Run CI script
|
31
|
+
command: bin/ci
|
32
|
+
- run:
|
33
|
+
name: Upload coverage report to CodeClimate
|
34
|
+
command: ./cc-test-reporter after-build
|
35
|
+
|
36
|
+
workflows:
|
37
|
+
version: 2
|
38
|
+
default:
|
39
|
+
jobs:
|
40
|
+
- test:
|
41
|
+
matrix:
|
42
|
+
parameters:
|
43
|
+
version:
|
44
|
+
- "2.5-node"
|
45
|
+
- "2.6-node"
|
46
|
+
- "2.7-node"
|
47
|
+
- "3.0-node"
|
48
|
+
- "3.1-node"
|
data/.rubocop.yml
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
require:
|
2
2
|
- rubocop-performance
|
3
|
+
- rubocop-rake
|
3
4
|
- rubocop-rspec
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
6
|
+
AllCops:
|
7
|
+
NewCops: disable
|
8
|
+
|
9
|
+
Layout/LineLength:
|
10
|
+
Enabled: false
|
8
11
|
|
9
12
|
Metrics/BlockLength:
|
10
13
|
Exclude:
|
11
14
|
- spec/**/*
|
12
|
-
- svgeez.gemspec
|
13
|
-
|
14
|
-
Metrics/LineLength:
|
15
|
-
Enabled: false
|
16
15
|
|
17
16
|
Naming/RescuedExceptionsVariableName:
|
18
17
|
PreferredName: exception
|
@@ -20,6 +19,9 @@ Naming/RescuedExceptionsVariableName:
|
|
20
19
|
RSpec/MultipleExpectations:
|
21
20
|
Max: 2
|
22
21
|
|
22
|
+
RSpec/MultipleMemoizedHelpers:
|
23
|
+
Max: 10
|
24
|
+
|
23
25
|
Style/Documentation:
|
24
26
|
Enabled: false
|
25
27
|
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.5.9
|
data/.simplecov
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
+
require 'simplecov_json_formatter'
|
1
2
|
require 'simplecov-console'
|
2
3
|
|
3
|
-
formatters = [
|
4
|
+
formatters = [
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
SimpleCov::Formatter::JSONFormatter
|
7
|
+
]
|
4
8
|
|
9
|
+
# rubocop:disable Style/IfUnlessModifier
|
5
10
|
if RSpec.configuration.files_to_run.length > 1
|
6
11
|
formatters << SimpleCov::Formatter::Console
|
7
12
|
end
|
13
|
+
# rubocop:enable Style/IfUnlessModifier
|
8
14
|
|
9
15
|
SimpleCov.start do
|
10
16
|
formatter SimpleCov::Formatter::MultiFormatter.new(formatters)
|
data/CHANGELOG.md
CHANGED
@@ -1,27 +1,51 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 4.1.0 / 2022-01-22
|
4
|
+
|
5
|
+
- Update required Ruby version to include versions less than 4 (47e2bdf)
|
6
|
+
|
7
|
+
## 4.0.0 / 2021-07-12
|
8
|
+
|
9
|
+
- **Breaking Change:** Require SVGO version 1.3.2 (c108320)
|
10
|
+
- Add Ruby 3 support (af4772d)
|
11
|
+
- **Breaking Change:** Remove Ruby 2.4 support (3ec6ea3)
|
12
|
+
- Update `listen` dependency constraint (e05a61b)
|
13
|
+
- Remove development gem dependency constraints (2911fae)
|
14
|
+
- Update development Ruby version to 2.5.9 (1e61b0b)
|
15
|
+
- Replace `bin/*` scripts with `bin/ci`
|
16
|
+
- Migrate from Travis CI to Circle CI
|
17
|
+
|
18
|
+
## 3.2.0 / 2020-08-11
|
19
|
+
|
20
|
+
- Add `--prefix` option (#79 and #80)
|
21
|
+
- Update development Ruby version to 2.4.10 (8d517c1)
|
22
|
+
|
23
|
+
## 3.1.0 / 2020-01-20
|
24
|
+
|
25
|
+
- Expand supported Ruby versions to include 2.7 (bcc23b5)
|
26
|
+
|
3
27
|
## 3.0.0 / 2019-08-02
|
4
28
|
|
5
29
|
### Breaking Changes
|
6
30
|
|
7
|
-
- Bump required minimum SVGO version to 1.3.0 (
|
31
|
+
- Bump required minimum SVGO version to 1.3.0 (afa24c6)
|
8
32
|
|
9
33
|
### Additional Enhancements
|
10
34
|
|
11
|
-
- Refactor command classes (
|
12
|
-
- Refactor specs (
|
13
|
-
- Update development dependencies
|
35
|
+
- Refactor command classes (02f420c)
|
36
|
+
- Refactor specs ()
|
37
|
+
- Update development dependencies
|
14
38
|
|
15
39
|
## 2.0.1 / 2019-01-03
|
16
40
|
|
17
|
-
- Expand supported Ruby versions to include 2.6 (
|
41
|
+
- Expand supported Ruby versions to include 2.6 (0facfd0)
|
18
42
|
|
19
43
|
## 2.0.0 / 2018-12-04
|
20
44
|
|
21
|
-
- Refactor classes to use `attr_reader`s (
|
22
|
-
- Change required Ruby versions and liberalize dependency constraints (
|
23
|
-
- Change project Ruby version to 2.4.
|
24
|
-
- Bump required SVGO version to 1.1.1 (
|
45
|
+
- Refactor classes to use `attr_reader`s (c62780f)
|
46
|
+
- Change required Ruby versions and liberalize dependency constraints (35fcadb)
|
47
|
+
- Change project Ruby version to 2.4.9 (301d341)
|
48
|
+
- Bump required SVGO version to 1.1.1 (28741fc)
|
25
49
|
|
26
50
|
## Previous Releases
|
27
51
|
|
data/CONTRIBUTING.md
CHANGED
@@ -8,9 +8,9 @@ There are a couple ways you can help improve svgeez:
|
|
8
8
|
|
9
9
|
## Getting Started
|
10
10
|
|
11
|
-
svgeez is developed using Ruby 2.
|
11
|
+
svgeez is developed using Ruby 2.5.9 and is additionally tested against Ruby 2.6, 2.7, 3.0, and 3.1 using [CircleCI](https://app.circleci.com/pipelines/github/jgarber623/svgeez).
|
12
12
|
|
13
|
-
Before making changes to svgeez, you'll want to install Ruby 2.
|
13
|
+
Before making changes to svgeez, you'll want to install Ruby 2.5.9. It's recommended that you use a Ruby version managment tool like [rbenv](https://github.com/rbenv/rbenv), [chruby](https://github.com/postmodern/chruby), or [rvm](https://github.com/rvm/rvm). Once you've installed Ruby 2.5.9 using your method of choice, install the project's gems by running:
|
14
14
|
|
15
15
|
```sh
|
16
16
|
bundle install
|
@@ -30,8 +30,8 @@ npm install -g svgo
|
|
30
30
|
1. Install development dependencies as outlined above.
|
31
31
|
1. Create a feature branch for the code changes you're looking to make: `git checkout -b my-new-feature`.
|
32
32
|
1. _Write some code!_
|
33
|
-
1. Build (`
|
34
|
-
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bin/
|
33
|
+
1. Build (`bundle exec rake build`) and install (`bundle exec rake install`) your updated code.
|
34
|
+
1. If your changes would benefit from testing, add the necessary tests and verify everything passes by running `bin/ci`.
|
35
35
|
1. Commit your changes: `git commit -am 'Add some new feature or fix some issue'`. _(See [this excellent article](https://chris.beams.io/posts/git-commit/) for tips on writing useful Git commit messages.)_
|
36
36
|
1. Push the branch to your fork: `git push -u origin my-new-feature`.
|
37
37
|
1. Create a new [pull request][pulls] and we'll review your changes.
|
@@ -40,8 +40,6 @@ npm install -g svgo
|
|
40
40
|
|
41
41
|
Code formatting conventions are defined in the `.editorconfig` file which uses the [EditorConfig](http://editorconfig.org) syntax. There are [plugins for a variety of editors](http://editorconfig.org/#download) that utilize the settings in the `.editorconfig` file. We recommended you install the EditorConfig plugin for your editor of choice.
|
42
42
|
|
43
|
-
Additionally, [Rubocop](https://github.com/bbatsov/rubocop) can be used to help identify possible trouble areas in your code. Run `bin/rubocop` to generate Rubocop's static code analysis report.
|
44
|
-
|
45
43
|
Your bug fix or feature addition won't be rejected if it runs afoul of any (or all) of these guidelines, but following the guidelines will definitely make everyone's lives a little easier.
|
46
44
|
|
47
45
|
[issues]: https://github.com/jgarber623/svgeez/issues
|
data/Gemfile
CHANGED
@@ -2,3 +2,14 @@ source 'https://rubygems.org'
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in svgeez.gemspec
|
4
4
|
gemspec
|
5
|
+
|
6
|
+
gem 'pry-byebug'
|
7
|
+
gem 'rake'
|
8
|
+
gem 'reek'
|
9
|
+
gem 'rspec'
|
10
|
+
gem 'rubocop'
|
11
|
+
gem 'rubocop-performance'
|
12
|
+
gem 'rubocop-rake'
|
13
|
+
gem 'rubocop-rspec'
|
14
|
+
gem 'simplecov'
|
15
|
+
gem 'simplecov-console'
|
data/README.md
CHANGED
@@ -2,12 +2,11 @@
|
|
2
2
|
|
3
3
|
**A Ruby gem for automatically generating an SVG sprite from a folder of SVG icons.**
|
4
4
|
|
5
|
-
[![Gem](https://img.shields.io/gem/v/svgeez.svg?style=for-the-badge)](https://rubygems.org/gems/svgeez)
|
6
|
-
[![Downloads](https://img.shields.io/gem/dt/svgeez.svg?style=for-the-badge)](https://rubygems.org/gems/svgeez)
|
7
|
-
[![Build](https://img.shields.io/
|
8
|
-
[![
|
9
|
-
[![
|
10
|
-
[![Coverage](https://img.shields.io/codeclimate/c/jgarber623/svgeez.svg?style=for-the-badge)](https://codeclimate.com/github/jgarber623/svgeez/code)
|
5
|
+
[![Gem](https://img.shields.io/gem/v/svgeez.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/svgeez)
|
6
|
+
[![Downloads](https://img.shields.io/gem/dt/svgeez.svg?logo=rubygems&style=for-the-badge)](https://rubygems.org/gems/svgeez)
|
7
|
+
[![Build](https://img.shields.io/circleci/build/github/jgarber623/svgeez?logo=circleci&style=for-the-badge)](https://app.circleci.com/pipelines/github/jgarber623/svgeez)
|
8
|
+
[![Maintainability](https://img.shields.io/codeclimate/maintainability/jgarber623/svgeez.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/svgeez)
|
9
|
+
[![Coverage](https://img.shields.io/codeclimate/c/jgarber623/svgeez.svg?logo=code-climate&style=for-the-badge)](https://codeclimate.com/github/jgarber623/svgeez/code)
|
11
10
|
|
12
11
|
If you're using an [SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics) icon system in your Web projects, svgeez can help speed up your workflow by automating the SVG sprite generation process. Run svgeez alongside your existing project (or integrate it into your current build system); add, edit, or delete SVG files from a folder; and marvel as svgeez generates a single SVG sprite file ready for inclusion in your user interface.
|
13
12
|
|
@@ -21,7 +20,7 @@ _For more on why SVG sprites are the bee's knees as far as icon systems go, give
|
|
21
20
|
|
22
21
|
## Getting Started
|
23
22
|
|
24
|
-
Before installing and using svgeez, you'll want to have Ruby 2.
|
23
|
+
Before installing and using svgeez, you'll want to have Ruby 2.5 (or newer) installed on your computer. There are plenty of ways to go about this, but my preference is [rbenv](https://github.com/sstephenson/rbenv). svgeez is developed using Ruby 2.5.9 and is additionally tested against Ruby 2.6, 2.7, 3.0, and 3.1 using [CircleCI](https://app.circleci.com/pipelines/github/jgarber623/svgeez).
|
25
24
|
|
26
25
|
## Installation
|
27
26
|
|
@@ -30,7 +29,7 @@ If you're using [Bundler](http://bundler.io), add svgeez to your project's Gemfi
|
|
30
29
|
```rb
|
31
30
|
source 'https://rubygems.org'
|
32
31
|
|
33
|
-
gem 'svgeez', '~>
|
32
|
+
gem 'svgeez', '~> 4.1'
|
34
33
|
```
|
35
34
|
|
36
35
|
…and hop over to your command prompt and run…
|
@@ -67,6 +66,7 @@ The above example will combine all SVG files in `~/Sites/sixtwothree.org/images/
|
|
67
66
|
|:----------------------|:------------------------------------------------------------------|
|
68
67
|
| `-s`, `--source` | Path to folder of source SVGs (defaults to `./_svgeez`). |
|
69
68
|
| `-d`, `--destination` | Path to destination file or folder (defaults to `./svgeez.svg`) |
|
69
|
+
| `-p`, `--prefix` | Optional prefix to append to generated `id` attribute values |
|
70
70
|
| `--with-svgo` | Optimize SVG sprite file with [SVGO](https://github.com/svg/svgo) |
|
71
71
|
|
72
72
|
### The `watch` command
|
@@ -91,6 +91,8 @@ The first section of Jayden Seric's post, [How to optimize SVG](http://jaydenser
|
|
91
91
|
|
92
92
|
If you have the excellent [SVGO](https://github.com/svg/svgo) utility installed on your system (and the `svgo` command is available in your `PATH`), you can use the `--with-svgo` option and optimize the generated sprite file.
|
93
93
|
|
94
|
+
**Note:** If using SVGO with svgeez, you must use SVGO version 1.3.2. Future releases of svgeez will update to use SVGO version 2.x.x.
|
95
|
+
|
94
96
|
```sh
|
95
97
|
svgeez build --source ~/Sites/sixtwothree.org/images/icons --destination ~/Sites/sixtwothree.org/images/icons.svg --with-svgo
|
96
98
|
```
|
@@ -197,7 +199,7 @@ button svg {
|
|
197
199
|
|
198
200
|
## Improving svgeez
|
199
201
|
|
200
|
-
You want to help make svgeez better? Hell yeah! I like your enthusiasm. For more on how you can help, check out [CONTRIBUTING.md](https://github.com/jgarber623/svgeez/blob/
|
202
|
+
You want to help make svgeez better? Hell yeah! I like your enthusiasm. For more on how you can help, check out [CONTRIBUTING.md](https://github.com/jgarber623/svgeez/blob/main/CONTRIBUTING.md).
|
201
203
|
|
202
204
|
### Donations
|
203
205
|
|
@@ -223,10 +225,12 @@ svgeez is written and maintained by [Jason Garber](https://sixtwothree.org).
|
|
223
225
|
|
224
226
|
### Additional Contributors
|
225
227
|
|
228
|
+
- [Abhinav Mishra](https://github.com/abhinavmsra)
|
226
229
|
- [Brett Wilkins](https://github.com/bwilkins)
|
227
230
|
- [danny](https://github.com/f96q)
|
228
231
|
- [Denis Hovart](https://github.com/dhovart)
|
229
232
|
- [Desmond Sadler](https://github.com/dezman)
|
233
|
+
- [motoroller95](https://github.com/motoroller95)
|
230
234
|
|
231
235
|
## License
|
232
236
|
|
data/Rakefile
CHANGED
@@ -1,18 +1,7 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
|
3
|
-
require 'reek/rake/task'
|
4
3
|
require 'rspec/core/rake_task'
|
5
|
-
require 'rubocop/rake_task'
|
6
|
-
|
7
|
-
Reek::Rake::Task.new do |task|
|
8
|
-
task.fail_on_error = false
|
9
|
-
task.source_files = FileList['**/*.rb'].exclude('vendor/**/*.rb')
|
10
|
-
end
|
11
4
|
|
12
5
|
RSpec::Core::RakeTask.new
|
13
6
|
|
14
|
-
|
15
|
-
task.fail_on_error = false
|
16
|
-
end
|
17
|
-
|
18
|
-
task default: [:rubocop, :reek, :spec]
|
7
|
+
task default: :spec
|
data/lib/svgeez/builder.rb
CHANGED
@@ -4,12 +4,13 @@ module Svgeez
|
|
4
4
|
SOURCE_DOES_NOT_EXIST = 'Provided `source` folder does not exist.'.freeze
|
5
5
|
NO_SVGS_IN_SOURCE_MESSAGE = 'No SVGs were found in `source` folder.'.freeze
|
6
6
|
|
7
|
-
attr_reader :source, :destination
|
7
|
+
attr_reader :source, :destination, :prefix
|
8
8
|
|
9
9
|
def initialize(options = {})
|
10
10
|
@source = Source.new(options)
|
11
11
|
@destination = Destination.new(options)
|
12
12
|
@svgo = options.fetch('svgo', false)
|
13
|
+
@prefix = options.fetch('prefix', @destination.file_id)
|
13
14
|
|
14
15
|
raise SOURCE_IS_DESTINATION_MESSAGE if source_is_destination?
|
15
16
|
raise SOURCE_DOES_NOT_EXIST unless source_exists?
|
@@ -41,7 +42,7 @@ module Svgeez
|
|
41
42
|
private
|
42
43
|
|
43
44
|
def destination_file_contents
|
44
|
-
file_contents = Elements::SvgElement.new(source, destination).build
|
45
|
+
file_contents = Elements::SvgElement.new(source, destination, prefix).build
|
45
46
|
file_contents = Optimizer.new.optimize(file_contents) if @svgo
|
46
47
|
|
47
48
|
file_contents.insert(4, ' style="display: none;"')
|
data/lib/svgeez/command.rb
CHANGED
@@ -31,6 +31,7 @@ module Svgeez
|
|
31
31
|
def add_options(command)
|
32
32
|
command.option 'source', '-s', '--source [FOLDER]', 'Source folder (defaults to ./_svgeez)'
|
33
33
|
command.option 'destination', '-d', '--destination [OUTPUT]', 'Destination file or folder (defaults to ./svgeez.svg)'
|
34
|
+
command.option 'prefix', '-p', '--prefix [PREFIX]', 'Custom Prefix for icon id (defaults to destination filename)'
|
34
35
|
command.option 'svgo', '--with-svgo', 'Optimize source SVGs with SVGO before sprite generation (non-destructive)'
|
35
36
|
end
|
36
37
|
end
|
@@ -1,9 +1,10 @@
|
|
1
1
|
module Svgeez
|
2
2
|
module Elements
|
3
3
|
class SvgElement
|
4
|
-
def initialize(source, destination)
|
4
|
+
def initialize(source, destination, prefix)
|
5
5
|
@source = source
|
6
6
|
@destination = destination
|
7
|
+
@prefix = prefix
|
7
8
|
end
|
8
9
|
|
9
10
|
def build
|
@@ -14,7 +15,7 @@ module Svgeez
|
|
14
15
|
|
15
16
|
def symbol_elements
|
16
17
|
@source.file_paths.map do |file_path|
|
17
|
-
SymbolElement.new(file_path, @
|
18
|
+
SymbolElement.new(file_path, @prefix).build
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
@@ -16,8 +16,11 @@ module Svgeez
|
|
16
16
|
|
17
17
|
def element_attributes(attributes)
|
18
18
|
attrs = attributes.scan(/(?:viewBox|xmlns:.+?)=".*?"/m)
|
19
|
+
id_prefix = @file_id
|
20
|
+
id_suffix = File.basename(@file_path, '.svg').gsub(/['"\s]/, '-')
|
21
|
+
id_attribute = [id_prefix, id_suffix].reject(&:empty?).join('-')
|
19
22
|
|
20
|
-
attrs << %(id="#{
|
23
|
+
attrs << %(id="#{id_attribute}")
|
21
24
|
end
|
22
25
|
|
23
26
|
def element_contents(content)
|
data/lib/svgeez/optimizer.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
module Svgeez
|
2
2
|
class Optimizer
|
3
|
-
|
4
|
-
|
3
|
+
SVGO_VERSION = '1.3.2'.freeze
|
4
|
+
SVGO_VERSION_MESSAGE = "svgeez relies on SVGO #{SVGO_VERSION}. Continuing with standard sprite generation...".freeze
|
5
5
|
SVGO_NOT_INSTALLED = 'Unable to find `svgo` in your PATH. Continuing with standard sprite generation...'.freeze
|
6
6
|
|
7
7
|
def optimize(file_contents)
|
8
8
|
raise SVGO_NOT_INSTALLED unless installed?
|
9
|
-
raise
|
9
|
+
raise SVGO_VERSION_MESSAGE unless supported?
|
10
10
|
|
11
11
|
`cat <<EOF | svgo --disable=cleanupIDs --disable=removeHiddenElems --disable=removeViewBox -i - -o -\n#{file_contents}\nEOF`
|
12
12
|
rescue RuntimeError => exception
|
@@ -24,7 +24,7 @@ module Svgeez
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def supported?
|
27
|
-
@supported ||=
|
27
|
+
@supported ||= `svgo -v`.strip == SVGO_VERSION
|
28
28
|
end
|
29
29
|
end
|
30
30
|
end
|
data/lib/svgeez/version.rb
CHANGED
data/lib/svgeez.rb
CHANGED
data/svgeez.gemspec
CHANGED
@@ -1,10 +1,7 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
|
4
|
-
require 'svgeez/version'
|
1
|
+
require_relative 'lib/svgeez/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
|
-
spec.required_ruby_version =
|
4
|
+
spec.required_ruby_version = '>= 2.5', '< 4'
|
8
5
|
|
9
6
|
spec.name = 'svgeez'
|
10
7
|
spec.version = Svgeez::VERSION
|
@@ -16,26 +13,17 @@ Gem::Specification.new do |spec|
|
|
16
13
|
spec.homepage = 'https://github.com/jgarber623/svgeez'
|
17
14
|
spec.license = 'MIT'
|
18
15
|
|
19
|
-
spec.files =
|
16
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
17
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(bin|spec)/}) }
|
18
|
+
end
|
20
19
|
|
21
20
|
spec.bindir = 'exe'
|
22
21
|
spec.executables = ['svgeez']
|
23
22
|
spec.require_paths = ['lib']
|
24
23
|
|
25
|
-
spec.metadata = {
|
26
|
-
|
27
|
-
'changelog_uri' => "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
|
28
|
-
}
|
29
|
-
|
30
|
-
spec.add_development_dependency 'rake', '~> 12.3'
|
31
|
-
spec.add_development_dependency 'reek', '~> 5.4'
|
32
|
-
spec.add_development_dependency 'rspec', '~> 3.8'
|
33
|
-
spec.add_development_dependency 'rubocop', '~> 0.74.0'
|
34
|
-
spec.add_development_dependency 'rubocop-performance', '~> 1.4'
|
35
|
-
spec.add_development_dependency 'rubocop-rspec', '~> 1.34'
|
36
|
-
spec.add_development_dependency 'simplecov', '~> 0.17.0'
|
37
|
-
spec.add_development_dependency 'simplecov-console', '~> 0.5.0'
|
24
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
25
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/v#{spec.version}/CHANGELOG.md"
|
38
26
|
|
39
|
-
spec.add_runtime_dependency 'listen', '~> 3.
|
40
|
-
spec.add_runtime_dependency 'mercenary', '~> 0.
|
27
|
+
spec.add_runtime_dependency 'listen', '~> 3.5'
|
28
|
+
spec.add_runtime_dependency 'mercenary', '~> 0.4.0'
|
41
29
|
end
|
metadata
CHANGED
@@ -1,155 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: svgeez
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Garber
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rake
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '12.3'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '12.3'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: reek
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '5.4'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '5.4'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3.8'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3.8'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rubocop
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.74.0
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.74.0
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rubocop-performance
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.4'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop-rspec
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.34'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.34'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: simplecov
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.17.0
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.17.0
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: simplecov-console
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.5.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.5.0
|
125
13
|
- !ruby/object:Gem::Dependency
|
126
14
|
name: listen
|
127
15
|
requirement: !ruby/object:Gem::Requirement
|
128
16
|
requirements:
|
129
17
|
- - "~>"
|
130
18
|
- !ruby/object:Gem::Version
|
131
|
-
version: '3.
|
19
|
+
version: '3.5'
|
132
20
|
type: :runtime
|
133
21
|
prerelease: false
|
134
22
|
version_requirements: !ruby/object:Gem::Requirement
|
135
23
|
requirements:
|
136
24
|
- - "~>"
|
137
25
|
- !ruby/object:Gem::Version
|
138
|
-
version: '3.
|
26
|
+
version: '3.5'
|
139
27
|
- !ruby/object:Gem::Dependency
|
140
28
|
name: mercenary
|
141
29
|
requirement: !ruby/object:Gem::Requirement
|
142
30
|
requirements:
|
143
31
|
- - "~>"
|
144
32
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
33
|
+
version: 0.4.0
|
146
34
|
type: :runtime
|
147
35
|
prerelease: false
|
148
36
|
version_requirements: !ruby/object:Gem::Requirement
|
149
37
|
requirements:
|
150
38
|
- - "~>"
|
151
39
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
40
|
+
version: 0.4.0
|
153
41
|
description: Automatically generate an SVG sprite from a folder of SVG icons.
|
154
42
|
email:
|
155
43
|
- jason@sixtwothree.org
|
@@ -158,7 +46,9 @@ executables:
|
|
158
46
|
extensions: []
|
159
47
|
extra_rdoc_files: []
|
160
48
|
files:
|
49
|
+
- ".circleci/config.yml"
|
161
50
|
- ".editorconfig"
|
51
|
+
- ".github/dependabot.yml"
|
162
52
|
- ".gitignore"
|
163
53
|
- ".reek.yml"
|
164
54
|
- ".rspec"
|
@@ -166,7 +56,6 @@ files:
|
|
166
56
|
- ".rubocop.yml"
|
167
57
|
- ".ruby-version"
|
168
58
|
- ".simplecov"
|
169
|
-
- ".travis.yml"
|
170
59
|
- CHANGELOG.md
|
171
60
|
- CODE_OF_CONDUCT.md
|
172
61
|
- CONTRIBUTING.md
|
@@ -192,7 +81,7 @@ licenses:
|
|
192
81
|
- MIT
|
193
82
|
metadata:
|
194
83
|
bug_tracker_uri: https://github.com/jgarber623/svgeez/issues
|
195
|
-
changelog_uri: https://github.com/jgarber623/svgeez/blob/
|
84
|
+
changelog_uri: https://github.com/jgarber623/svgeez/blob/v4.1.0/CHANGELOG.md
|
196
85
|
post_install_message:
|
197
86
|
rdoc_options: []
|
198
87
|
require_paths:
|
@@ -201,17 +90,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
90
|
requirements:
|
202
91
|
- - ">="
|
203
92
|
- !ruby/object:Gem::Version
|
204
|
-
version: '2.
|
93
|
+
version: '2.5'
|
205
94
|
- - "<"
|
206
95
|
- !ruby/object:Gem::Version
|
207
|
-
version: '
|
96
|
+
version: '4'
|
208
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
98
|
requirements:
|
210
99
|
- - ">="
|
211
100
|
- !ruby/object:Gem::Version
|
212
101
|
version: '0'
|
213
102
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
103
|
+
rubygems_version: 3.3.5
|
215
104
|
signing_key:
|
216
105
|
specification_version: 4
|
217
106
|
summary: Automatically generate an SVG sprite from a folder of SVG icons.
|
data/.travis.yml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.4.6
|
4
|
-
- 2.5.5
|
5
|
-
- 2.6.2
|
6
|
-
cache:
|
7
|
-
- bundler
|
8
|
-
before_install:
|
9
|
-
- gem update --system
|
10
|
-
- gem install bundler
|
11
|
-
- nvm install node
|
12
|
-
- npm install -g svgo
|
13
|
-
before_script:
|
14
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
15
|
-
- chmod +x ./cc-test-reporter
|
16
|
-
- ./cc-test-reporter before-build
|
17
|
-
after_script:
|
18
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
19
|
-
notifications:
|
20
|
-
email: false
|
21
|
-
slack:
|
22
|
-
rooms:
|
23
|
-
secure: nA0yP2h64kUBM4bs1PrLBfoMvj/u8S1g/Yc0BICCJWpcahUnZiX4Kd87+zprfg0r1nX1Eu+5ileM9U4Z9CeOfNHVma/o5PISliRMgWe3k9na+I66oEybj1u4+a3wA+upXsZQ+RpnJh1aE3A99EdA8plGhAjts3cmdYzcEknDM5wLRxj0V4H7lVzYGHBC4wKWTJ3dEq3uSnYvymxuJI29a8H1bgrlTsTutzwLmEiyDfiXEjUUfoUIE3EVjJdEswJUXmjUPGKB7a/O63ExZj1vtmPAFITw9MeTChbV+5suG0Ibv7dOwqACidqj868HGYHQ7I/G+SwRvJvwWyzmbbFzclupJqudDLPWLKOT8SeUDrezdi9cGg6NI4domRcKRlSSqX1uBDrI7yvhtPeAsB5GFSBCbZVobvVcc1oDitM0KXsQ1kzAKSxnoT0w+egVMfD15ga656agu2qVjiivBBscfSyoNIsQD90j+xGdKBysXGUFE1SxVJ3WtJ6X22PVpDRvjmFmdeT2vnpdA0YB00zvBibGvT+WFP2Iw45YBpXzc3bXj5zRlni79CsehWs44aUfQxNMaPi5G7Dzp+0C/cxDA7DgdU/aVjg6lkXgkuuKE0uybYrTQvWSQ43c8k3eExEMmy3/vFgG82rwGA6STfXf0EUmZ2N6MRI8E1eIU5M78OE=
|