cliptic 0.1.1 → 0.1.2

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: a111afd996822491916a4b3a30a23ec14f8f42a0c5672bbb7bfc9b30dd01b5b7
4
- data.tar.gz: 96179d16fb507ef749d2557ae6f63be9f2dfed9f27e07b20090dd691218bfaf1
3
+ metadata.gz: bed7e4167bd109d3595030a840bfa5295f7fefea8306db6a8843e09feb5bf1c5
4
+ data.tar.gz: 76c18f65f31077f7611d37e94025a2133f272553291a0a1cda68eebb3428966a
5
5
  SHA512:
6
- metadata.gz: eda2f04490818ecf91f1d6408e365a165f3b682965a7858e98c9af5b0ec9a167b544d712d51e198faa66944aa205804ce65aac6dc7df9c7ac1a2152848cd44db
7
- data.tar.gz: 28fdc763822316d58390e9b51f478315e228a4690ed2a7908430897139f6757267a08aef9bd606549a9678b1e619b7f2922110aa44c1e78afd6a17881d37766d
6
+ metadata.gz: 26e80fd00217904ed0d081cf8a676c339e82d2c586667ebf8f47daa542fb9b3ec427b8b89bb4860b087b28f555624d03ccfa56fd1d9050bd28dfe4dcaff1968f
7
+ data.tar.gz: 8c29f4b0fa7ef0c25db0256854917de5b868f3068099588dc423c1aa4aa8f23715c7124d15e5175577b161cf0e2e0109a5587f049aaba6ad9e8960618cba79e7
data/CHANGELOG.md CHANGED
@@ -5,3 +5,14 @@
5
5
  ## [0.1.1] - 2021-07-11
6
6
 
7
7
  - Minor change to fix screen setup bug
8
+
9
+ ## [0.1.2] - 2021-07-15
10
+
11
+ ### Bug Fixes
12
+ - Screen setup/config file bug fix
13
+ * Previously screen resize prompt would not show if screen was too small due to inability to source default colours
14
+ - Fix earliest date bug
15
+ - Center the resize prompt
16
+
17
+ ### Features
18
+ - Add menu recolour feature
data/Gemfile CHANGED
@@ -1,8 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
1
  source "https://rubygems.org"
4
2
 
5
- # Specify your gem's dependencies in cliptic.gemspec
6
3
  gemspec
7
4
 
8
5
  gem "rake", "~> 13.0"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cliptic (0.1.0)
4
+ cliptic (0.1.2)
5
5
  curb (~> 0.9.11)
6
6
  curses (~> 1.4.0)
7
7
  sqlite3 (~> 1.4.2)
data/README.md CHANGED
@@ -1,20 +1,32 @@
1
- # CLIptic
1
+ # `cliptic`: Crosswords in your Terminal
2
2
 
