lexdrill 0.4.0 → 0.5.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: 0510a355aeb50c560e27a73fd9ab70350c8e5c326d5dbd0ad43138e849b0bd2f
4
- data.tar.gz: 529f2a86af2ec0b735c3147bd412fe82d276f6d434e6a074deefb650270818eb
3
+ metadata.gz: 9ef368252ef581d3e56aadeef48302fef93cae68d52e95a5bb199977ffdf30fd
4
+ data.tar.gz: 7fb96023b0940dbce09e0cdb60d6561cc50ab52050c73536f777ca879f6f8c8d
5
5
  SHA512:
6
- metadata.gz: d9168c8d3218c457b6cf08662254d7b69f6adaef33cb1962a1dbcf4a0243c653bffbd9a74580e5cd7dbdcce9118fe0406b221d72f42b7347525a3a0adc93ee20
7
- data.tar.gz: 552834f01e378765ddf7549410ad964dc254c8c286bc34605f765661f68fb232100003dedad70c18fe025e8215cdba250d0c37f0a60338f235647f3335bb1eee
6
+ metadata.gz: 9f0786367ac59cf02606f3c6a59dec98787bb54fc938924c90321d122e8e793bff09a357220c59f4d8a3d2e705ab621ae5fbbb46fc3cc02b787aac9e38063049
7
+ data.tar.gz: d7ec11ee093daff986f0dd1a08ac521bf6067f0e7debf682a8183cb940c17d5a58c5f5ef7aa68c257fdd184b09017734b03dfaad7c6c357e3f92ee64c09919bb
data/README.md CHANGED
@@ -40,10 +40,20 @@ banana
40
40
  cherry
41
41
  ```
42
42
 
43
+ If you don't create one, `drill next` seeds `~/.drill.txt` with a default
44
+ starter list (a set of NLP presuppositions) the first time it runs, so
45
+ there's always something to drill.
46
+
43
47
  Run `drill next` to print the current word and advance to the next one.
44
- There are two output styles (`drill format simple|full`, `full` is the
48
+ There are two output styles (`drill format simple|full`, `simple` is the
45
49
  default):
46
50
 
51
+ **simple** — the drill sign (always blue), a space, then the word (in a
52
+ separately-picked random color), all on one line:
53
+ ```
54
+ ⟳ apple
55
+ ```
56
+
47
57
  **full** — `counter/total⟳[loop_start-loop_end]` on one line, the word on
48
58
  the next, in a randomly-picked color:
49
59
  ```
