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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a33af44c127bf2f8746b81aedac2eae7380cedd257309145912e1d5aed8176ff
4
- data.tar.gz: a888edfe9e6c5cd5da4c1e61dafb280531fe68e93cc13a203e873e06a1d456f5
3
+ metadata.gz: 83e453e21aa4dff4ea4eff7005a4b39361309ff2598f6a0fb51089d2493d6371
4
+ data.tar.gz: 73d869ad35ffc2c51f7f3f397c593c7f0c7f1c2e9ed923828de28eef931d2bda
5
5
  SHA512:
6
- metadata.gz: 49829a90da112980d66cee812bbd89b9ece8c23a05b1cf5eaa23c8aecbabf22cc291d3827b7cbd9e01d3a238f7e756cd56764cbc3aedfea2290d632aa5dd51de
7
- data.tar.gz: 9569328afec7cef9b86a8a2525bbbd05d39660b7798cb0adf64380c505a244a346bc45d4ab7f842b594fa9dbf735ffb08ddaa7dda471819076fe2c25d5375ad7
6
+ metadata.gz: f1e0bfd62594680c986726e42b5dd732bcce8082df572c62118ffee062d9c6542347fdb1fcbbbe7ee6224f0035800527f871a908be0eb8028b1624175ddfe02b
7
+ data.tar.gz: c1553d90cd57ee0e3d285e70403f03c34bf1faae8aa8bde9a69362a008b4b5e8c9424aae27ffdce5f6c37de438936292812a631a5975129693ff6869e9b47e11
@@ -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
- cue_options = sheldon.list_cues.select{|cue| sheldon.recalled?(cue)}
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
- error_and_exit("#{recall_cue} has not been recalled on this computer. Use `sheldon recall #{recall_cue}` and then try again.") unless sheldon.recalled?(recall_cue)
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 all.") if cue_options.empty?
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|
@@ -9,7 +9,7 @@ class Brain
9
9
 
10
10
  def forget(recall_cue)
11
11
  entry = memory.recall(recall_cue)
12
- brain_path = brain_path_for_cue(recall_cue)
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 = brain_path_for_cue(recall_cue)
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 = brain_path_for_cue(recall_cue)
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 brain_path_for_cue(recall_cue)
76
+ def brain_directory_for_cue(recall_cue)
71
77
  File.join(@location, recall_cue)
72
78
  end
73
79
 
@@ -1,7 +1,7 @@
1
1
  require "fileutils"
2
2
 
3
3
  class Sheldon
4
- VERSION = "6.0.9".freeze
4
+ VERSION = "6.1.0".freeze
5
5
  attr_reader :brain, :builder
6
6
 
7
7
  def initialize(sheldon_data_dir)
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.9
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-08-11 00:00:00.000000000 Z
11
+ date: 2018-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor