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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88cb9db2a8a8e0a2529f64d4c12a350ef2903447
4
- data.tar.gz: 57864a0dc3aa58a04e8ee3e01652734716293e9d
3
+ metadata.gz: 73892f48dbd187ec12c86c61e4e4a7db3ba3fd28
4
+ data.tar.gz: 9b7c3048b7cd07c67fdcfc4d705ed559f0e30df3
5
5
  SHA512:
6
- metadata.gz: f5de4d60afd7ef3b1a8ba270f6f0f141d97ed9d12c3626802f584fd7f24a5f89043ce571bbe521b7473a37ec08dc04469c67284d2c0703287edbca2b23961af7
7
- data.tar.gz: 04ee09898119ee61ab41425767e15f50dba39622844e13c4cec3bec00bfcfcc6736f54ea60b510283cfc7e53d64a75472b5e6bcdbda79b53f7bce6045b1c69b2
6
+ metadata.gz: 6e90b362ed860b5de2a01629144c827628af88d70817864d6fe8b47106e6acd640547c627e3279ab79ba0e1862b080b5571ef8cabc3c33c405018f10716c3d89
7
+ data.tar.gz: 7c94643012c59f402686f4d2c2bddf0ae81361d2dafa916a3f0f7cdaf4814c9a22f25edf1d94c04f3b55082fee582d75ec5ea4ac9dc2e904cafb63aca99bf6bc
@@ -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
@@ -15,7 +15,7 @@ class Memory
15
15
  end
16
16
 
17
17
  def recall(recall_cue)
18
- raise "no entry for cue" unless has_cue?(recall_cue)
18
+ raise "no entry for cue '#{recall_cue}'" unless has_cue?(recall_cue)
19
19
  @database.transaction { @database[recall_cue] }
20
20
  end
21
21
 
@@ -1,7 +1,7 @@
1
1
  require "fileutils"
2
2
 
3
3
  class Sheldon
4
- VERSION = "0.4.0".freeze
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
- raise "recall cue cannot be empty." if recall_cue.strip.empty?
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.0
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-05-27 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor