sheldon 0.4.0 → 0.4.1
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/lib/sheldon/brain.rb +5 -1
- data/lib/sheldon/memory.rb +1 -1
- data/lib/sheldon/sheldon.rb +2 -10
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73892f48dbd187ec12c86c61e4e4a7db3ba3fd28
|
4
|
+
data.tar.gz: 9b7c3048b7cd07c67fdcfc4d705ed559f0e30df3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e90b362ed860b5de2a01629144c827628af88d70817864d6fe8b47106e6acd640547c627e3279ab79ba0e1862b080b5571ef8cabc3c33c405018f10716c3d89
|
7
|
+
data.tar.gz: 7c94643012c59f402686f4d2c2bddf0ae81361d2dafa916a3f0f7cdaf4814c9a22f25edf1d94c04f3b55082fee582d75ec5ea4ac9dc2e904cafb63aca99bf6bc
|
data/lib/sheldon/brain.rb
CHANGED
@@ -9,6 +9,10 @@ class Brain
|
|
9
9
|
|
10
10
|
|
11
11
|
def learn(recall_cue, abs_learn_path)
|
12
|
+
raise "recall cue cannot be empty." if recall_cue.strip.empty?
|
13
|
+
raise "This cue has already been used." if has_cue?(recall_cue)
|
14
|
+
raise "Unable to find a file or folder at #{abs_learn_path}" unless File.exists?(abs_learn_path)
|
15
|
+
|
12
16
|
brain_path = brain_path_for_cue(recall_cue)
|
13
17
|
FileUtils.mkdir_p(brain_path)
|
14
18
|
FileUtils.mv(abs_learn_path, brain_path)
|
@@ -29,8 +33,8 @@ class Brain
|
|
29
33
|
entry = memory.recall(recall_cue)
|
30
34
|
brain_path = brain_path_for_cue(recall_cue)
|
31
35
|
destination_path = add_home(entry[:filepath])
|
36
|
+
FileUtils.rm_r(destination_path) if recalled?(recall_cue)
|
32
37
|
FileUtils.rm_r(brain_path)
|
33
|
-
FileUtils.rm_r(destination_path)
|
34
38
|
|
35
39
|
memory.forget(recall_cue)
|
36
40
|
end
|
data/lib/sheldon/memory.rb
CHANGED
data/lib/sheldon/sheldon.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
|
3
3
|
class Sheldon
|
4
|
-
VERSION = "0.4.
|
4
|
+
VERSION = "0.4.1".freeze
|
5
5
|
attr_reader :brain, :builder
|
6
6
|
|
7
7
|
def initialize(sheldon_data_dir, opts = {})
|
@@ -18,21 +18,14 @@ class Sheldon
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def learn(recall_cue, abs_learn_path)
|
21
|
-
|
22
|
-
if brain.has_cue?(recall_cue)
|
23
|
-
raise "This cue has already been used."
|
24
|
-
else
|
25
|
-
brain.learn(recall_cue, abs_learn_path)
|
26
|
-
end
|
21
|
+
brain.learn(recall_cue, abs_learn_path)
|
27
22
|
end
|
28
23
|
|
29
24
|
def recall(recall_cue)
|
30
|
-
raise "Cue '#{recall_cue}' could not be found." unless brain.has_cue?(recall_cue)
|
31
25
|
brain.recall(recall_cue)
|
32
26
|
end
|
33
27
|
|
34
28
|
def forget(recall_cue)
|
35
|
-
raise "Cue '#{recall_cue}' could not be found." unless brain.has_cue?(recall_cue)
|
36
29
|
brain.forget(recall_cue)
|
37
30
|
end
|
38
31
|
|
@@ -41,7 +34,6 @@ class Sheldon
|
|
41
34
|
end
|
42
35
|
|
43
36
|
def recalled?(recall_cue)
|
44
|
-
raise "Cue '#{recall_cue}' could not be found." unless brain.has_cue?(recall_cue)
|
45
37
|
brain.recalled?(recall_cue)
|
46
38
|
end
|
47
39
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sheldon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|