3
3
  ![](https://github.com/apexatoll/cliptic-files/blob/master/demo.gif)
4
4
 
5
+
5
6
  - A command-line interface for downloading and playing cryptic crosswords from within the terminal.
6
7
  - Puzzles are sourced from the free crosswords uploaded daily to [Lovatt's][1].
7
- - CLIptic is written in Ruby using the ncurses library
8
+ - cliptic is written in Ruby using the ncurses library
9
+
10
+ ## New to 0.1.2
11
+
12
+ ### Bug Fixes
13
+ - Screen setup/config file bug fix
14
+ * Previously screen resize prompt would not show if screen was too small due to inability to source default colours
15
+ - Fix earliest date bug (thank you `samtell21` for pointing this out)
16
+ - Center the resize prompt
17
+
18
+ ### Features
19
+ - Add menu recolour feature
8
20
 
9
21
  ## Features
10
22
  - VIM-like keybindings
11
23
  - Puzzles scraped daily from Lovatt's. Puzzles are cached locally to prevent excessive requests
12
24
  - Progress can be saved to continue puzzles at a later time
13
- - Time taken to complete the puzzle is logged on completion of puzzle. High scores can be viewed within CLIptic
25
+ - Time taken to complete the puzzle is logged on completion of puzzle. High scores can be viewed within cliptic
14
26
  - Track progress for puzzles released in the last week
15
27
  - Puzzle history is tracked, making it easy to pick up recently played puzzles
16
28
  - Select puzzles to play by date manually (puzzles are available for up to 9 months from release)
17
- - Customisation of CLIptic's appearance
29
+ - Customisation of cliptic's appearance
18
30
 
19
31
  ## Dependencies
20
32
 
@@ -31,7 +43,7 @@
31
43
  ## Installing
32
44
 
33
45
  ### As a Gem
34
- - CLIptic is available as a Ruby Gem. To install, simply run:
46
+ - cliptic is available as a Ruby Gem. To install, simply run:
35
47
  ```bash
36
48
  gem install cliptic
37
49
  ```
@@ -97,26 +109,26 @@ rake build install
97
109
  ### Global Commands
98
110
 
99
111
  | Command | Action |
100
- |---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
101
- | `^S` | Save current progress (note that progress is saved when exiting puzzles by default) |
112
+ |---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
113
+ | `^S` | Save current progress (note that progress is saved when exiting puzzles by default) |
102
114
  | `^R` | Reveals solution for focussed clue (note that this forfeits adding this puzzle to high scores) |
103
115
  | `^C` | Exit puzzle |
104
116
  | `^E` | Resets timer and progress for puzzle |
105
- | `^G` | Mark current progress (only relevant if auto_mark is set to 0) |
117
+ | `^G` | Mark current progress (only relevant if auto_mark is set to 0) |
106
118
  | `^P` | Pause game |
107
119
 
108
120
  ### Navigation (Normal Mode)
109
121
  - There are several ways to navigate the cells of the cliptic grid in **NORMAL MODE**.
110
122
 
111
- | Command | Action |
112
- |--------------------|----------------------------------------------------------------------------------------------------------------------------------|
123
+ | Command | Action |
124
+ |--------------------|----------------------------------------------------------------|
113
125
  | `h`, `j`, `k`, `l` | Move cursor left, up, down, right. Arrow keys can also be used |
114
- | `(n)w` | Move to (nth) next unsolved clue |
115
- | `(n)b` | Move to (nth) previous unsolved clue |
116
- | `e` | Move to end of clue |
117
- | `<clue number>g` | Move to clue by number |
118
- | `<cell number>G` | Move to cell by number (not 0 indexed |
119
- | `TAB` | Swap from across to down clue (or vice versa) |
126
+ | `(n)w` | Move to (nth) next unsolved clue |
127
+ | `(n)b` | Move to (nth) previous unsolved clue |
128
+ | `e` | Move to end of clue |
129
+ | `<clue number>g` | Move to clue by number |
130
+ | `<cell number>G` | Move to cell by number (not 0 indexed |
131
+ | `TAB` | Swap from across to down clue (or vice versa) |
120
132
 
121
133
  ### Entering Text (Insert Mode)
122
134
 
@@ -128,15 +140,15 @@ rake build install
128
140
 
129
141
  ### Normal Mode
130
142
 
131
- | Command | Action |
132
- |-----------|-----------------------------------------------------------------------------------------|
133
- | `I` | Move to the start of the clue and enter insert mode |
134
- | `a` | Advance one cell and enter insert mode |
135
- | `c(obj)` | calls d(obj) then enters insert mode |
143
+ | Command | Action |
144
+ |-----------|-----------------------------------------------------------------------------------------------------|
145
+ | `I` | Move to the start of the clue and enter insert mode |
146
+ | `a` | Advance one cell and enter insert mode |
147
+ | `c(obj)` | calls d(obj) then enters insert mode |
136
148
  | `d(obj)` | delete the object provided after d (may be w for word or l for character) |
137
- | `i` | Enter insert mode |
138
- | `r(char)` | Replaces the character under the cursor with `char` |
139
- | `x` | deletes the character under the cursor |
149
+ | `i` | Enter insert mode |
150
+ | `r(char)` | Replaces the character under the cursor with `char` |
151
+ | `x` | deletes the character under the cursor |
140
152
 
141
153
  ## Configuration
142
154
  - Cliptic settings can be added to the cliptic.rc file found at `~/.config/cliptic/cliptic.rc`
@@ -150,11 +162,11 @@ set <setting> <0/1>
150
162
 
151
163
  #### Settable Items
152
164
 
153
- | Item | Description | Default |
154
- |--------------|--------------------------------|---------|
155
- | auto_advance | Move to next clue after solve | 1 |
156
- | auto_mark | Mark clues as they are entered | 1 |
157
- | auto_save | Save progress on exit | 1 |
165
+ | Item | Description | Default |
166
+ |----------------|--------------------------------|---------|
167
+ | `auto_advance` | Move to next clue after solve | 1 |
168
+ | `auto_mark` | Mark clues as they are entered | 1 |
169
+ | `auto_save` | Save progress on exit | 1 |
158
170
 
159
171
  ### Colours
160
172
  - Colours are numbered 1-16.
@@ -168,22 +180,24 @@ hi <obj> <colour>
168
180
 
169
181
  #### Settable Items
170
182
 
171
- | Item | Description | Default |
172
- |------------|----------------------------|---------|
173
- | active_num | Grid number of active clue | 3 |
174
- | bar | Top and bottom bars | 16 |
175
- | block | Grid blocks | 8 |
176
- | box | Box outlines | 8 |
177
- | grid | cliptic grids | 8 |
178
- | incorrect | Incorrect clue attempt | 1 |
179
- | correct | Correct clue attempt | 2 |
180
- | prompt | Menu prompt | 3 |
181
- | default | Default text color | 0 |
182
- | meta | Clue box metadata | 3 |
183
- | num | Inactive grid numbers | 8 |
184
- | logo_text | Logo text color | 3 |
185
- | I | Insert mode prompt | 15 |
186
- | N | Normal mode prompt | 12 |
183
+ | Item | Description | Default |
184
+ |-----------------|----------------------------|---------|
185
+ | `active_num` | Grid number of active clue | 3 |
186
+ | `bar` | Top and bottom bars | 16 |
187
+ | `block` | Grid blocks | 8 |
188
+ | `box` | Box outlines | 8 |
189
+ | `grid` | cliptic grids | 8 |
190
+ | `incorrect` | Incorrect clue attempt | 1 |
191
+ | `correct` | Correct clue attempt | 2 |
192
+ | `prompt` | Menu prompt | 3 |
193
+ | `default` | Default text color | 0 |
194
+ | `meta` | Clue box metadata | 3 |
195
+ | `num` | Inactive grid numbers | 8 |
196
+ | `logo_text` | Logo text color | 3 |
197
+ | `I` | Insert mode prompt | 15 |
198
+ | `N` | Normal mode prompt | 12 |
199
+ | `menu_active` | Active menu option | 15 |
200
+ | `menu_inactive` | Inactive menu option | 0 |
187
201
 
188
202
  ## Feedback
189
203
  - Cliptic is still in development
data/Rakefile CHANGED
@@ -1,4 +1,2 @@
1
- # frozen_string_literal: true
2
-
3
1
  require "bundler/gem_tasks"
4
2
  task default: %i[]
@@ -3,57 +3,55 @@ module Cliptic
3
3
  Dir_Path = "#{Dir.home}/.config/cliptic"
4
4
  File_Path = "#{Dir_Path}/cliptic.rc"
5
5
  class Default
6
+ def self.set
7
+ $colors = colors
8
+ $config = make_bool(config)
9
+ end
10
+ private
6
11
  def self.colors
7
12
  {
8
13
  box:8, grid:8, bar:16, logo_grid:8,
9
- logo_text:1, title:3, stats:2, active_num:3,
14
+ logo_text:3, title:6, stats:6, active_num:3,
10
15
  num:8, block:8, I:15, N:12, correct:2,
11
- incorrect:1, meta:3, cluebox:8
16
+ incorrect:1, meta:3, cluebox:8,
17
+ menu_active:15, menu_inactive:0
12
18
  }
13
19
  end
14
20
  def self.config
15
21
  {
16
- auto_advance:1,
17
- auto_mark:1,
18
- auto_save:1
22
+ auto_advance:1, auto_mark:1, auto_save:1
19
23
  }
20
24
  end
21
- end
22
- class Setter
23
- attr_reader :colors, :config
24
- def initialize
25
- $colors = Default.colors
26
- $config = Default.config
25
+ def self.make_bool(hash)
26
+ hash.each{|k, v| hash[k] = v == 1 }
27
27
  end
28
- def set
29
- cfg_file_exists? ?
30
- read_cfg : gen_cfg_menu.choose_opt
31
- $config = make_bool($config)
28
+ end
29
+ class Custom < Default
30
+ def self.set
31
+ cfg_file_exists? ? read_cfg : gen_cfg_menu.choose_opt
32
32
  end
33
33
  private
34
- def read_cfg
34
+ def self.read_cfg
35
35
  Reader.new.tap do |file|
36
- cfg_file_keys.each do |dest, key|
36
+ key_map.each do |dest, key|
37
37
  dest.merge!(file.read(**key))
38
38
  end
39
39
  end
40
+ make_bool($config)
40
41
  end
41
- def cfg_file_keys
42
+ def self.key_map
42
43
  {
43
44
  $colors => {key:"hi"},
44
45
  $config => {key:"set"}
45
46
  }
46
47
  end
47
- def cfg_file_exists?
48
+ def self.cfg_file_exists?
48
49
  File.exist?(File_Path)
49
50
  end
50
- def make_bool(hash)
51
- hash.map{|k, v| [k, v == 1]}.to_h
52
- end
53
- def gen_cfg_menu
51
+ def self.gen_cfg_menu
54
52
  Cliptic::Interface::Yes_No_Menu.new(
55
53
  yes:->{Generator.new.write},
56
- title:"Generate a config file?"
54
+ title:"Generate config file?"
57
55
  )
58
56
  end
59
57
  end
@@ -97,6 +97,9 @@ module Cliptic
97
97
  def prompt
98
98
  "Screen too small. Increase screen size to run cliptic."
99
99
  end
100
+ def line
101
+ (Curses.lines-8)/2
102
+ end
100
103
  end
101
104
  class Selector < Windows::Window
102
105
  attr_reader :opts, :ctrls, :run, :tick
data/lib/cliptic/menus.rb CHANGED
@@ -16,8 +16,9 @@ module Cliptic
16
16
  end
17
17
  end
18
18
  class Select_Date < Interface::Menu_With_Stats
19
- attr_reader :opts
19
+ attr_reader :opts, :earliest_date
20
20
  def initialize
21
+ @earliest_date = (Date.today << 9) + 1
21
22
  set_date(date:Date.today)
22
23
  super(height:7, sel:Interface::Date_Selector)
23
24
  end
@@ -88,14 +89,14 @@ module Cliptic
88
89
  Date.new(date[2], date[1]+1, 1)-1
89
90
  end
90
91
  def check_in_range
91
- set_date(date:Date.today) if date_late?
92
- set_date(date:Date.today << 9) if date_early?
92
+ set_date(date:Date.today) if date_late?
93
+ set_date(date:earliest_date) if date_early?
93
94
  end
94
95
  def date_late?
95
96
  stat_date > Date.today
96
97
  end
97
98
  def date_early?
98
- stat_date < Date.today<<9
99
+ stat_date < earliest_date
99
100
  end
100
101
  end
101
102
  class This_Week < Interface::Menu_With_Stats
@@ -10,8 +10,9 @@ module Cliptic
10
10
  end
11
11
  private
12
12
  def self.setup
13
+ Config::Default.set
13
14
  Screen.setup
14
- Config::Setter.new.set
15
+ Config::Custom.set
15
16
  at_exit{close}
16
17
  end
17
18
  def self.main_menu
@@ -1,5 +1,3 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Cliptic
4
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
5
3
  end
@@ -82,6 +82,12 @@ module Cliptic
82
82
  def move(line:nil, col:nil)
83
83
  super(*center_pos(y:y, x:x, line:line, col:col))
84
84
  end
85
+ def standout
86
+ color($colors[:menu_active])
87
+ end
88
+ def standend
89
+ color($colors[:menu_inactive])
90
+ end
85
91
  private
86
92
  def wrap_dims(y:, x:)
87
93
  [y, x].zip(total_dims)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cliptic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Welham
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-11 00:00:00.000000000 Z
11
+ date: 2021-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curses