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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 909401f6f0f32860825c396ef438f53fd53447260570a88c234ae330b38dbb26
4
- data.tar.gz: b49889059a4adbc1a370acbcb7b3943aeb6099ea724b4008146cad193bd1b344
3
+ metadata.gz: 1c352d27660c56aff8d5d3b774d1638375ebb74a422e3ed7406357b4e5a3581e
4
+ data.tar.gz: '09925a4b803b45996af5b343aee9d6d851dae75369a8d035dc3a4c3e4707ec4c'
5
5
  SHA512:
6
- metadata.gz: 802161aaf2e5bee2769aa5da00352ee0029a829b428afa72f67aa71259458bc7594e21512ac838973aa103fe0c46c076ddf772f7eba78f6b6692b4bb9c5527c6
7
- data.tar.gz: 6c8b25dfbbbbf568ffbee06de751f4267620fb4ed309d8d391823dbf6f0cda951f3682eb59a927e58fedfa999cf7e988a2d073acf46f559d3dc2f6ea7e3b9672
6
+ metadata.gz: 10752a91ecb12fa3357153e636cb00085c9249d32dc20a3634d4742cce7d464879d0db21c45543e6aef52880fa6afcf0ef2366379edc6cdfdfc8b4a6c440a8fd
7
+ data.tar.gz: bbcd3faa70e11247052fdc3d56b35d0adf448ebff62977afdca80a2256be1fe6bbf132952dca7bdc6abe353955b7ec8a6f35c35c6752a370489a2e5ffec2b91d
data/.gitignore CHANGED
@@ -19,3 +19,4 @@ tmp
19
19
  *.o
20
20
  *.a
21
21
  mkmf.log
22
+ /Gemfile.lock
@@ -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 = note_store.createNote(token, new_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 = note_store.updateNote(token, new_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
@@ -1,3 +1,3 @@
1
1
  module Synclenote
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/synclenote.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # This module is a namespace for this gem.
2
2
  module Synclenote
3
+ DRY_RUN = false
3
4
  autoload :VERSION, "synclenote/varsion"
4
5
 
5
6
  autoload :Command, "synclenote/command"
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.1
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