sheldon 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/sheldon +9 -23
  3. data/lib/sheldon/sheldon.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ee0b52887749915716704a2fb573bc331cdc0db
4
- data.tar.gz: fbc15b025c4a3fd9168ab2f6792306e4fa149312
3
+ metadata.gz: e3849dcc28716d5aafca1ee0dafda7347d12ae85
4
+ data.tar.gz: e6a90dc5d6027d5f4e7114aecae52d5b14db2995
5
5
  SHA512:
6
- metadata.gz: b05a5a1b7bee03e34ee6d361e934f9c96cfddde840d6ba7482554862c0b349b0addfc5fcb9bbd3a4aed28e21563d407a3541c4daf7f04057d8992c0f6a6d0e58
7
- data.tar.gz: 9bbee9aa6a3f825f7280dd38df53ca342af1eb4df7c8367cd21f6beb8f97b5bdd6a199e83f2d54dfa959e083443ba9a8609c8a63f072c147c3b90619add4e643
6
+ metadata.gz: fc98eca6fdbb01a0c384aa029620c0286764f36f3d3599ac3dcd9751b07b81eb9548ec108e3421adda50da998949af08942d15adb3ccd91d93a774a9f8d52577
7
+ data.tar.gz: 58a7b7b0dddead7f6363b513198026bc7501d4f980c1d71ad38d5ac0d333aa9ccefbd8c78d55cad428239cb8efeaf07575b94c7aa25c5cbc166ce122ae9e06c4
@@ -25,7 +25,7 @@ module CLI
25
25
 
26
26
  desc "forget recall_cue", "Remove file/folder from Sheldon's brain"
27
27
  def forget(recall_cue=nil)
28
- recall_cue ||= prompt_user("Recall Cue For File/Folder")
28
+ recall_cue ||= ask("Recall Cue For File/Folder")
29
29
  with_exception_handling { sheldon.forget(recall_cue) }
30
30
  announce("I've forgotten about #{recall_cue}. Let us never mention it again.")
31
31
  end
@@ -34,7 +34,7 @@ module CLI
34
34
  def learn(rel_path_to_target)
35
35
  abs_learn_path = File.expand_path(rel_path_to_target)
36
36
  default_cue = File.basename(rel_path_to_target)
37
- recall_cue = prompt_user("Recall Cue For File/Folder (#{default_cue})") || default_cue
37
+ recall_cue = ask("Recall Cue For File/Folder", default: default_cue)
38
38
  with_exception_handling { sheldon.learn(recall_cue, abs_learn_path) }
39
39
  with_exception_handling { sheldon.recall(recall_cue) }
40
40
  end
@@ -42,7 +42,7 @@ module CLI
42
42
  desc "list", "List all recall cues known by Sheldon"
43
43
  def list
44
44
  sheldon.list_cues.each do |recall_cue|
45
- sheldon.recalled?(recall_cue) ? green(recall_cue) : red(recall_cue)
45
+ sheldon.recalled?(recall_cue) ? say(recall_cue, :green) : say(recall_cue, :red)
46
46
  end
47
47
  end
48
48
 
@@ -52,11 +52,11 @@ module CLI
52
52
  def recall(recall_cue=nil)
53
53
  if options[:i]
54
54
  sheldon.list_cues.each do |recall_cue|
55
- answer = prompt_user("Recall #{recall_cue}? (Y/N)")
55
+ answer = ask("Recall #{recall_cue}? (Y/N)")
56
56
  with_exception_handling { sheldon.recall(recall_cue) if answer.downcase == "y" }
57
57
  end
58
58
  else
59
- recall_cue ||= prompt_user("Recall Cue For File/Folder")
59
+ recall_cue ||= ask("Recall Cue For File/Folder")
60
60
  with_exception_handling { sheldon.recall(recall_cue) }
61
61
  end
62
62
 
@@ -65,16 +65,16 @@ module CLI
65
65
 
66
66
  desc "setup path_to_data_directory", "Setup Sheldon on this host, supplying the path that where Sheldon's data directory can be found, or should be created."
67
67
  def setup(rel_data_path=nil)
68
- rel_data_path ||= prompt_user("Please supply location for new/existing data directory")
68
+ rel_data_path ||= ask("Please supply location for new/existing data directory")
69
69
  abs_data_path = File.expand_path(rel_data_path)
70
70
  with_exception_handling do
71
71
  sheldon = ::Sheldon.new(abs_data_path)
72
72
 
73
73
  if sheldon.brain.present?
74
- green "Using existing Sheldon database found at #{abs_data_path}."
74
+ say("Using existing Sheldon database found at #{abs_data_path}.", :green)
75
75
  else
76
76
  sheldon.setup!
77
- green "New Sheldon database created at #{abs_data_path}"
77
+ say("New Sheldon database created at #{abs_data_path}", :green)
78
78
  end
79
79
 
80
80
  write_to_dotfile("data_directory", sheldon.brain.location)
@@ -93,25 +93,11 @@ module CLI
93
93
  puts logo + " Sheldon" + logo + " #{message}"
94
94
  end
95
95
 
96
- def green(message)
97
- puts "\e[32m#{message}\e[0m"
98
- end
99
-
100
- def prompt_user(prompt)
101
- print(prompt + ": ")
102
- input = STDIN.gets.chomp.strip
103
- input.empty? ? nil : input
104
- end
105
-
106
96
  def read_from_dotfile(key)
107
97
  dotfile = YAML::Store.new(add_home(".sheldon"))
108
98
  dotfile.transaction { dotfile[key] }
109
99
  end
110
100
 
111
- def red(message)
112
- puts "\e[31m#{message}\e[0m"
113
- end
114
-
115
101
  def sheldon
116
102
  with_exception_handling { @sheldon ||= ::Sheldon.new(sheldon_data_dir) }
117
103
  end
@@ -127,7 +113,7 @@ module CLI
127
113
  if options[:debug]
128
114
  puts ([e.inspect] + e.backtrace).join("\n")
129
115
  else
130
- red(e.message + "\nUse --debug to print backtrace")
116
+ say(e.message + "\nUse --debug to print backtrace", :red)
131
117
  end
132
118
  exit!
133
119
  end
@@ -1,7 +1,7 @@
1
1
  require "fileutils"
2
2
 
3
3
  class Sheldon
4
- VERSION = "0.5.4".freeze
4
+ VERSION = "0.5.5".freeze
5
5
  attr_reader :brain, :builder
6
6
 
7
7
  def initialize(sheldon_data_dir)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sheldon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Jones