giftrim 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +9 -0
- data/README.md +9 -1
- data/Rakefile +7 -0
- data/giftrim.gemspec +2 -0
- data/lib/giftrim/version.rb +1 -1
- data/lib/giftrim.rb +4 -2
- data/test/gifs/output/.gitkeep +0 -0
- data/test/giftrim_test.rb +5 -0
- data/test/test_helper.rb +2 -0
- metadata +18 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YWFhMWNhNmJlMGRiODU4MTZiMGYzOGE1ZTlmNjgwMjZjOGQ3ODcwZA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmNkNDAzNWYwYWNkZGVjMzM4ZGI4MDllZjA3NjFlNzZhMmIxZTc3Zg==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzA2OTRmZWM0NjIzMDY1ODcyOTRiYTVmNDJlNjA2NWQxOGQxZjk2ZDI4ZGJl
|
10
|
+
OTUyZTYwZjc0ZjEyODY3ZTg0OTNjMmNlZTM3ZTRmMzFhN2RjODU4MTY5ZTE3
|
11
|
+
MTZlNmI2OWM0ZmRkMmY3YTVkNGZiYjA5ZWEyYzQ5MjljYWYxNTY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YTY3YWEwZTkwMTNmODNiMWUxOWE1Mzg0MWExYmNkMWRhNmRlMGZmOTI4ODk0
|
14
|
+
OWJkZjMwNGY3ODUxZWRiYTQ3YmM5YTRhYTllOWRjYjkxMTFhMjc2MzE3ZGUy
|
15
|
+
MmU5YWZhYmY1MjcyYzRhOTZmODY2ZGEzOTgxMmUyMDg5OTk1ZWM=
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,7 +1,15 @@
|
|
1
|
-
#
|
1
|
+
# GifTrim
|
2
2
|
|
3
3
|
Provide convenient methods for GIF optimizations using gifsicle
|
4
4
|
|
5
|
+
Tested on the following Rubies: MRI 1.9.3, 2.0.0, Rubinius.
|
6
|
+
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/giftrim.png)](http://badge.fury.io/rb/giftrim)
|
8
|
+
[![Build Status](https://secure.travis-ci.org/l4u/giftrim.png?branch=master)](http://travis-ci.org/l4u/giftrim)
|
9
|
+
[![Coverage Status](https://coveralls.io/repos/l4u/giftrim/badge.png?branch=master)](https://coveralls.io/r/l4u/giftrim)
|
10
|
+
[![Code Climate](https://codeclimate.com/github/l4u/giftrim.png)](https://codeclimate.com/github/l4u/giftrim)
|
11
|
+
[![Dependency Status](https://gemnasium.com/l4u/giftrim.png)](https://gemnasium.com/l4u/giftrim)
|
12
|
+
|
5
13
|
## Installation
|
6
14
|
|
7
15
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
data/giftrim.gemspec
CHANGED
@@ -22,6 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency("simplecov", "~> 0.7")
|
24
24
|
spec.add_development_dependency("simplecov-gem-adapter", "~> 1.0.1")
|
25
|
+
spec.add_development_dependency 'coveralls'
|
26
|
+
|
25
27
|
spec.add_runtime_dependency("subexec", ["~> 0.2.2"])
|
26
28
|
|
27
29
|
|
data/lib/giftrim/version.rb
CHANGED
data/lib/giftrim.rb
CHANGED
@@ -7,6 +7,8 @@ require_relative "core_ext/array"
|
|
7
7
|
module Giftrim
|
8
8
|
class << self
|
9
9
|
attr_accessor :timeout
|
10
|
+
attr_accessor :processor
|
11
|
+
Giftrim.processor = "gifsicle"
|
10
12
|
|
11
13
|
def frame_number_wanted total_number, target_number
|
12
14
|
(0..(total_number-2)).to_a.spread(target_number)
|
@@ -159,7 +161,7 @@ module Giftrim
|
|
159
161
|
end
|
160
162
|
|
161
163
|
def number_of_frames
|
162
|
-
command = "
|
164
|
+
command = "#{Giftrim.processor} --info #{@path}"
|
163
165
|
output = run_command command
|
164
166
|
if output
|
165
167
|
first_line = output.lines.first
|
@@ -177,7 +179,7 @@ module Giftrim
|
|
177
179
|
@outfile.binmode
|
178
180
|
@outfile.close
|
179
181
|
|
180
|
-
command = "
|
182
|
+
command = "#{Giftrim.processor} --resize-fit '300x300' #{@path} #{frames_formatted} > #{@outfile.path}"
|
181
183
|
output = run_command command
|
182
184
|
if output
|
183
185
|
@tempfile = @outfile
|
File without changes
|
data/test/giftrim_test.rb
CHANGED
@@ -2,6 +2,11 @@ require_relative "test_helper"
|
|
2
2
|
require File.expand_path('../../lib/giftrim.rb', __FILE__)
|
3
3
|
|
4
4
|
describe Giftrim do
|
5
|
+
it "must be allowed to change processor or the path of gifsicle" do
|
6
|
+
Giftrim.processor = "/usr/local/bin/gifsicle"
|
7
|
+
Giftrim.processor.must_equal "/usr/local/bin/gifsicle"
|
8
|
+
end
|
9
|
+
|
5
10
|
it "must return frames wanted" do
|
6
11
|
frames = Giftrim::frame_number_wanted 30, 20
|
7
12
|
frames.length.must_equal 20
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: giftrim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leo Lou
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 1.0.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: coveralls
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: subexec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,6 +102,7 @@ extensions: []
|
|
88
102
|
extra_rdoc_files: []
|
89
103
|
files:
|
90
104
|
- .gitignore
|
105
|
+
- .travis.yml
|
91
106
|
- Gemfile
|
92
107
|
- LICENSE.txt
|
93
108
|
- LICENSE_MiniMagick.txt
|
@@ -98,6 +113,7 @@ files:
|
|
98
113
|
- lib/giftrim.rb
|
99
114
|
- lib/giftrim/version.rb
|
100
115
|
- test/gifs/0.gif
|
116
|
+
- test/gifs/output/.gitkeep
|
101
117
|
- test/giftrim_test.rb
|
102
118
|
- test/test_helper.rb
|
103
119
|
homepage: https://github.com/l4u/giftrim
|
@@ -126,5 +142,6 @@ specification_version: 4
|
|
126
142
|
summary: GIF optimizations using gifsicle
|
127
143
|
test_files:
|
128
144
|
- test/gifs/0.gif
|
145
|
+
- test/gifs/output/.gitkeep
|
129
146
|
- test/giftrim_test.rb
|
130
147
|
- test/test_helper.rb
|