synclenote 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/lib/synclenote/command.rb +18 -5
- data/lib/synclenote/version.rb +1 -1
- data/lib/synclenote.rb +1 -0
- metadata +1 -2
- data/Gemfile.lock +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c352d27660c56aff8d5d3b774d1638375ebb74a422e3ed7406357b4e5a3581e
|
4
|
+
data.tar.gz: '09925a4b803b45996af5b343aee9d6d851dae75369a8d035dc3a4c3e4707ec4c'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10752a91ecb12fa3357153e636cb00085c9249d32dc20a3634d4742cce7d464879d0db21c45543e6aef52880fa6afcf0ef2366379edc6cdfdfc8b4a6c440a8fd
|
7
|
+
data.tar.gz: bbcd3faa70e11247052fdc3d56b35d0adf448ebff62977afdca80a2256be1fe6bbf132952dca7bdc6abe353955b7ec8a6f35c35c6752a370489a2e5ffec2b91d
|
data/.gitignore
CHANGED
data/lib/synclenote/command.rb
CHANGED
@@ -147,6 +147,8 @@ EOS
|
|
147
147
|
</en-note>
|
148
148
|
EOS
|
149
149
|
|
150
|
+
TITLE_IF_EMPTY = "no title"
|
151
|
+
|
150
152
|
def load_yaml_path(path)
|
151
153
|
return YAML.safe_load(
|
152
154
|
path.read,
|
@@ -218,6 +220,7 @@ EOS
|
|
218
220
|
content = HEADER +
|
219
221
|
html.gsub(/ class=\".*?\"/, "").gsub(/<(br|hr|img).*?>/, "\\&</\\1>") +
|
220
222
|
FOOTER
|
223
|
+
title = TITLE_IF_EMPTY if /\A\s*\z/ === title
|
221
224
|
o = options.merge(title: title, content: content, tagNames: tags)
|
222
225
|
return Evernote::EDAM::Type::Note.new(o)
|
223
226
|
end
|
@@ -245,7 +248,7 @@ EOS
|
|
245
248
|
}.to_yaml)
|
246
249
|
tmp_file.close
|
247
250
|
path.parent.mkpath
|
248
|
-
FileUtils.mv(tmp_file.path, path)
|
251
|
+
FileUtils.mv(tmp_file.path, path) if !Synclenote::DRY_RUN
|
249
252
|
end
|
250
253
|
end
|
251
254
|
|
@@ -257,7 +260,12 @@ EOS
|
|
257
260
|
return
|
258
261
|
end
|
259
262
|
logger.debug("doing createNote: %s" % note_path)
|
260
|
-
created_note =
|
263
|
+
created_note =
|
264
|
+
if Synclenote::DRY_RUN
|
265
|
+
Evernote::EDAM::Type::Note.new(guid: "created_note_dummy_guid")
|
266
|
+
else
|
267
|
+
note_store.createNote(token, new_note)
|
268
|
+
end
|
261
269
|
logger.debug("done createNote.")
|
262
270
|
create_note_sync_status_file(note_sync_status_path, created_note,
|
263
271
|
Time.now)
|
@@ -273,7 +281,12 @@ EOS
|
|
273
281
|
return
|
274
282
|
end
|
275
283
|
logger.debug("doing updateNote: %s %s" % [note_path, guid])
|
276
|
-
updated_note =
|
284
|
+
updated_note =
|
285
|
+
if Synclenote::DRY_RUN
|
286
|
+
Evernote::EDAM::Type::Note.new(guid: "updated_note_dummy_guid")
|
287
|
+
else
|
288
|
+
note_store.updateNote(token, new_note)
|
289
|
+
end
|
277
290
|
logger.debug("done updateNote.")
|
278
291
|
create_note_sync_status_file(note_sync_status_path, updated_note, Time.now)
|
279
292
|
logger.debug("created: %s" % note_sync_status_path)
|
@@ -283,10 +296,10 @@ EOS
|
|
283
296
|
note_sync_status = load_yaml_path(note_sync_status_path)
|
284
297
|
guid = note_sync_status[:guid]
|
285
298
|
logger.debug("doing deleteNote: %s" % guid)
|
286
|
-
note_store.deleteNote(token, guid)
|
299
|
+
note_store.deleteNote(token, guid) if !Synclenote::DRY_RUN
|
287
300
|
logger.debug("done deleteNote.")
|
288
301
|
|
289
|
-
note_sync_status_path.delete
|
302
|
+
note_sync_status_path.delete if !Synclenote::DRY_RUN
|
290
303
|
logger.debug("removed: %s" % note_sync_status_path)
|
291
304
|
end
|
292
305
|
end
|
data/lib/synclenote/version.rb
CHANGED
data/lib/synclenote.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synclenote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuya.Nishida.
|
@@ -106,7 +106,6 @@ files:
|
|
106
106
|
- ".gitignore"
|
107
107
|
- ".travis.yml"
|
108
108
|
- Gemfile
|
109
|
-
- Gemfile.lock
|
110
109
|
- Guardfile
|
111
110
|
- LICENSE.txt
|
112
111
|
- README.md
|
data/Gemfile.lock
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
synclenote (0.0.1)
|
5
|
-
evernote_oauth
|
6
|
-
redcarpet
|
7
|
-
thor
|
8
|
-
|
9
|
-
GEM
|
10
|
-
remote: https://rubygems.org/
|
11
|
-
specs:
|
12
|
-
debug (1.6.2)
|
13
|
-
irb (>= 1.3.6)
|
14
|
-
reline (>= 0.3.1)
|
15
|
-
evernote-thrift (1.25.2)
|
16
|
-
evernote_oauth (0.2.3)
|
17
|
-
evernote-thrift
|
18
|
-
oauth (>= 0.4.1)
|
19
|
-
hashie (5.0.0)
|
20
|
-
io-console (0.5.11)
|
21
|
-
irb (1.4.1)
|
22
|
-
reline (>= 0.3.0)
|
23
|
-
oauth (1.1.0)
|
24
|
-
oauth-tty (~> 1.0, >= 1.0.1)
|
25
|
-
snaky_hash (~> 2.0)
|
26
|
-
version_gem (~> 1.1)
|
27
|
-
oauth-tty (1.0.5)
|
28
|
-
version_gem (~> 1.1, >= 1.1.1)
|
29
|
-
rake (13.0.6)
|
30
|
-
redcarpet (3.6.0)
|
31
|
-
reline (0.3.1)
|
32
|
-
io-console (~> 0.5)
|
33
|
-
snaky_hash (2.0.1)
|
34
|
-
hashie
|
35
|
-
version_gem (~> 1.1, >= 1.1.1)
|
36
|
-
thor (1.3.0)
|
37
|
-
version_gem (1.1.3)
|
38
|
-
|
39
|
-
PLATFORMS
|
40
|
-
x86_64-linux
|
41
|
-
|
42
|
-
DEPENDENCIES
|
43
|
-
bundler
|
44
|
-
debug
|
45
|
-
rake
|
46
|
-
synclenote!
|
47
|
-
|
48
|
-
BUNDLED WITH
|
49
|
-
2.3.10
|