fuzzy_notes 0.0.7 → 0.0.9
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.
- data/README +34 -17
- data/TODO +1 -4
- data/lib/fuzzy_notes/cipher.rb +18 -2
- data/lib/fuzzy_notes/notes.rb +1 -5
- metadata +4 -4
data/README
CHANGED
@@ -1,36 +1,53 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
ABOUT
|
2
|
+
-------------------------------------------------------------------------
|
3
3
|
fuzzy_notes is a command line note manager with some cool features:
|
4
4
|
|
5
|
-
1. Emacs/Vim/
|
5
|
+
1. Supports Emacs/Vim/MacVim and other CLI text editors
|
6
6
|
2. Fuzzy path search and full text search across one or more note directories
|
7
7
|
3. OpenSSL encryption
|
8
|
-
4. Evernote
|
8
|
+
4. Evernote synchronization
|
9
9
|
|
10
10
|
|
11
11
|
CONFIG
|
12
|
+
-------------------------------------------------------------------------
|
13
|
+
|
14
|
+
fuzzy_notes looks for a ~/.fuzzy_notes config file or the -c option and
|
15
|
+
overwrites the defaults with the contents of the YAML file specified.
|
12
16
|
|
13
17
|
A config file is not required if you're ok with fuzzy_note's defaults settings
|
14
18
|
outlined below:
|
15
19
|
|
16
|
-
:
|
17
|
-
- ~/notes
|
20
|
+
:editor: vim
|
18
21
|
:verbose: false
|
19
22
|
:full_text_search: false
|
23
|
+
:note_paths:
|
24
|
+
- [HOMEDIR]/notes
|
20
25
|
|
21
|
-
|
22
|
-
|
26
|
+
An Evernote config section is required to use the sync tool
|
27
|
+
|
28
|
+
:evernote:
|
29
|
+
:note_path: [local directory used to sync evernotes]
|
30
|
+
:username: [evernote username]
|
31
|
+
:consumer_key: [consumer key acquired through Evernote dev channel]
|
32
|
+
:consumer_secret: [consumer secret acquired through Evernote dev channel]
|
33
|
+
|
34
|
+
Get yourself a "client application" API key from Evernote
|
35
|
+
(http://www.evernote.com/about/developer/api/#key), note that a "web
|
36
|
+
application" API key uses OAuth to authenticate and will not work.
|
23
37
|
|
24
38
|
|
25
39
|
USAGE
|
40
|
+
-------------------------------------------------------------------------
|
26
41
|
|
27
42
|
fnote [options] [keyword1, keyword2...]
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
43
|
+
-c, --config [CONFIG] Specify config file
|
44
|
+
-p, --print Dump matching notes to stdout
|
45
|
+
-l, --list List matching notes
|
46
|
+
-i, --info Show statistics for matching notes
|
47
|
+
-s, --search Perform a full text search when matching notes
|
48
|
+
-v, --verbose Enable debug output
|
49
|
+
-e, --encrypt Encrypt matching notes
|
50
|
+
-d, --decrypt Decrypt matching notes
|
51
|
+
-n, --no-color Turn off ANSI color
|
52
|
+
-u, --evernote-update Synchronize evernote directory
|
53
|
+
-h, --help Show this message
|
data/TODO
CHANGED
data/lib/fuzzy_notes/cipher.rb
CHANGED
@@ -23,7 +23,14 @@ private
|
|
23
23
|
cipher = Gibberish::AES.new(get_password)
|
24
24
|
case file_paths
|
25
25
|
when Array
|
26
|
-
file_paths.each
|
26
|
+
file_paths.each do |path|
|
27
|
+
if encrypt? && self.class.encrypted?(path) ||
|
28
|
+
decrypt? && !self.class.encrypted?(path)
|
29
|
+
log.warn "#{Colors::PATH} #{path} #{Colors::DEFAULT} is #{encrypt? ? 'already' : 'not'} encrypted, skipping"
|
30
|
+
next
|
31
|
+
end
|
32
|
+
process_file(path, cipher, opts)
|
33
|
+
end
|
27
34
|
when String
|
28
35
|
process_file(file_paths, cipher, opts)
|
29
36
|
end
|
@@ -32,7 +39,7 @@ private
|
|
32
39
|
def process_file(path, cipher, opts)
|
33
40
|
begin
|
34
41
|
log.debug "#{@action} '#{path}'"
|
35
|
-
content
|
42
|
+
content = cipher.send(@action, File.read(path))
|
36
43
|
replace_file!(path, content) if opts[:replace]
|
37
44
|
content
|
38
45
|
rescue OpenSSL::Cipher::CipherError => e
|
@@ -55,8 +62,17 @@ private
|
|
55
62
|
decrypt? ? PLAINTEXT_EXT : CIPHERTEXT_EXT
|
56
63
|
end
|
57
64
|
|
65
|
+
def encrypt?
|
66
|
+
@action == :enc
|
67
|
+
end
|
68
|
+
|
58
69
|
def decrypt?
|
59
70
|
@action == :dec
|
60
71
|
end
|
61
72
|
|
73
|
+
def self.encrypted?(path)
|
74
|
+
File.extname(path)[1..-1] == CIPHERTEXT_EXT
|
75
|
+
end
|
76
|
+
|
77
|
+
|
62
78
|
end
|
data/lib/fuzzy_notes/notes.rb
CHANGED
@@ -53,7 +53,7 @@ end
|
|
53
53
|
def cat
|
54
54
|
matching_notes.each do |note_path|
|
55
55
|
contents = \
|
56
|
-
if encrypted?(note_path)
|
56
|
+
if FuzzyNotes::Cipher.encrypted?(note_path)
|
57
57
|
log.info "decrypting note #{Colors::PATH} #{note_path}"
|
58
58
|
FuzzyNotes::Cipher.new.decrypt(note_path)
|
59
59
|
elsif evernote?(note_path)
|
@@ -133,10 +133,6 @@ private
|
|
133
133
|
instance_variables.inject("") { |s, ivar| s << " #{ivar} => #{eval(ivar).inspect}\n" }
|
134
134
|
end
|
135
135
|
|
136
|
-
def encrypted?(path)
|
137
|
-
File.extname(path)[1..-1] == FuzzyNotes::Cipher::CIPHERTEXT_EXT
|
138
|
-
end
|
139
|
-
|
140
136
|
def evernote?(path)
|
141
137
|
File.extname(path)[1..-1] == FuzzyNotes::EvernoteSync::NOTE_EXT
|
142
138
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fuzzy_notes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 13
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 9
|
10
|
+
version: 0.0.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Alex Skryl
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-07-
|
18
|
+
date: 2011-07-27 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|