@@ -52,13 +62,6 @@ apple
52
62
  ```
53
63
  (word 1 of 6 total; currently in the loop spanning words 1-3)
54
64
 
55
- **simple** — three drill signs (always blue), then the word on its own
56
- line in a separately-picked random color:
57
- ```
58
- ⟳⟳⟳
59
- apple
60
- ```
61
-
62
65
  ### Shell integration (one-time setup)
63
66
 
64
67
  Add one line to your shell's rc file so the current word prints automatically
@@ -147,4 +150,4 @@ There are also named shortcuts for common loop sizes, one word/phrase apart:
147
150
  | `drill hook zsh\|bash` | Print the shell integration snippet (used above) |
148
151
  | `drill beat <2-8> <repetitions>` / `drill beat none` | Set or disable the rhythm |
149
152
  | `drill polka\|waltz\|rock\|jazz\|jiga\|balkan\|samba <repetitions>` | Shorthand for a fixed loop size (see table above) |
150
- | `drill format simple\|full` | Set the output style (`full` is the default) |
153
+ | `drill format simple\|full` | Set the output style (`simple` is the default) |
data/lib/lexdrill/cli.rb CHANGED
@@ -55,7 +55,7 @@ class Lexdrill::CLI
55
55
  drill beat none Disable the rhythm
56
56
  drill polka|waltz|rock|jazz|jiga|balkan|samba [repetitions]
57
57
  Shorthand for a fixed loop size (2 through 8, in order)
58
- drill format simple|full Set the output style (full is the default)
58
+ drill format simple|full Set the output style (simple is the default)
59
59
  HELP
60
60
  0
61
61
  end
@@ -13,6 +13,10 @@ module Lexdrill::Config
13
13
  ENV.fetch("LEXDRILL_PATH", nil) || dir_path || Dir.home
14
14
  end
15
15
 
16
+ def self.home_drill_path
17
+ File.join(Dir.home, FILENAME)
18
+ end
19
+
16
20
  DRILL_PATH = File.join(base_path, FILENAME)
17
21
  COUNTER_PATH = File.join(base_path, COUNTER_FILENAME)
18
22
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The starter list seeded into ~/.drill.txt on first run, when neither an
4
+ # LEXDRILL_PATH override nor a project-local .drill.txt exists yet.
5
+ module Lexdrill::DefaultWords
6
+ WORDS = [
7
+ "The map is not the territory",
8
+ "Respect for other people's model of the world",
9
+ "Mind and body are parts of the same system",
10
+ "You cannot not communicate",
11
+ "The meaning of your communication is the response you get",
12
+ "People operate out of the best choice available to them",
13
+ "Every behavior has a positive intention",
14
+ "People have all the resources they need to succeed",
15
+ "There is no failure only feedback",
16
+ "If what you are doing isn't working do something else",
17
+ "The person with the most flexibility controls the system",
18
+ "Choice is better than no choice",
19
+ "If one person can do something anyone can learn to do it",
20
+ "Modeling successful performance leads to excellence",
21
+ "All procedures should increase wholeness and choice",
22
+ "Individuals are not their behaviors",
23
+ "Resistance in a listener is a sign of a lack of flexibility in the communicator",
24
+ "We process all information through our five senses",
25
+ "Clean feedback is the breakfast of champions",
26
+ "Possible in the world is possible for me it is only a matter of how"
27
+ ].freeze
28
+
29
+ TEXT = "#{WORDS.join("\n")}\n".freeze
30
+ end
@@ -1,7 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Global display mode for `next`'s output: "full" (position + loop info) or
4
- # "simple" (just the word). Lives at ~/.drill.format; defaults to "full".
3
+ # Global display mode for `next`'s output: "simple" (the drill sign + word)
4
+ # or "full" (position + loop info). Lives at ~/.drill.format; defaults to
5
+ # "simple".
5
6
  module Lexdrill::Format
6
7
  PATH = File.join(Dir.home, ".drill.format")
7
8
  SIMPLE = "simple"
@@ -9,10 +10,10 @@ module Lexdrill::Format
9
10
  VALID = [SIMPLE, FULL].freeze
10
11
 
11
12
  def self.current
12
- return FULL unless File.exist?(PATH)
13
+ return SIMPLE unless File.exist?(PATH)
13
14
 
14
15
  value = File.read(PATH).strip
15
- VALID.include?(value) ? value : FULL
16
+ VALID.include?(value) ? value : SIMPLE
16
17
  end
17
18
 
18
19
  def self.set(mode)
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Formats a shown word for display. In "simple" mode: three drill signs in
4
- # blue, then the word on its own line in a separately-picked random color.
5
- # In "full" mode (the default):
3
+ # Formats a shown word for display. In "simple" mode: the drill sign (in
4
+ # blue), a space, then the word (in a separately-picked random color), all
5
+ # on one line. In "full" mode (the default):
6
6
  # "{counter}/{total}{SEPARATOR}[{loop_start}-{loop_end}]\n{word}" — counter
7
7
  # is the word's own 1-based position in the list, re-derived through
8
8
  # Lexdrill::Beat so it stays meaningful even when a rhythm repeats steps.
9
9
  module Lexdrill::LineFormatter
10
10
  SEPARATOR = "⟳"
11
- SIMPLE_HEADER = SEPARATOR * 3
12
11
 
13
12
  def self.format(word)
14
13
  return simple(word) if Lexdrill::Format.simple?
@@ -17,7 +16,7 @@ module Lexdrill::LineFormatter
17
16
  end
18
17
 
19
18
  def self.simple(word)
20
- "#{Lexdrill::Colorizer.paint_blue(SIMPLE_HEADER)}\n#{Lexdrill::Colorizer.paint(word)}"
19
+ "#{Lexdrill::Colorizer.paint_blue(SEPARATOR)} #{Lexdrill::Colorizer.paint(word)}"
21
20
  end
22
21
 
23
22
  def self.full(word)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Lexdrill
4
- VERSION = "0.4.0"
4
+ VERSION = "0.5.0"
5
5
  end
@@ -1,16 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Reads vocabulary words/phrases from a `.drill.txt` file, one per line, and
4
- # advances a persisted counter to show "the current word" each time.
4
+ # advances a persisted counter to show "the current word" each time. On a
5
+ # fresh install with no project-local or LEXDRILL_PATH-overridden list, seeds
6
+ # ~/.drill.txt with a default starter list instead of coming up empty.
5
7
  class Lexdrill::WordList
6
8
  PATH = Lexdrill::Config::DRILL_PATH
7
9
  COUNTER_PATH = Lexdrill::Config::COUNTER_PATH
10
+ HOME_PATH = Lexdrill::Config.home_drill_path
8
11
 
9
12
  def self.words
10
- @words ||= File.exist?(PATH) && File.readlines(PATH).map(&:strip).reject(&:empty?)
13
+ seed_default_at_home
14
+ @words ||= File.exist?(PATH) && File.readlines(PATH, encoding: "UTF-8").map(&:strip).reject(&:empty?)
11
15
  @words ||= []
12
16
  end
13
17
 
18
+ def self.seed_default_at_home
19
+ return if PATH != HOME_PATH || File.exist?(PATH)
20
+
21
+ File.write(PATH, Lexdrill::DefaultWords::TEXT, encoding: "UTF-8")
22
+ end
23
+ private_class_method :seed_default_at_home
24
+
14
25
  def self.next
15
26
  return nil if words.empty?
16
27
 
data/lib/lexdrill.rb CHANGED
@@ -4,6 +4,7 @@ require_relative "lexdrill/version"
4
4
  require_relative "lexdrill/config"
5
5
  require_relative "lexdrill/counter"
6
6
  require_relative "lexdrill/beat"
7
+ require_relative "lexdrill/default_words"
7
8
  require_relative "lexdrill/word_list"
8
9
  require_relative "lexdrill/toggle"
9
10
  require_relative "lexdrill/shell_snippet"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lexdrill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Siarhei Kisliak
@@ -30,6 +30,7 @@ files:
30
30
  - lib/lexdrill/colorizer.rb
31
31
  - lib/lexdrill/config.rb
32
32
  - lib/lexdrill/counter.rb
33
+ - lib/lexdrill/default_words.rb
33
34
  - lib/lexdrill/format.rb
34
35
  - lib/lexdrill/inspector.rb
35
36
  - lib/lexdrill/line_formatter.rb