notenote 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/note/cli.rb +14 -2
- data/lib/note/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e739b649898fe2b3cd03fef0dc45bd728ffbce50c3ee5cb6f7d1918bf59612f
|
4
|
+
data.tar.gz: e23ae24148d1ef7666fd26430f3f5413b228d4a9c8563ec039c6878ef542326d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a129c33ebc60c59500cac01472a99f71889579797adddc746c6b1177c9b4bbc60c1a38736b9c235d9b38df35d5091b43e84ec8da2ec98b556010b3e5b4f54924
|
7
|
+
data.tar.gz: aed23da98e1307fd318300a518b5c70381bb294f25b9488c850fa57ed65d235019f7793e7c7adfea97a3515ae8404fd0a694d7238c6cd0e5d76cbb1fae4305c8
|
data/lib/note/cli.rb
CHANGED
@@ -99,9 +99,9 @@ module Note
|
|
99
99
|
def create_config_file(notes_folder:)
|
100
100
|
config_template = File.read(File.join(File.dirname(__FILE__), "config.json.template"))
|
101
101
|
|
102
|
-
config = config_template
|
102
|
+
config = safe_tt(config_template, {
|
103
103
|
notes_folder: notes_folder
|
104
|
-
}
|
104
|
+
})
|
105
105
|
|
106
106
|
config_file = File.join(Dir.home, ".notenote")
|
107
107
|
|
@@ -197,5 +197,17 @@ module Note
|
|
197
197
|
|
198
198
|
puts "Pushed. ✅"
|
199
199
|
end
|
200
|
+
|
201
|
+
# A custom string format method to avoid type
|
202
|
+
# errors when using str % hash.
|
203
|
+
def safe_tt(str, hash)
|
204
|
+
str_copy = str
|
205
|
+
|
206
|
+
hash.each do |key, value|
|
207
|
+
str_copy.gsub!("%{#{key}}", value.to_s)
|
208
|
+
end
|
209
|
+
|
210
|
+
str_copy
|
211
|
+
end
|
200
212
|
end
|
201
213
|
end
|
data/lib/note/version.rb
CHANGED