vimgolf-finder 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/vimgolf_finder/challenge.rb +1 -1
- data/lib/vimgolf_finder/cli.rb +6 -3
- data/lib/vimgolf_finder/parser.rb +3 -3
- data/lib/vimgolf_finder/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ecdf37d25dccd847f35afad840a47dc22c2f6cc149cddbc06613e6ac089e55a5
|
4
|
+
data.tar.gz: 19d602c1423e6c8f78f609d3981ecbed0cabcec5691f449261ac0a8b6c1977c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b9edd0609ab95167e65c79481df886d6478d534abbd05d0ba954f8a1d9f1bd3c1a2f12265fbb80fac8e694bbcfb94f5080400d7f0d7b48ac85c0a11b14f520c
|
7
|
+
data.tar.gz: 64dadc65b6e7588265c914acf241803a3132fc81862107f1cbcfd933d5cdbe8bc6d9f1b5fff287ba827bb81d962eefb9c8384ddb86e9d47595ff980378ea4100
|
data/lib/vimgolf_finder/cli.rb
CHANGED
@@ -54,7 +54,7 @@ module VimGolfFinder
|
|
54
54
|
|
55
55
|
number = VimGolfFinder.ui.ask 'Choose challenge number.'
|
56
56
|
number = number.to_i
|
57
|
-
if number.instance_of?
|
57
|
+
if number.instance_of? Integer
|
58
58
|
if number < 1 or number > limit
|
59
59
|
VimGolfFinder.ui.error 'Invalid number'
|
60
60
|
return
|
@@ -94,7 +94,7 @@ module VimGolfFinder
|
|
94
94
|
|
95
95
|
number = VimGolfFinder.ui.ask 'Choose challenge number.'
|
96
96
|
number = number.to_i
|
97
|
-
if number.instance_of?
|
97
|
+
if number.instance_of? Integer
|
98
98
|
if number < 1 or number > solved_challenges.count
|
99
99
|
VimGolfFinder.ui.error 'Invalid number'
|
100
100
|
return
|
@@ -124,7 +124,10 @@ module VimGolfFinder
|
|
124
124
|
result = VimGolfFinder.ui.ask 'Do you want to play? (y/n)'
|
125
125
|
|
126
126
|
if result.eql?('y') || result.eql?('yes')
|
127
|
-
system("vimgolf put #{id}")
|
127
|
+
if system("vimgolf put #{id}") == nil
|
128
|
+
VimGolfFinder.ui.error 'You need to install vimgolf. e.g. `gem install vimgolf`.'
|
129
|
+
return
|
130
|
+
end
|
128
131
|
|
129
132
|
solves = VimGolfFinder.ui.ask 'Solves? (y/n)'
|
130
133
|
|
@@ -5,7 +5,7 @@ module VimGolfFinder
|
|
5
5
|
def fetch_challenges
|
6
6
|
challenges = []
|
7
7
|
|
8
|
-
doc = Nokogiri::HTML(open(BASE_URL))
|
8
|
+
doc = Nokogiri::HTML(URI.open(BASE_URL))
|
9
9
|
doc.css('.grid_7 > div').each do |div|
|
10
10
|
challengeDOM = div.at_css('h5.challenge')
|
11
11
|
aTAG = challengeDOM.at_css('a')
|
@@ -22,7 +22,7 @@ module VimGolfFinder
|
|
22
22
|
def get_challenge(id)
|
23
23
|
challenge = VimGolfFinder::Challenge.new
|
24
24
|
|
25
|
-
doc = Nokogiri::HTML(open("#{BASE_URL}/challenges/#{id}", 'Accept' => 'text/html'))
|
25
|
+
doc = Nokogiri::HTML(URI.open("#{BASE_URL}/challenges/#{id}", 'Accept' => 'text/html'))
|
26
26
|
|
27
27
|
doc.css('.grid_7:not(#about)').each do |dom|
|
28
28
|
challenge.id = id
|
@@ -30,7 +30,7 @@ module VimGolfFinder
|
|
30
30
|
challenge.description = dom.at_css('p').content
|
31
31
|
challenge.start_file = dom.at_css('.prettyprint').content
|
32
32
|
challenge.end_file = dom.css('.prettyprint')[1].content
|
33
|
-
challenge.view_diff = dom.at_css('pre
|
33
|
+
challenge.view_diff = dom.at_css('pre#diff').content
|
34
34
|
end
|
35
35
|
|
36
36
|
challenge
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimgolf-finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lee Sun-Hyoup
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -123,7 +123,7 @@ homepage: https://github.com/kciter/vimgolf-finder
|
|
123
123
|
licenses:
|
124
124
|
- MIT
|
125
125
|
metadata: {}
|
126
|
-
post_install_message:
|
126
|
+
post_install_message:
|
127
127
|
rdoc_options: []
|
128
128
|
require_paths:
|
129
129
|
- lib
|
@@ -138,9 +138,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
138
138
|
- !ruby/object:Gem::Version
|
139
139
|
version: '0'
|
140
140
|
requirements: []
|
141
|
-
|
142
|
-
|
143
|
-
signing_key:
|
141
|
+
rubygems_version: 3.1.2
|
142
|
+
signing_key:
|
144
143
|
specification_version: 4
|
145
144
|
summary: VimGolf challenge finder.
|
146
145
|
test_files: []
|