evernote-editor 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/lib/evernote_editor/editor.rb +3 -3
- data/lib/evernote_editor/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
Simple gem that provides command line creation and editing of Evernote notes.
|
6
6
|
Uses your favorite editor and Markdown formatting.
|
7
7
|
|
8
|
+
## Requirements
|
9
|
+
|
10
|
+
Only tested on OSX and Ruby 1.9.3 with `vim` and `mvim` editors. YMMV.
|
11
|
+
|
8
12
|
## Installation
|
9
13
|
|
10
14
|
gem install evernote-editor
|
@@ -13,9 +13,10 @@ module EvernoteEditor
|
|
13
13
|
attr_accessor :configuration
|
14
14
|
|
15
15
|
def initialize(*args, opts)
|
16
|
-
@title = args.flatten[0] || "
|
16
|
+
@title = args.flatten[0] || ""
|
17
17
|
@tags = (args.flatten[1] || '').split(',')
|
18
18
|
@options = opts
|
19
|
+
@sandbox = opts[:sandbox]
|
19
20
|
@mkdout = Redcarpet::Markdown.new(Redcarpet::Render::XHTML,
|
20
21
|
autolink: true, space_after_headers: true, no_intra_emphasis: true)
|
21
22
|
end
|
@@ -25,7 +26,6 @@ module EvernoteEditor
|
|
25
26
|
@options[:edit] ? edit_note : create_note
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
29
|
def configure
|
30
30
|
FileUtils.touch(CONFIGURATION_FILE) unless File.exist?(CONFIGURATION_FILE)
|
31
31
|
@configuration = YAML::load(File.open(CONFIGURATION_FILE)) || {}
|
@@ -39,7 +39,7 @@ module EvernoteEditor
|
|
39
39
|
evn_client = EvernoteOAuth::Client.new(token: @configuration[:token], sandbox: @sandbox)
|
40
40
|
note_store = evn_client.note_store
|
41
41
|
note = Evernote::EDAM::Type::Note.new
|
42
|
-
note.title = @title
|
42
|
+
note.title = @title.empty? ? "Untitled note" : @title
|
43
43
|
note.content = note_markup(markdown)
|
44
44
|
created_note = note_store.createNote(@configuration[:token], note)
|
45
45
|
say "Successfully created new note '#{created_note.title}'"
|