sheldon 6.0.9 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/sheldon +3 -6
- data/lib/sheldon/brain.rb +10 -4
- data/lib/sheldon/sheldon.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 83e453e21aa4dff4ea4eff7005a4b39361309ff2598f6a0fb51089d2493d6371
|
4
|
+
data.tar.gz: 73d869ad35ffc2c51f7f3f397c593c7f0c7f1c2e9ed923828de28eef931d2bda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e0bfd62594680c986726e42b5dd732bcce8082df572c62118ffee062d9c6542347fdb1fcbbbe7ee6224f0035800527f871a908be0eb8028b1624175ddfe02b
|
7
|
+
data.tar.gz: c1553d90cd57ee0e3d285e70403f03c34bf1faae8aa8bde9a69362a008b4b5e8c9424aae27ffdce5f6c37de438936292812a631a5975129693ff6869e9b47e11
|
data/bin/sheldon
CHANGED
@@ -49,13 +49,10 @@ module CLI
|
|
49
49
|
def open(recall_cue=nil)
|
50
50
|
editor = ENV['EDITOR']
|
51
51
|
error_and_exit("Your system does not define a default editor. Please set $EDITOR and try again.") if editor.nil?
|
52
|
-
|
53
|
-
recall_cue ||= cue_picker("What would you like to open?", cue_options)
|
52
|
+
recall_cue ||= cue_picker("What would you like to open?", sheldon.list_cues)
|
54
53
|
|
55
54
|
with_exception_handling do
|
56
|
-
|
57
|
-
memory_entry = sheldon.brain.memory.recall(recall_cue)
|
58
|
-
filepath = add_home(memory_entry[:filepath])
|
55
|
+
filepath = sheldon.brain.path_for_cue(recall_cue)
|
59
56
|
system("#{editor} '#{filepath}'")
|
60
57
|
end
|
61
58
|
end
|
@@ -65,7 +62,7 @@ module CLI
|
|
65
62
|
|
66
63
|
def recall(recall_cue=nil)
|
67
64
|
cue_options = sheldon.list_cues.reject{ |cue| sheldon.recalled?(cue) }
|
68
|
-
error_and_exit("All of your files and folders have already been recalled. Use `sheldon list` to view them
|
65
|
+
error_and_exit("All of your files and folders have already been recalled. Use `sheldon list` to view them.") if cue_options.empty?
|
69
66
|
|
70
67
|
if options[:i]
|
71
68
|
cue_options.each do |recall_cue|
|
data/lib/sheldon/brain.rb
CHANGED
@@ -9,7 +9,7 @@ class Brain
|
|
9
9
|
|
10
10
|
def forget(recall_cue)
|
11
11
|
entry = memory.recall(recall_cue)
|
12
|
-
brain_path =
|
12
|
+
brain_path = brain_directory_for_cue(recall_cue)
|
13
13
|
destination_path = add_home(entry[:filepath])
|
14
14
|
FileUtils.rm_r(destination_path) if File.symlink?(destination_path)
|
15
15
|
FileUtils.rm_r(brain_path) if Dir.exist?(brain_path)
|
@@ -26,7 +26,7 @@ class Brain
|
|
26
26
|
raise "This cue has already been used." if has_cue?(recall_cue)
|
27
27
|
raise "Unable to find a file or folder at #{abs_learn_path}" unless File.exist?(abs_learn_path)
|
28
28
|
|
29
|
-
brain_path =
|
29
|
+
brain_path = brain_directory_for_cue(recall_cue)
|
30
30
|
FileUtils.mkdir_p(brain_path)
|
31
31
|
FileUtils.mv(abs_learn_path, brain_path)
|
32
32
|
entry = { filepath: remove_home(abs_learn_path) }
|
@@ -37,6 +37,12 @@ class Brain
|
|
37
37
|
memory.list_cues
|
38
38
|
end
|
39
39
|
|
40
|
+
def path_for_cue(recall_cue)
|
41
|
+
raise "no entry for cue '#{recall_cue}'" unless memory.has_cue?(recall_cue)
|
42
|
+
brain_directory = brain_directory_for_cue(recall_cue)
|
43
|
+
get_content(brain_directory)
|
44
|
+
end
|
45
|
+
|
40
46
|
def present?
|
41
47
|
memory.present?
|
42
48
|
end
|
@@ -48,7 +54,7 @@ class Brain
|
|
48
54
|
raise DestinationNotEmptyException, "#{destination_path} already exists." if File.exist?(destination_path)
|
49
55
|
|
50
56
|
FileUtils.mkdir_p(destination_dir) unless File.directory?(destination_dir)
|
51
|
-
brain_path =
|
57
|
+
brain_path = brain_directory_for_cue(recall_cue)
|
52
58
|
FileUtils.ln_s(get_content(brain_path), destination_path)
|
53
59
|
return true
|
54
60
|
end
|
@@ -67,7 +73,7 @@ class Brain
|
|
67
73
|
|
68
74
|
private
|
69
75
|
|
70
|
-
def
|
76
|
+
def brain_directory_for_cue(recall_cue)
|
71
77
|
File.join(@location, recall_cue)
|
72
78
|
end
|
73
79
|
|
data/lib/sheldon/sheldon.rb
CHANGED
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: 6.0
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Jones
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|