irasutoya-cli 0.1.0 → 0.2.0

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a66c1b6b1327124a5dc391066d48e5197bc3774d18078d8fa0ec5d1517647b8e
4
- data.tar.gz: aa17bd88db54986da23366f579d8ccd500232cafee17b88dcfc448d90a38feba
3
+ metadata.gz: e10c8ff8bddcd7eb83923ae042332a2554abfc4144262db317a3b1085e32889f
4
+ data.tar.gz: 4a58bef84e4f75b8c8e717621c4e93f8ef91be2933be77f69c4d1e0a5a0ed4c7
5
5
  SHA512:
6
- metadata.gz: 48fe036d8e67b26f13360c86247f3f97a7b0a8c76ce5018a315c55af213b9c0c342c9b8a57d836850793dec5942941d43ef2164ce2c8f79a65296a23f9891937
7
- data.tar.gz: 6d761392289d9f10b9f61cb04262aa29d0b09b0ba8f2bbd424eb75345354d687fc17207daa390f21ed6735ce942f9a3f2d3ec93a6901125e0a4dacd0dfc6c78c
6
+ metadata.gz: 417b78d50561284015dcf15ea967988dfcafc820439c8de424c142c2205721bdbd703b68db974257d2db97e01b349cf0929965b0f4b1012a7f27e6b835004a2e
7
+ data.tar.gz: add9d0140bc5d0c2eae5e42a1f402573b7aad2416b41f58f20b61c49ef89f93400d5ed70ec07a51a6aa00bb4a76bb3e24b729713ad4b476d062064824359995e
@@ -1,3 +1,7 @@
1
+ AllCops:
2
+ NewCops: enable
3
+ TargetRubyVersion: 2.5
4
+
1
5
  Style/Documentation:
2
6
  Enabled: false
3
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- irasutoya-cli (0.1.0)
4
+ irasutoya-cli (0.2.0)
5
5
  irasutoya
6
6
  terminal_image
7
7
  thor
@@ -9,18 +9,17 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- ast (2.4.0)
13
- codecov (0.1.14)
12
+ ast (2.4.1)
13
+ codecov (0.2.12)
14
14
  json
15
15
  simplecov
16
- url
17
- coderay (1.1.2)
18
- diff-lcs (1.3)
16
+ coderay (1.1.3)
17
+ diff-lcs (1.4.4)
19
18
  docile (1.3.2)
20
- fastimage (2.1.7)
21
- ffi (1.11.1)
19
+ fastimage (2.2.0)
20
+ ffi (1.13.1)
22
21
  formatador (0.2.5)
23
- guard (2.15.1)
22
+ guard (2.16.2)
24
23
  formatador (>= 0.2.4)
25
24
  listen (>= 2.7, < 4.0)
26
25
  lumberjack (>= 1.0.12, < 2.0)
@@ -34,70 +33,71 @@ GEM
34
33
  guard (~> 2.1)
35
34
  guard-compat (~> 1.1)
36
35
  rspec (>= 2.99.0, < 4.0)
37
- guard-rubocop (1.3.0)
36
+ guard-rubocop (1.4.0)
38
37
  guard (~> 2.0)
39
- rubocop (~> 0.20)
40
- irasutoya (1.0.0)
38
+ rubocop (< 2.0)
39
+ irasutoya (1.1.0)
41
40
  nokogiri
42
- jaro_winkler (1.5.3)
43
- json (2.2.0)
44
- listen (3.1.5)
45
- rb-fsevent (~> 0.9, >= 0.9.4)
46
- rb-inotify (~> 0.9, >= 0.9.7)
47
- ruby_dep (~> 1.2)
48
- lumberjack (1.0.13)
49
- method_source (0.9.2)
41
+ json (2.3.1)
42
+ listen (3.2.1)
43
+ rb-fsevent (~> 0.10, >= 0.10.3)
44
+ rb-inotify (~> 0.9, >= 0.9.10)
45
+ lumberjack (1.2.8)
46
+ method_source (1.0.0)
50
47
  mini_portile2 (2.4.0)
51
48
  nenv (0.3.0)
52
- nokogiri (1.10.4)
49
+ nokogiri (1.10.10)
53
50
  mini_portile2 (~> 2.4.0)
54
51
  notiffany (0.1.3)
55
52
  nenv (~> 0.1)
56
53
  shellany (~> 0.0)
57
- parallel (1.17.0)
58
- parser (2.6.4.1)
59
- ast (~> 2.4.0)
60
- pry (0.12.2)
61
- coderay (~> 1.1.0)
62
- method_source (~> 0.9.0)
54
+ parallel (1.19.2)
55
+ parser (2.7.2.0)
56
+ ast (~> 2.4.1)
57
+ pry (0.13.1)
58
+ coderay (~> 1.1)
59
+ method_source (~> 1.0)
63
60
  rainbow (3.0.0)
64
- rake (12.3.3)
65
- rb-fsevent (0.10.3)
66
- rb-inotify (0.10.0)
61
+ rake (13.0.1)
62
+ rb-fsevent (0.10.4)
63
+ rb-inotify (0.10.1)
67
64
  ffi (~> 1.0)
68
- rspec (3.8.0)
69
- rspec-core (~> 3.8.0)
70
- rspec-expectations (~> 3.8.0)
71
- rspec-mocks (~> 3.8.0)
72
- rspec-core (3.8.2)
73
- rspec-support (~> 3.8.0)
74
- rspec-expectations (3.8.4)
65
+ regexp_parser (1.8.2)
66
+ rexml (3.2.4)
67
+ rspec (3.10.0)
68
+ rspec-core (~> 3.10.0)
69
+ rspec-expectations (~> 3.10.0)
70
+ rspec-mocks (~> 3.10.0)
71
+ rspec-core (3.10.0)
72
+ rspec-support (~> 3.10.0)
73
+ rspec-expectations (3.10.0)
75
74
  diff-lcs (>= 1.2.0, < 2.0)
76
- rspec-support (~> 3.8.0)
77
- rspec-mocks (3.8.1)
75
+ rspec-support (~> 3.10.0)
76
+ rspec-mocks (3.10.0)
78
77
  diff-lcs (>= 1.2.0, < 2.0)
79
- rspec-support (~> 3.8.0)
80
- rspec-support (3.8.2)
81
- rubocop (0.74.0)
82
- jaro_winkler (~> 1.5.1)
78
+ rspec-support (~> 3.10.0)
79
+ rspec-support (3.10.0)
80
+ rubocop (1.2.0)
83
81
  parallel (~> 1.10)
84
- parser (>= 2.6)
82
+ parser (>= 2.7.1.5)
85
83
  rainbow (>= 2.2.2, < 4.0)
84
+ regexp_parser (>= 1.8)
85
+ rexml
86
+ rubocop-ast (>= 1.0.1)
86
87
  ruby-progressbar (~> 1.7)
87
- unicode-display_width (>= 1.4.0, < 1.7)
88
+ unicode-display_width (>= 1.4.0, < 2.0)
89
+ rubocop-ast (1.1.1)
90
+ parser (>= 2.7.1.5)
88
91
  ruby-progressbar (1.10.1)
89
- ruby_dep (1.5.0)
90
92
  shellany (0.0.1)
91
- simplecov (0.17.0)
93
+ simplecov (0.19.1)
92
94
  docile (~> 1.1)
93
- json (>= 1.8, < 3)
94
- simplecov-html (~> 0.10.0)
95
- simplecov-html (0.10.2)
95
+ simplecov-html (~> 0.11)
96
+ simplecov-html (0.12.3)
96
97
  terminal_image (0.3.0)
97
98
  fastimage
98
- thor (0.20.3)
99
- unicode-display_width (1.6.0)
100
- url (0.3.2)
99
+ thor (1.0.1)
100
+ unicode-display_width (1.7.0)
101
101
 
102
102
  PLATFORMS
103
103
  ruby
@@ -109,7 +109,7 @@ DEPENDENCIES
109
109
  guard-rspec
110
110
  guard-rubocop
111
111
  irasutoya-cli!
112
- rake (~> 12.3)
112
+ rake (~> 13.0)
113
113
  rspec (~> 3.0)
114
114
  rubocop
115
115
  simplecov
data/README.md CHANGED
@@ -1,34 +1,32 @@
1
1
  # Irasutoya::Cli
