notehub 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/notehub +5 -1
- data/lib/notehub/notehub.rb +15 -1
- data/lib/notehub/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0f483d823797fcc38ec14f1fa05dff6e2eedfe9
|
4
|
+
data.tar.gz: 301d8cd4b3e32f79759cc4a0f38469810ed8502c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45982cbfad3c461a0f3590d42e1bb2dca35e5db61818f0527afd705706918e8536819f5657451650a7f281221e739106856c9c1fc0fbd6feb13229053a67a920
|
7
|
+
data.tar.gz: f48973551e5f0163db9249446721164c500e78e8037290f583fff59f588d5463e3af16ab5fc11e58eab9b944dc9ba831b014314e387dc3cfc08ceaecad56482f
|
data/bin/notehub
CHANGED
@@ -105,6 +105,7 @@ command :file do |c|
|
|
105
105
|
id = nil
|
106
106
|
input = nil
|
107
107
|
pass = nil
|
108
|
+
short = nil
|
108
109
|
notes = nh.notes['notes']
|
109
110
|
notes.each {|k,note|
|
110
111
|
if note.has_key?('file')
|
@@ -112,6 +113,7 @@ command :file do |c|
|
|
112
113
|
note['file'] = File.expand_path(args[0])
|
113
114
|
nh.store_note(note)
|
114
115
|
id = note['id']
|
116
|
+
short = note['short']
|
115
117
|
pass = note['pass']
|
116
118
|
input = "use_previous"
|
117
119
|
break
|
@@ -120,8 +122,10 @@ command :file do |c|
|
|
120
122
|
}
|
121
123
|
if id
|
122
124
|
res = nh.update_note(id, input, pass)
|
125
|
+
nh.tag_file(id,short)
|
123
126
|
if res
|
124
127
|
puts "Note updated"
|
128
|
+
|
125
129
|
else
|
126
130
|
puts "Error updating note"
|
127
131
|
end
|
@@ -137,6 +141,7 @@ command :file do |c|
|
|
137
141
|
res = nh.new_note(input, nh.default_password, additional_options)
|
138
142
|
if res
|
139
143
|
puts "Note created"
|
144
|
+
nh.tag_file(res['id'],res['short'])
|
140
145
|
else
|
141
146
|
puts "Error creating note"
|
142
147
|
end
|
@@ -150,7 +155,6 @@ end
|
|
150
155
|
desc 'Update a note'
|
151
156
|
arg_name 'search_term'
|
152
157
|
command :update do |c|
|
153
|
-
# TODO: Check note db for password if choosing from list
|
154
158
|
c.desc 'ID for note (default: choose from list)'
|
155
159
|
c.default_value false
|
156
160
|
c.flag [:id]
|
data/lib/notehub/notehub.rb
CHANGED
@@ -255,7 +255,7 @@ class NotehubAPI
|
|
255
255
|
end
|
256
256
|
|
257
257
|
def choose_note(term=".*")
|
258
|
-
|
258
|
+
|
259
259
|
puts "Choose a note:"
|
260
260
|
|
261
261
|
list = find_notes(term)
|
@@ -267,6 +267,20 @@ class NotehubAPI
|
|
267
267
|
|
268
268
|
list[num.to_i - 1]
|
269
269
|
end
|
270
|
+
|
271
|
+
def tag_file(id,short)
|
272
|
+
if @notes['notes'].has_key?([id])
|
273
|
+
note = @notes['notes'][id]
|
274
|
+
file = note.has_key?('file') ? note['file'] : false
|
275
|
+
return false unless file
|
276
|
+
content = IO.read(File.expand_path(file))
|
277
|
+
output = "\n\n<!-- <#{short}> #{id} -->\n"
|
278
|
+
File.open(File.expand_path(file),'w+') do |f|
|
279
|
+
f.puts content
|
280
|
+
f.puts output
|
281
|
+
end
|
282
|
+
end
|
283
|
+
end
|
270
284
|
end
|
271
285
|
|
272
286
|
# nh = NotehubAPI.new
|
data/lib/notehub/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notehub
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Your Name Here
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - '='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.
|
75
|
+
version: 1.8.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.
|
82
|
+
version: 1.8.1
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: highline
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|