giftrim 0.0.1 → 0.0.2

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzFkZDExNDVjYTA0YTFlYzYxZGNmZGJiODIwYWRjYjBkYTJhMjcwMg==
4
+ YWFhMWNhNmJlMGRiODU4MTZiMGYzOGE1ZTlmNjgwMjZjOGQ3ODcwZA==
5
5
  data.tar.gz: !binary |-
6
- YzNmYTA0NGU5ZTVkNTY1N2ZjYmVjY2IwZWI5NjQ4NThhYTU1MWRjMQ==
6
+ MmNkNDAzNWYwYWNkZGVjMzM4ZGI4MDllZjA3NjFlNzZhMmIxZTc3Zg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NWYwNzAyYjc1ZWEyZTcyYTNmMDZkM2Q0ZTlkYzcwYTNkNGM3NGYyMGMwNDQx
10
- ZDk1ODE2NjZkZDY4MzQxM2JmYmE1MmQ4MWU2ZjY5N2NlZTEwNTk4NWZjYjc5
11
- ZjVmMTk4MTY4MjRkOTg2MjY4NzY5Mjk4YTQ4NGMzYjIwNDA4M2I=
9
+ NzA2OTRmZWM0NjIzMDY1ODcyOTRiYTVmNDJlNjA2NWQxOGQxZjk2ZDI4ZGJl
10
+ OTUyZTYwZjc0ZjEyODY3ZTg0OTNjMmNlZTM3ZTRmMzFhN2RjODU4MTY5ZTE3
11
+ MTZlNmI2OWM0ZmRkMmY3YTVkNGZiYjA5ZWEyYzQ5MjljYWYxNTY=
12
12
  data.tar.gz: !binary |-
13
- N2EyMTRhZmU4YTQxOTU4M2QyZWI4MDk2YzgwZTIzZWU0MDkyZGM1ZWNkY2Qw
14
- MDJkNjA1ZjllYzljMTkyYTgwZmZjZTVjNjFkMzk1MWI1MjI1Y2I1OWUzNmQ0
15
- NTYwMjBkZDQ1YzMyMDQ4YjBkMmYzNTMwYmJiYjJjMDFmM2U3M2I=
13
+ YTY3YWEwZTkwMTNmODNiMWUxOWE1Mzg0MWExYmNkMWRhNmRlMGZmOTI4ODk0
14
+ OWJkZjMwNGY3ODUxZWRiYTQ3YmM5YTRhYTllOWRjYjkxMTFhMjc2MzE3ZGUy
15
+ MmU5YWZhYmY1MjcyYzRhOTZmODY2ZGEzOTgxMmUyMDg5OTk1ZWM=
data/.travis.yml ADDED
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - rbx-19mode
6
+
7
+ before_install:
8
+ - sudo apt-get update -qq
9
+ - sudo apt-get install -qq -y gifsicle
data/README.md CHANGED
@@ -1,7 +1,15 @@
1
- # Giftrim
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
@@ -1 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.pattern = 'test/**/*_test.rb'
7
+ end
8
+ task :default => :test
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
 
@@ -1,3 +1,3 @@
1
1
  module Giftrim
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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 = "gifsicle --info #{@path}"
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 = "gifsicle --resize-fit '300x300' #{@path} #{frames_formatted} > #{@outfile.path}"
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
@@ -1,3 +1,5 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
1
3
  require 'simplecov'
2
4
  require 'simplecov-gem-adapter'
3
5
  SimpleCov.start 'gem'
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.1
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