2
2
 
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/irasutoya/cli`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Gem Version](https://badge.fury.io/rb/irasutoya-cli.svg)](https://badge.fury.io/rb/irasutoya-cli)
4
+ [![Circle CI](https://circleci.com/gh/unhappychoice/irasutoya-cli.svg?style=shield)](https://circleci.com/gh/unhappychoice/irasutoya-cli)
5
+ [![Code Climate](https://codeclimate.com/github/unhappychoice/irasutoya-cli/badges/gpa.svg)](https://codeclimate.com/github/unhappychoice/irasutoya-cli)
6
+ [![codecov](https://codecov.io/gh/unhappychoice/irasutoya-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/unhappychoice/irasutoya-cli)
7
+ [![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/unhappychoice/irasutoya-cli.svg)](https://libraries.io/github/unhappychoice/irasutoya-cli)
8
+ ![](http://ruby-gem-downloads-badge.herokuapp.com/irasutoya-cli?type=total)
9
+ ![GitHub](https://img.shields.io/github/license/unhappychoice/irasutoya-cli.svg)
4
10
 
5
- TODO: Delete this and the text above, and describe your gem
11
+ ![](./images/example.png)
6
12
 
7
13
  ## Installation
8
14
 
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'irasutoya-cli'
15
+ ```sh
16
+ $ gem install irasutoya-cli
13
17
  ```
14
18
 
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install irasutoya-cli
19
+ To see preview of image, you need to use [iTerm2](https://iterm2.com/index.html) or terminals with [libsixel](https://github.com/saitoha/libsixel) installed.
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- 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).
23
+ ```sh
24
+ $ irasutoya
25
+ Commands:
26
+ irasutoya help [COMMAND] # Describe available commands or one specific command
27
+ irasutoya random # Gives you random irasutoya image
28
+ irasutoya search {query} # Gives you irasutoya 3 images by given query
29
+ ```
32
30
 
33
31
  ## Contributing
34
32
 
Binary file
@@ -7,6 +7,7 @@ require 'irasutoya/cli/version'
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'irasutoya-cli'
9
9
  spec.version = Irasutoya::Cli::VERSION
10
+ spec.required_ruby_version = '>= 2.5'
10
11
  spec.authors = ['Yuji Ueki']
11
12
  spec.email = ['unhappychoice@gmail.com']
12
13
 
@@ -37,7 +38,7 @@ Gem::Specification.new do |spec|
37
38
  spec.add_development_dependency 'guard'
38
39
  spec.add_development_dependency 'guard-rspec'
39
40
  spec.add_development_dependency 'guard-rubocop'
40
- spec.add_development_dependency 'rake', '~> 12.3'
41
+ spec.add_development_dependency 'rake', '~> 13.0'
41
42
  spec.add_development_dependency 'rspec', '~> 3.0'
42
43
  spec.add_development_dependency 'rubocop'
43
44
  spec.add_development_dependency 'simplecov'
@@ -11,12 +11,27 @@ module Irasutoya
11
11
  class Runner < Thor
12
12
  desc 'random', 'Gives you random irasutoya image'
13
13
  def random
14
- irasuto = Irasutoya::Irasuto.random
14
+ display(Irasutoya::Irasuto.random)
15
+ end
16
+
17
+ desc 'search {query}', 'Gives you 3 irasutoya images by given query'
18
+ def search(query)
19
+ Irasutoya::Irasuto
20
+ .search(query: query)
21
+ .take(3)
22
+ .flat_map(&:fetch_irasuto)
23
+ .compact
24
+ .each(&method(:display))
25
+ end
26
+
27
+ private
28
+
29
+ def display(irasuto)
15
30
  say "Page URL: #{irasuto.url}"
16
31
  say "Title: #{irasuto.title}"
17
32
  say "Description: #{irasuto.description}"
18
- say "Image URL: #{irasuto.image_url}"
19
- TerminalImage.show_url(irasuto.image_url)
33
+ irasuto.image_urls.each { |image_url| say "Image URL: #{image_url}" }
34
+ irasuto.image_urls.each(&TerminalImage.method(:show_url))
20
35
  rescue TerminalImage::UnsupportedTerminal
21
36
  say 'warn: This terminal is not able to show images inline', :yellow
22
37
  say 'warn: Please use iTerm2 or terminal installed libsixel.', :yellow
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Irasutoya
4
4
  module Cli
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irasutoya-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuji Ueki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-16 00:00:00.000000000 Z
11
+ date: 2020-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: irasutoya
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '12.3'
131
+ version: '13.0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '12.3'
138
+ version: '13.0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: rspec
141
141
  requirement: !ruby/object:Gem::Requirement
@@ -197,6 +197,7 @@ files:
197
197
  - README.md
198
198
  - Rakefile
199
199
  - exe/irasutoya
200
+ - images/example.png
200
201
  - irasutoya-cli.gemspec
201
202
  - lib/irasutoya/cli.rb
202
203
  - lib/irasutoya/cli/version.rb
@@ -215,7 +216,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
216
  requirements:
216
217
  - - ">="
217
218
  - !ruby/object:Gem::Version
218
- version: '0'
219
+ version: '2.5'
219
220
  required_rubygems_version: !ruby/object:Gem::Requirement
220
221
  requirements:
221
222
  - - ">="