vimgolf-finder 0.1.5 → 0.1.6

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
  SHA1:
3
- metadata.gz: 19e7461d5ffdd7eae7524732bc979fef5d627fee
4
- data.tar.gz: bc85c1823efd18e854f2948c0be42cc038f374e1
3
+ metadata.gz: 06a148fd40c696a29a1e25cb9d33eb9dd31c8847
4
+ data.tar.gz: 32c6ca058282db10a5738bbaca5b4a095dbc73fc
5
5
  SHA512:
6
- metadata.gz: 1365e55cce556a62c7de409cdfc708baf9815fce43f4544bffcb2a0a5802ec750de2c0683efb380015b2ea2dc12ffbb4f0d869f22a314c7e1be5e22084b26e02
7
- data.tar.gz: 6d6fb896e76ef9b890f8e1de305cd5c9db18896845fa42eafa5dc5fc7ca808ccb6c29616825264e58c5105382852b2b32ee97a91acc56f5903e02f07736f3452
6
+ metadata.gz: 8c687bf4e0d47d3db3083aa0f66393542d7eba7b9875c805503c62e0f510cc5b5ff3815ed51fb2f8ea2ba06237f682df0bce84c581c70b6087a95b051783db23
7
+ data.tar.gz: 881ee5e27ac7a2fe5c84216786fc231ad7dacb8f85504f4e2ec2e131f3fdbaf2759b35012fef8aec8aad6f568707b203610e991592660dea78816cf548efe272
data/README.md CHANGED
@@ -7,7 +7,7 @@ Simple VimGolf challenge finder. It just toy project for me! :smile:
7
7
  [![asciicast](https://asciinema.org/a/1whcqi8pjldxi767iiknqxeil.png)](https://asciinema.org/a/1whcqi8pjldxi767iiknqxeil)
8
8
 
9
9
  ## Installation
10
- Add this line to your application's Gemfile:
10
+ Paste this at a terminal prompt:
11
11
  ```
12
12
  $ gem install vimgolf-finder
13
13
  ```
@@ -96,6 +96,22 @@ Do you want to play? (y/n) y
96
96
 
97
97
  # Playing VimGolf...
98
98
 
99
+ Thanks for playing!
100
+ Solves? (y/n) n
101
+ ```
102
+
103
+ ### Solves 🔎
104
+ Show solved VimGolf challenges
105
+ ```
106
+ $ vimgolf-finder solves
107
+ 1. Simple, Practical, and Common - 7953 entries (55b18bbea9c2c30d04000001) [✓]
108
+ Choose challenge number. 1
109
+
110
+ Open your web browser? (y/n) y
111
+ Do you want to play? (y/n) y
112
+
113
+ # Playing VimGolf...
114
+
99
115
  Thanks for playing!
100
116
  Solves? (y/n) n
101
117
  $
@@ -6,7 +6,7 @@ module VimGolfFinder
6
6
 
7
7
  def print(index = 1)
8
8
  if self.solved?
9
- VimGolfFinder.ui.log "#{index}. \e[37m#{self.title}\e[0m - #{self.entries} entries (\e[33m#{self.id}\e[0m) [\u2713]"
9
+ VimGolfFinder.ui.log "#{index}. \e[37m#{self.title}\e[0m - #{self.entries} entries (\e[33m#{self.id}\e[0m) \e[32m[\u2713]\e[0m"
10
10
  else
11
11
  VimGolfFinder.ui.log "#{index}. \e[37m#{self.title}\e[0m - #{self.entries} entries (\e[33m#{self.id}\e[0m)"
12
12
  end
@@ -77,6 +77,35 @@ module VimGolfFinder
77
77
  play(id)
78
78
  end
79
79
 
80
+ desc 'solves', 'Show solved VimGolf challenges'
81
+ def solves
82
+ challenges = VimGolfFinder.parser.fetch_challenges
83
+
84
+ solved_challenges = []
85
+ challenges.each do |challenge|
86
+ if challenge.solved?
87
+ solved_challenges << challenge
88
+ end
89
+ end
90
+
91
+ solved_challenges.each_with_index do |challenge, index|
92
+ challenge.print(index+1)
93
+ end
94
+
95
+ number = VimGolfFinder.ui.ask 'Choose challenge number.'
96
+ number = number.to_i
97
+ if number.instance_of? Fixnum
98
+ if number < 1 or number > solved_challenges.count
99
+ VimGolfFinder.ui.error 'Invalid number'
100
+ return
101
+ end
102
+
103
+ id = challenges[number-1].id
104
+ print_challenge(id)
105
+ play(id)
106
+ end
107
+ end
108
+
80
109
  private
81
110
  def print_challenge(id)
82
111
  VimGolfFinder.ui.log ''
@@ -1,3 +1,3 @@
1
1
  module VimGolfFinder
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimgolf-finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Sun-Hyoup