mojo_magick 0.5.4 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.circleci/config.yml +24 -0
- data/.github/dependabot.yml +8 -0
- data/.rubocop-common.yml +99 -0
- data/.rubocop-performance.yml +2 -0
- data/.rubocop-rspec.yml +33 -0
- data/.rubocop.yml +10 -0
- data/.ruby-version +1 -1
- data/Gemfile +6 -1
- data/Gemfile.lock +58 -10
- data/README.md +54 -2
- data/Rakefile +15 -12
- data/examples/animated_gif.rb +11 -14
- data/examples/composite.rb +11 -14
- data/init.rb +1 -3
- data/lib/image_magick/fonts.rb +6 -6
- data/lib/initializers/hash.rb +5 -1
- data/lib/mojo_magick.rb +191 -188
- data/lib/mojo_magick/command_status.rb +11 -0
- data/lib/mojo_magick/errors.rb +5 -0
- data/lib/mojo_magick/font.rb +4 -6
- data/lib/mojo_magick/opt_builder.rb +25 -34
- data/lib/mojo_magick/util/parser.rb +7 -48
- data/lib/mojo_magick/version.rb +1 -1
- data/mojo_magick.gemspec +20 -15
- data/test/fixtures/roll with it.jpg +0 -0
- data/test/font_test.rb +22 -28
- data/test/fonts_test.rb +4 -5
- data/test/mojo_magick_test.rb +282 -283
- data/test/opt_builder_test.rb +56 -49
- data/test/parser_test.rb +17 -18
- data/test/test_helper.rb +7 -5
- metadata +86 -23
- data/lib/image_magick/resource_limits.rb +0 -94
- data/test/resource_limits_test.rb +0 -51
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7eb294af1589ca062245a0197a4a442f25c584fbbcbe7745d07f8976d6282c3d
|
4
|
+
data.tar.gz: ddb865f0d484815352da4c5182d3674e94ec0296c1b8fb5d8579d7c461397cc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00fe14025e466113053a171d7866e32cbd9c20a011efc84ca543dba8cf62ef892c9b3c96f5a4cdcf11fd524fec939f11c806687668c57c5e6df0324ff8778e03
|
7
|
+
data.tar.gz: 76c39990bc119753db01f883b5592f179e2c36eb2c3f4a0f401f87ea548bfab39c9de664f6d8de4b19576a83c285a5d42fc62df25972c65d7ce8fd313e1068b4
|
@@ -0,0 +1,24 @@
|
|
1
|
+
version: 2.1
|
2
|
+
orbs:
|
3
|
+
ruby: circleci/ruby@1.1.2
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
docker:
|
8
|
+
- image: circleci/ruby:2.6.6-browsers
|
9
|
+
executor: ruby/default
|
10
|
+
steps:
|
11
|
+
- checkout
|
12
|
+
- run:
|
13
|
+
name: Which bundler?
|
14
|
+
command: bundle -v
|
15
|
+
- ruby/install-deps
|
16
|
+
- run:
|
17
|
+
name: install imagemagick
|
18
|
+
command: sudo apt-get install imagemagick ghostscript
|
19
|
+
- run:
|
20
|
+
name: tests
|
21
|
+
command: bundle exec rake
|
22
|
+
- run:
|
23
|
+
name: audit
|
24
|
+
command: bundle exec bundle-audit update && bundle exec bundle-audit check
|
data/.rubocop-common.yml
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
AllCops:
|
2
|
+
NewCops: enable
|
3
|
+
DisplayCopNames: true
|
4
|
+
DisplayStyleGuide: true
|
5
|
+
Exclude:
|
6
|
+
- "bin/*"
|
7
|
+
- "db/schema.rb"
|
8
|
+
- "lib/templates/**/*"
|
9
|
+
- "**/node_modules/**/*"
|
10
|
+
- "tmp/**/*"
|
11
|
+
- "vendor/**/*"
|
12
|
+
- "log/**/*"
|
13
|
+
|
14
|
+
Layout/CaseIndentation:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
Layout/FirstArrayElementIndentation:
|
18
|
+
EnforcedStyle: consistent
|
19
|
+
|
20
|
+
Layout/HashAlignment:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
Layout/LineLength:
|
24
|
+
Max: 120
|
25
|
+
|
26
|
+
Layout/MultilineMethodCallIndentation:
|
27
|
+
EnforcedStyle: indented
|
28
|
+
|
29
|
+
Lint/AmbiguousBlockAssociation:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
Lint/ScriptPermission:
|
33
|
+
Exclude:
|
34
|
+
- "Rakefile"
|
35
|
+
|
36
|
+
Metrics/AbcSize:
|
37
|
+
Max: 35
|
38
|
+
Exclude:
|
39
|
+
- "spec/**/*"
|
40
|
+
|
41
|
+
Metrics/BlockLength:
|
42
|
+
CountComments: false
|
43
|
+
Max: 50
|
44
|
+
Exclude:
|
45
|
+
- "config/**/*"
|
46
|
+
- "spec/**/*"
|
47
|
+
|
48
|
+
Metrics/ClassLength:
|
49
|
+
Max: 250
|
50
|
+
Exclude:
|
51
|
+
- "spec/**/*"
|
52
|
+
|
53
|
+
Metrics/MethodLength:
|
54
|
+
Max: 25
|
55
|
+
Exclude:
|
56
|
+
- "db/migrate/*"
|
57
|
+
- "spec/**/*"
|
58
|
+
|
59
|
+
Naming/PredicateName:
|
60
|
+
Enabled: false
|
61
|
+
|
62
|
+
Security/YAMLLoad:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Style/BarePercentLiterals:
|
66
|
+
EnforcedStyle: percent_q
|
67
|
+
|
68
|
+
Style/BlockDelimiters:
|
69
|
+
EnforcedStyle: braces_for_chaining
|
70
|
+
|
71
|
+
Style/Documentation:
|
72
|
+
Enabled: false
|
73
|
+
|
74
|
+
Style/EmptyMethod:
|
75
|
+
EnforcedStyle: expanded
|
76
|
+
|
77
|
+
Style/FrozenStringLiteralComment:
|
78
|
+
EnforcedStyle: never
|
79
|
+
|
80
|
+
Style/Lambda:
|
81
|
+
EnforcedStyle: literal
|
82
|
+
|
83
|
+
Style/ModuleFunction:
|
84
|
+
EnforcedStyle: extend_self
|
85
|
+
|
86
|
+
Style/MutableConstant:
|
87
|
+
Enabled: false
|
88
|
+
|
89
|
+
Style/PreferredHashMethods:
|
90
|
+
Enabled: false
|
91
|
+
|
92
|
+
Style/StringLiterals:
|
93
|
+
EnforcedStyle: double_quotes
|
94
|
+
|
95
|
+
Style/StringLiteralsInInterpolation:
|
96
|
+
EnforcedStyle: double_quotes
|
97
|
+
|
98
|
+
Style/TernaryParentheses:
|
99
|
+
EnforcedStyle: require_parentheses_when_complex
|
data/.rubocop-rspec.yml
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Request and system specs by definition do not test specific classes/modules,
|
2
|
+
# so they are excluded from following the `describe ClassOrModule` rule.
|
3
|
+
RSpec/DescribeClass:
|
4
|
+
Exclude:
|
5
|
+
- "spec/features/**/*"
|
6
|
+
- "spec/requests/**/*"
|
7
|
+
- "spec/system/**/*"
|
8
|
+
|
9
|
+
# Prefer short examples but allow some flexibility (up to 12 lines). System
|
10
|
+
# specs are excluded from this cop because they often involve many sequential
|
11
|
+
# steps, and forcing these to be shorter can make them harder to follow.
|
12
|
+
RSpec/ExampleLength:
|
13
|
+
Max: 12 # Default is 5
|
14
|
+
Exclude:
|
15
|
+
- "spec/features/**/*"
|
16
|
+
- "spec/system/**/*"
|
17
|
+
|
18
|
+
# If an `it` block does not have a description (i.e. the example relies on
|
19
|
+
# RSpec magic to infer the description), then prefer it use the `is_expected`
|
20
|
+
# syntax instead of `expect(subject)`, like this:
|
21
|
+
# it { is_expected.to be_truthy }
|
22
|
+
RSpec/ImplicitSubject:
|
23
|
+
EnforcedStyle: single_statement_only
|
24
|
+
|
25
|
+
# Ideal BDD is to have one `expect` per example (so that each specification can
|
26
|
+
# have corresponding documentation in the form of an `it` block), but we allow
|
27
|
+
# some flexibility (up to 3). System specs are often long capybara flows with
|
28
|
+
# many expectations, so we exclude them from this cop.
|
29
|
+
RSpec/MultipleExpectations:
|
30
|
+
Max: 3 # Default is 1
|
31
|
+
Exclude:
|
32
|
+
- "spec/features/**/*"
|
33
|
+
- "spec/system/**/*"
|
data/.rubocop.yml
ADDED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.6.6
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,26 +1,74 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mojo_magick (0.
|
4
|
+
mojo_magick (0.6.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
9
|
+
ast (2.4.1)
|
10
|
+
bundle-audit (0.1.0)
|
11
|
+
bundler-audit
|
12
|
+
bundler-audit (0.7.0.1)
|
13
|
+
bundler (>= 1.2.0, < 3)
|
14
|
+
thor (>= 0.18, < 2)
|
15
|
+
diff-lcs (1.4.4)
|
16
|
+
docile (1.3.5)
|
17
|
+
io-console (0.5.7)
|
18
|
+
irb (1.3.2)
|
19
|
+
reline (>= 0.1.5)
|
20
|
+
minitest (5.14.2)
|
21
|
+
parallel (1.19.2)
|
22
|
+
parser (2.7.2.0)
|
23
|
+
ast (~> 2.4.1)
|
24
|
+
rainbow (3.0.0)
|
25
|
+
rake (13.0.1)
|
26
|
+
regexp_parser (1.8.2)
|
27
|
+
reline (0.2.2)
|
28
|
+
io-console (~> 0.5)
|
29
|
+
rexml (3.2.4)
|
30
|
+
rspec-expectations (3.10.0)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-support (3.10.0)
|
34
|
+
rubocop (1.1.0)
|
35
|
+
parallel (~> 1.10)
|
36
|
+
parser (>= 2.7.1.5)
|
37
|
+
rainbow (>= 2.2.2, < 4.0)
|
38
|
+
regexp_parser (>= 1.8)
|
39
|
+
rexml
|
40
|
+
rubocop-ast (>= 1.0.1)
|
41
|
+
ruby-progressbar (~> 1.7)
|
42
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
43
|
+
rubocop-ast (1.1.1)
|
44
|
+
parser (>= 2.7.1.5)
|
45
|
+
rubocop-performance (1.8.1)
|
46
|
+
rubocop (>= 0.87.0)
|
47
|
+
rubocop-ast (>= 0.4.0)
|
48
|
+
ruby-progressbar (1.10.1)
|
49
|
+
simplecov (0.21.2)
|
50
|
+
docile (~> 1.1)
|
51
|
+
simplecov-html (~> 0.11)
|
52
|
+
simplecov_json_formatter (~> 0.1)
|
53
|
+
simplecov-html (0.12.3)
|
54
|
+
simplecov_json_formatter (0.1.2)
|
55
|
+
thor (1.0.1)
|
56
|
+
unicode-display_width (1.7.0)
|
18
57
|
|
19
58
|
PLATFORMS
|
20
59
|
ruby
|
21
60
|
|
22
61
|
DEPENDENCIES
|
62
|
+
bundle-audit
|
63
|
+
bundler
|
64
|
+
irb
|
65
|
+
minitest
|
23
66
|
mojo_magick!
|
24
67
|
rake
|
25
68
|
rspec-expectations
|
69
|
+
rubocop
|
70
|
+
rubocop-performance
|
26
71
|
simplecov
|
72
|
+
|
73
|
+
BUNDLED WITH
|
74
|
+
1.17.2
|
data/README.md
CHANGED
@@ -10,6 +10,7 @@ This tool came about because I wanted a fast, simple, lightweight, nothing-goes-
|
|
10
10
|
because-it's-too-simple-to-break image tool.
|
11
11
|
|
12
12
|
[![Gem Version](https://badge.fury.io/rb/mojo_magick.png)](http://badge.fury.io/rb/mojo_magick)
|
13
|
+
[![Build Status](https://circleci.com/gh/rcode5/mojo_magick/tree/master.svg?style=shield&circle-token=8d2252bd460bf1a7cdaad5c2e169698605afb981)]()
|
13
14
|
|
14
15
|
Using it
|
15
16
|
========
|
@@ -17,11 +18,11 @@ Using it
|
|
17
18
|
Add to your Gemfile
|
18
19
|
|
19
20
|
gem 'mojo_magick'
|
20
|
-
|
21
|
+
|
21
22
|
Require it in your ruby code
|
22
23
|
|
23
24
|
require 'mojo_magick'
|
24
|
-
|
25
|
+
|
25
26
|
Go to town! Check out a couple of simple [examples, here](examples/)
|
26
27
|
|
27
28
|
Examples
|
@@ -176,18 +177,69 @@ Note: Use with care. If you don't have fonts installed ImageMagick can spin off
|
|
176
177
|
c.composite
|
177
178
|
end
|
178
179
|
|
180
|
+
Dependencies
|
181
|
+
============
|
182
|
+
|
183
|
+
This library has (in the past) been good for ruby 1.8.7 and beyond.
|
184
|
+
Recent mods (as of 0.5.x) will require a more recent ruby (>1.9.3).
|
185
|
+
|
186
|
+
If you're running on 1.8.7, you should be able to safely use 0.4.3
|
187
|
+
|
188
|
+
Do this by pinning it in your Gemfile
|
189
|
+
|
190
|
+
gem 'mojo_magick', '0.4.3'
|
179
191
|
|
180
192
|
Availablility
|
181
193
|
=============
|
182
194
|
* [Github Repo](http://github.com/rcode5/mojo_magick) This is the current canonical branch.
|
183
195
|
* Issues/Pull Requests can be submitted through the above repository.
|
184
196
|
|
197
|
+
Contributions
|
198
|
+
=============
|
199
|
+
|
200
|
+
Got a fix? Got a feature?
|
201
|
+
|
202
|
+
* fork it
|
203
|
+
* make a branch (named appropriately)
|
204
|
+
* write your code
|
205
|
+
* write your tests
|
206
|
+
* test it (`rake` will run the tests)
|
207
|
+
* submit a pull request
|
208
|
+
|
209
|
+
Note: please don't change the version. We'll do that when we merge
|
210
|
+
in the new code
|
211
|
+
|
185
212
|
Recent Changes
|
186
213
|
==============
|
214
|
+
#### Version 0.6.2
|
215
|
+
|
216
|
+
* fix `annotate` option. Now it takes keyword arguments for geometry.
|
217
|
+
|
218
|
+
#### Version 0.6.1
|
219
|
+
|
220
|
+
* pushed and yanked - defunct version
|
221
|
+
|
222
|
+
#### Version 0.6.0
|
223
|
+
|
224
|
+
* general cleanup and update gems - ready for ImageMagick 7
|
225
|
+
* dumped resource limit handling
|
226
|
+
* PR #29, #30
|
227
|
+
|
228
|
+
#### Version 0.5.6
|
229
|
+
|
230
|
+
* add `get_format` method to help with quoted source file
|
231
|
+
|
232
|
+
#### Version 0.5.5
|
233
|
+
|
234
|
+
* Refactor raw_command into execute! and execute methods so that for cases where we don't care about exit status, it can be easily ignored
|
235
|
+
|
187
236
|
#### Version 0.5.4
|
188
237
|
|
189
238
|
* Include image magick commandline failure from raw_command (on failure)
|
190
239
|
* moved to Popen3
|
240
|
+
* added checks for Popen3 on windows
|
241
|
+
* updated README to include info about submissions
|
242
|
+
* probably no good for ruby 1.8.7 anymore
|
191
243
|
|
192
244
|
#### Version 0.5.1
|
193
245
|
|
data/Rakefile
CHANGED
@@ -1,19 +1,22 @@
|
|
1
|
-
require
|
1
|
+
require "rubygems"
|
2
|
+
require "simplecov"
|
3
|
+
require "rake/testtask"
|
2
4
|
|
3
|
-
task
|
5
|
+
task default: [:test]
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
require 'rake/runtest'
|
10
|
-
files = Dir.glob(File.join(File.dirname(__FILE__), 'test/*_test.rb'))
|
11
|
-
files.each do |f|
|
12
|
-
Rake.run_tests f
|
13
|
-
end
|
7
|
+
Rake::TestTask.new do |t|
|
8
|
+
t.libs = ["minitest"]
|
9
|
+
t.test_files = Dir.glob(File.join(File.dirname(__FILE__), "test/*_test.rb"))
|
10
|
+
t.verbose = true
|
14
11
|
end
|
15
12
|
|
13
|
+
desc "Build gem"
|
16
14
|
task :build do
|
17
15
|
`rm mojo_magick-*.gem`
|
18
|
-
puts `gem build mojo_magick.gemspec`
|
16
|
+
puts `gem build mojo_magick.gemspec`
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Release"
|
20
|
+
task release: :build do
|
21
|
+
puts `gem push mojo_magick-*.gem`
|
19
22
|
end
|
data/examples/animated_gif.rb
CHANGED
@@ -1,22 +1,19 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
2
|
+
require "mojo_magick"
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
MojoMagick::convert(nil, 'animated.gif') do |c|
|
7
|
-
c.size '200x200'
|
4
|
+
MojoMagick.convert(nil, "animated.gif") do |c|
|
5
|
+
c.size "200x200"
|
8
6
|
c.delay 100
|
9
7
|
c.image_block do # first layer
|
10
|
-
c.background
|
11
|
-
c.fill
|
12
|
-
c.gravity
|
13
|
-
c.label
|
8
|
+
c.background "blue"
|
9
|
+
c.fill "white"
|
10
|
+
c.gravity "northwest"
|
11
|
+
c.label "NW"
|
14
12
|
end
|
15
13
|
c.image_block do # second layer
|
16
|
-
c.background
|
17
|
-
c.fill
|
18
|
-
c.gravity
|
19
|
-
c.label
|
14
|
+
c.background "transparent"
|
15
|
+
c.fill "red"
|
16
|
+
c.gravity "southeast"
|
17
|
+
c.label "SE"
|
20
18
|
end
|
21
19
|
end
|
22
|
-
|