gif2lgtm 1.0.3 → 1.0.4
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -12
- data/images/rain.gif +0 -0
- data/images/test/test_1.jpg +0 -0
- data/images/test/test_2.jpg +0 -0
- data/lib/gif2lgtm/cli.rb +14 -7
- data/lib/gif2lgtm/main.rb +3 -2
- data/lib/gif2lgtm/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6d48328e2f40b0a65d08bdab9aaaa76d711d3ecfcbc744d3e85ecd09fff504a
|
4
|
+
data.tar.gz: 138d496fee9283897d2f2315971847aa4e0000584e441a31860b831e5644b853
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5da90af58d7e27519a4a4ddab31599089a1425c84cfe32b23f74e97885b1bed11f0f3b352ccdea65534c80bcb39789dc45023cdd0ae44bfb7a188287777a4b17
|
7
|
+
data.tar.gz: bd60f9233778b959c26744048a40c5189eaccc070042471c39ce7a36c4c6ea600b20d93c5cdd9c8df74a3cedbdc3769c68c097aec440a6d89c4f3ea7e2a8bc90
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
#
|
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
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
4
|
+

|
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
|
-
|
6
|
-
def start(image)
|
7
|
-
ext = File.extname(image).delete('.').upcase
|
5
|
+
SUPPORT_FORMARTS = ['GIF', 'PNG', 'JPEG', 'JPG'].freeze
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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(
|
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 =
|
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)}"
|
data/lib/gif2lgtm/version.rb
CHANGED
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.
|
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-
|
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
|
-
|
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.
|