gif2lgtm 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da53041d1c2274b8e1c803b12dd2ceb8abf18880563d201e36cec41841350d2f
4
- data.tar.gz: dcdc0401a32744c787a0f61c7200173012419fdf08f7d835700b44fa152321c0
3
+ metadata.gz: a6d48328e2f40b0a65d08bdab9aaaa76d711d3ecfcbc744d3e85ecd09fff504a
4
+ data.tar.gz: 138d496fee9283897d2f2315971847aa4e0000584e441a31860b831e5644b853
5
5
  SHA512:
6
- metadata.gz: c8abb95a79b9523a5b63b8c90d219bf3cb5f52154873b06b2cb69d3dbb7c40e7d36338fb09aa98393b3510721996ad8ef6d61aace4d3bf991938c1aa6bc21e23
7
- data.tar.gz: fd5ac127985b7e131b6d0a978e82d546138c4f274d20730a8d5e61a75e7352d6161274fc5334debb55fce9ed994e829a4aa40be2e7c4e8314aff395935f5d922
6
+ metadata.gz: 5da90af58d7e27519a4a4ddab31599089a1425c84cfe32b23f74e97885b1bed11f0f3b352ccdea65534c80bcb39789dc45023cdd0ae44bfb7a188287777a4b17
7
+ data.tar.gz: bd60f9233778b959c26744048a40c5189eaccc070042471c39ce7a36c4c6ea600b20d93c5cdd9c8df74a3cedbdc3769c68c097aec440a6d89c4f3ea7e2a8bc90
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gif2lgtm (1.0.2)
4
+ gif2lgtm (1.0.3)
5
5
  rmagick
6
6
  thor
7
7
 
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
- # Gif2lgtm
1
+ # Gif2LGTM
2
+ Gif2LGTM is a command line tool that generates lgtm images. Not only gif but also `png` and `jpeg` are supported.
2
3
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gif2lgtm`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
4
+ ![lgtm](images/rain.gif)
6
5
 
7
6
  ## Installation
8
7
  First, install the imagemagick. see [imagemagick](https://imagemagick.org/).
@@ -13,20 +12,13 @@ install it yourself as:
13
12
 
14
13
  $ gem install gif2lgtm
15
14
 
15
+
16
16
  ## Usage
17
17
  Pass the file path to the command. Not only gif but also jpeg and png can be created.
18
18
 
19
19
  $ gif2lgtm start bar.gif
20
20
 
21
21
  Only this. The lgtm-image is generated in the same location as the passed file.
22
- ## Development
23
-
24
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
25
-
26
- ## Contributing
27
-
28
- Bug reports and pull requests are welcome on GitHub at https://github.com/iavivai/gif2lgtm.
29
22
 
30
23
  ## License
31
-
32
24
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/images/rain.gif ADDED
Binary file
Binary file
Binary file
data/lib/gif2lgtm/cli.rb CHANGED
@@ -2,14 +2,21 @@ require 'thor'
2
2
 
3
3
  module Gif2lgtm
4
4
  class Cli < Thor
5
- desc 'start ./bar.gif', 'Pass the file path.'
6
- def start(image)
7
- ext = File.extname(image).delete('.').upcase
5
+ SUPPORT_FORMARTS = ['GIF', 'PNG', 'JPEG', 'JPG'].freeze
8
6
 
9
- if Magick.formats.keys.include?(ext)
10
- Gif2lgtm::Main.start(image)
11
- else
12
- puts 'This extension is not allowed.'
7
+ desc 'start ./foo.gif', 'Pass the file path.'
8
+ def start(*images)
9
+ # TODO: test
10
+ images.each do |image|
11
+ ext = File.extname(image).delete('.').upcase
12
+
13
+ if SUPPORT_FORMARTS.include?(ext)
14
+ Gif2lgtm::Main.start(image)
15
+ else
16
+ puts "extension: #{ext}"
17
+ puts 'This extension is not allowed.'
18
+ puts
19
+ end
13
20
  end
14
21
  end
15
22
  end
data/lib/gif2lgtm/main.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  module Gif2lgtm
2
2
  module Main
3
3
  module_function
4
+ LOOP_COUNT = 0
4
5
 
5
6
  def start(image_path)
6
7
  gif = compsite!(image_path)
@@ -10,7 +11,7 @@ module Gif2lgtm
10
11
  def compsite!(image_path)
11
12
  gif = Magick::ImageList.new
12
13
  images = Magick::ImageList.new(image_path)
13
- original_size_lgtm = Magick::ImageList.new('https://raw.githubusercontent.com/iavivai/gif2lgtm/master/images/lgtm.png')
14
+ original_size_lgtm = Magick::ImageList.new("#{Dir.pwd}/images/lgtm.png")
14
15
  lgtm = original_size_lgtm.resize_to_fit(images.first.columns, images.first.rows)
15
16
 
16
17
  images.each do |image|
@@ -27,7 +28,7 @@ module Gif2lgtm
27
28
  end
28
29
 
29
30
  def create!(gif, image_path)
30
- gif.iterations = 0
31
+ gif.iterations = LOOP_COUNT
31
32
  random = SecureRandom.hex(5)
32
33
  dir_path = File.dirname(image_path)
33
34
  result_path = "#{dir_path}/lgtm_#{random}_#{File.basename(image_path)}"
@@ -1,3 +1,3 @@
1
1
  module Gif2lgtm
2
- VERSION = "1.0.3"
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gif2lgtm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - iavivai
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-26 00:00:00.000000000 Z
11
+ date: 2019-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -101,6 +101,9 @@ files:
101
101
  - exe/gif2lgtm
102
102
  - gif2lgtm.gemspec
103
103
  - images/lgtm.png
104
+ - images/rain.gif
105
+ - images/test/test_1.jpg
106
+ - images/test/test_2.jpg
104
107
  - lib/gif2lgtm.rb
105
108
  - lib/gif2lgtm/cli.rb
106
109
  - lib/gif2lgtm/main.rb
@@ -124,8 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
127
  - !ruby/object:Gem::Version
125
128
  version: '0'
126
129
  requirements: []
127
- rubyforge_project:
128
- rubygems_version: 2.7.6
130
+ rubygems_version: 3.0.3
129
131
  signing_key:
130
132
  specification_version: 4
131
133
  summary: gif to LGTM.