kukushka 0.1.1 → 0.1.3
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 +4 -4
- data/Gemfile +4 -3
- data/Gemfile.lock +60 -0
- data/exe/kuku +12 -1
- data/lib/kukushka/version.rb +1 -1
- data/lib/kukushka.rb +122 -4
- metadata +18 -4
- data/kukushka-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19ee15ee498f6251378c39480c444922c0675d192582e17b9695949bd0b0f9ba
|
4
|
+
data.tar.gz: a163b7deab7dce96ed2ae54214e64b80f66bca400c8c92dc04bc8f3d5258bf92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a56fac80db7137a85fceca5520a35242a36cbee6612893ce0f7066343432003aca1736df797aaa8bb7936122465b782b6520b13f639b8712322ea3fe87db079a
|
7
|
+
data.tar.gz: 6c29a9ddf610115b4553678c7a5f8cf1806df55f82aa86ee4edbf3ed81c7864693b65194ccbb1dcb3d1f692a64afe2c826dec58a8cc4605ac97913a7471a3ab0
|
data/Gemfile
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
kukushka (0.1.2)
|
5
|
+
rainbow (~> 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.3)
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
method_source (1.1.0)
|
13
|
+
pry (0.15.0)
|
14
|
+
coderay (~> 1.1)
|
15
|
+
method_source (~> 1.0)
|
16
|
+
racc (1.8.1)
|
17
|
+
rainbow (3.1.1)
|
18
|
+
rake (13.2.1)
|
19
|
+
reek (1.3.7)
|
20
|
+
rainbow
|
21
|
+
ruby2ruby (~> 2.0.8)
|
22
|
+
ruby_parser (~> 3.3)
|
23
|
+
sexp_processor
|
24
|
+
rspec (3.13.0)
|
25
|
+
rspec-core (~> 3.13.0)
|
26
|
+
rspec-expectations (~> 3.13.0)
|
27
|
+
rspec-mocks (~> 3.13.0)
|
28
|
+
rspec-core (3.13.2)
|
29
|
+
rspec-support (~> 3.13.0)
|
30
|
+
rspec-expectations (3.13.3)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.13.0)
|
33
|
+
rspec-mocks (3.13.2)
|
34
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
35
|
+
rspec-support (~> 3.13.0)
|
36
|
+
rspec-support (3.13.2)
|
37
|
+
rubocop (0.7.2)
|
38
|
+
rainbow (>= 1.1.4)
|
39
|
+
ruby2ruby (2.0.8)
|
40
|
+
ruby_parser (~> 3.1)
|
41
|
+
sexp_processor (~> 4.0)
|
42
|
+
ruby_parser (3.21.1)
|
43
|
+
racc (~> 1.5)
|
44
|
+
sexp_processor (~> 4.16)
|
45
|
+
sexp_processor (4.17.3)
|
46
|
+
|
47
|
+
PLATFORMS
|
48
|
+
arm64-darwin-22
|
49
|
+
|
50
|
+
DEPENDENCIES
|
51
|
+
kukushka!
|
52
|
+
pry
|
53
|
+
rainbow (~> 3.0)
|
54
|
+
rake (~> 13.0)
|
55
|
+
reek
|
56
|
+
rspec (~> 3.0)
|
57
|
+
rubocop
|
58
|
+
|
59
|
+
BUNDLED WITH
|
60
|
+
2.3.26
|
data/exe/kuku
CHANGED
data/lib/kukushka/version.rb
CHANGED
data/lib/kukushka.rb
CHANGED
@@ -1,11 +1,129 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
3
2
|
require_relative "kukushka/version"
|
3
|
+
require 'fileutils'
|
4
|
+
require 'rainbow'
|
5
|
+
require 'yaml'
|
4
6
|
|
5
7
|
module Kukushka
|
6
|
-
|
8
|
+
INIT_CTA = "TODO: kuku init source_file"
|
9
|
+
PROVIDE_SOURCE_CTA = "TODO: provide valid source_file path"
|
10
|
+
|
11
|
+
def self.kuku(args)
|
12
|
+
Kukushka.kuku(args)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.on?
|
16
|
+
Config.new.on?
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.on!
|
20
|
+
Config.new.enable
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
class Config
|
25
|
+
CONFIG_FILE = File.dirname(__FILE__) + '/../tmp/config/kuku.yaml'
|
26
|
+
CONFIG_DIR = File.dirname(CONFIG_FILE)
|
27
|
+
|
28
|
+
def on?
|
29
|
+
exists? && config[:enabled]
|
30
|
+
end
|
31
|
+
|
32
|
+
def exists?
|
33
|
+
File.exists?(CONFIG_DIR)
|
34
|
+
end
|
35
|
+
|
36
|
+
def init
|
37
|
+
source_file = param1
|
38
|
+
return INIT_CTA if source_file.nil?
|
39
|
+
return PROVIDE_SOURCE_CTA unless File.exist?(source_file)
|
40
|
+
|
41
|
+
dir = File.dirname(CONFIG_FILE)
|
42
|
+
FileUtils.mkdir_p(dir) unless File.exists?(dir)
|
43
|
+
config = {
|
44
|
+
source: source_file,
|
45
|
+
enabled: true
|
46
|
+
}
|
47
|
+
File.open(CONFIG_FILE, 'w') {|f| f.write config.to_yaml }
|
48
|
+
end
|
49
|
+
|
50
|
+
def enable
|
51
|
+
config.merge!(enabled: true)
|
52
|
+
File.open(CONFIG_FILE, 'w') {|f| f.write config.to_yaml }
|
53
|
+
'enabled'
|
54
|
+
end
|
55
|
+
|
56
|
+
def disable
|
57
|
+
config.merge!(enabled: false)
|
58
|
+
File.open(CONFIG_FILE, 'w') {|f| f.write config.to_yaml }
|
59
|
+
'disabled'
|
60
|
+
end
|
61
|
+
|
62
|
+
def cleanup
|
63
|
+
FileUtils.rm_rf(CONFIG_DIR) if config_exists?
|
64
|
+
end
|
65
|
+
|
66
|
+
def source
|
67
|
+
@source ||= YAML::load_file(CONFIG_FILE)[:source]
|
68
|
+
end
|
69
|
+
|
70
|
+
private
|
71
|
+
def config
|
72
|
+
@config ||= YAML::load_file(CONFIG_FILE)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
class Kukushka
|
77
|
+
def self.kuku(args)
|
78
|
+
new(args).kuku
|
79
|
+
end
|
80
|
+
|
81
|
+
def initialize(args)
|
82
|
+
@command = args[0]
|
83
|
+
@param1 = args[1]
|
84
|
+
@config = Config.new
|
85
|
+
end
|
86
|
+
|
87
|
+
attr_reader :command, :param1, :config
|
88
|
+
|
89
|
+
def kuku
|
90
|
+
config.init if command == 'init'
|
91
|
+
|
92
|
+
return INIT_CTA unless config.exists?
|
93
|
+
|
94
|
+
return config.enable if command == 'on'
|
95
|
+
return config.disable if command == 'off'
|
96
|
+
|
97
|
+
return config.cleanup if command == 'cleanup'
|
98
|
+
# return show if command == 'show'
|
99
|
+
return sample if command == 'sample'
|
100
|
+
return punchline if command.nil?
|
101
|
+
end
|
102
|
+
|
103
|
+
private
|
104
|
+
|
105
|
+
# if ARGV[0] == 'config'
|
106
|
+
# # source
|
107
|
+
# # range_number
|
108
|
+
# # range_size
|
109
|
+
# # annoying_factor
|
110
|
+
# # with feedback_loop
|
111
|
+
# # statistics
|
112
|
+
# end
|
113
|
+
#
|
114
|
+
# if ARGV[0] == 'statistics'
|
115
|
+
# end
|
116
|
+
|
117
|
+
def sample
|
118
|
+
@sample ||= File.readlines(config.source, chomp: true).sample
|
119
|
+
end
|
120
|
+
|
121
|
+
def punchline
|
122
|
+
@punchline ||= Rainbow(sample).color(color).bright
|
123
|
+
end
|
7
124
|
|
8
|
-
|
9
|
-
|
125
|
+
def color
|
126
|
+
@color ||= Rainbow::X11ColorNames::NAMES.keys.sample
|
127
|
+
end
|
10
128
|
end
|
11
129
|
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kukushka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serge Kislak
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-12-
|
12
|
-
dependencies:
|
11
|
+
date: 2024-12-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rainbow
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
13
27
|
description: Learning tool for interval repetition
|
14
28
|
email:
|
15
29
|
- kislak7@gmail.com
|
@@ -21,11 +35,11 @@ files:
|
|
21
35
|
- ".rspec"
|
22
36
|
- ".rubocop.yml"
|
23
37
|
- Gemfile
|
38
|
+
- Gemfile.lock
|
24
39
|
- LICENSE.txt
|
25
40
|
- README.md
|
26
41
|
- Rakefile
|
27
42
|
- exe/kuku
|
28
|
-
- kukushka-0.1.0.gem
|
29
43
|
- lib/kukushka.rb
|
30
44
|
- lib/kukushka/version.rb
|
31
45
|
- sig/kukushka.rbs
|
data/kukushka-0.1.0.gem
DELETED
Binary file
|