nikki 0.5.3 → 0.5.4
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/nikki/version.rb +1 -1
- data/lib/nikki.rb +55 -59
- metadata +3 -26
- data/doc/Generator.html +0 -829
- data/doc/Nikki.html +0 -153
- data/doc/_index.html +0 -137
- data/doc/class_list.html +0 -62
- data/doc/css/common.css +0 -1
- data/doc/css/cucumber.css +0 -227
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -339
- data/doc/feature_list.html +0 -65
- data/doc/file.README.html +0 -149
- data/doc/file_list.html +0 -64
- data/doc/frames.html +0 -26
- data/doc/index.html +0 -149
- data/doc/js/app.js +0 -219
- data/doc/js/cucumber.js +0 -305
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -103
- data/doc/requirements/step_transformers.html +0 -140
- data/doc/requirements/tags.html +0 -193
- data/doc/requirements.html +0 -132
- data/doc/tag_list.html +0 -65
- data/doc/top-level-namespace.html +0 -128
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bad525c6509fa646d2ec49341ddd01243eed11ff
|
4
|
+
data.tar.gz: 8e027f08280c4b92885f57c513a62cf63b5f5e53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f2cc4f9a14519dfcec0290e8c51afde64c78910c38d6212ca7c3491d2baa321811240cee78bb8704198b8902b1a4b4d8c2d307c9e67420eb67b243f191234e2
|
7
|
+
data.tar.gz: 92200e97291888ede9f6899bc5b29aad71325bcd35d17dffae08a2cac77a728aa91288ca3daf6b295e907a91539cc54ad9fd22be3d67d69358df970a8a4eae4b
|
data/.gitignore
CHANGED
data/lib/nikki/version.rb
CHANGED
data/lib/nikki.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
require 'thor'
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
2
|
+
require 'pathname'
|
3
|
+
require 'yaml'
|
4
|
+
require 'date'
|
5
5
|
require 'fileutils'
|
6
|
+
require 'stickynotifications'
|
6
7
|
|
7
8
|
# @author Brandon Pittman
|
8
9
|
# This is the main class that interfaces with Thor's methods and does all the
|
9
10
|
# heavy lifting for Nikki. It's a bit of a "God" object. Sorries.
|
10
11
|
class Generator < Thor
|
11
|
-
|
12
|
-
desc
|
12
|
+
# @!group Initial Setup
|
13
|
+
desc 'setup', 'Creates new Nikki and config files.'
|
13
14
|
# This methods creates the ".nikki" directory, config file and journal file.
|
14
15
|
def setup
|
15
16
|
create_path
|
@@ -17,7 +18,10 @@ class Generator < Thor
|
|
17
18
|
create_config_file
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
+
# @!endgroup
|
22
|
+
|
23
|
+
# @!group Data entry
|
24
|
+
desc 'new ENTRY', 'Creates a new entry in the Nikki journal.'
|
21
25
|
# Add entry to journal
|
22
26
|
# @param entry [String] entry to add to the journal
|
23
27
|
# @param update [String] International date for update
|
@@ -45,31 +49,41 @@ class Generator < Thor
|
|
45
49
|
write_file(journal)
|
46
50
|
open unless updated_yesterday?
|
47
51
|
write_config(settings)
|
48
|
-
add_to_omnifocus
|
49
52
|
puts latest
|
50
53
|
end
|
51
54
|
|
52
|
-
desc
|
55
|
+
desc 'missed', 'Create new entry for yesterday'
|
53
56
|
# Creates a new entry for yesterday
|
54
57
|
# @param entry [String]
|
58
|
+
# @since 0.5.3
|
55
59
|
def missed(entry)
|
56
|
-
new(entry, (Date.today-1).to_s)
|
60
|
+
new(entry, (Date.today - 1).to_s)
|
57
61
|
end
|
62
|
+
# @!endgroup
|
58
63
|
|
59
|
-
desc
|
64
|
+
desc 'open', "Open current year's journal file in editor."
|
60
65
|
# Open Nikki journal in configured text editor
|
61
66
|
def open
|
62
|
-
|
67
|
+
`open -a "#{editor}" #{file}`
|
63
68
|
end
|
64
69
|
|
65
|
-
desc
|
70
|
+
desc 'ls', 'Displays latest Nikki entries.'
|
71
|
+
# option :sticky,
|
72
|
+
# aliases: :s,
|
73
|
+
# type: :string,
|
74
|
+
# banner: 'Notify if not updated today'
|
66
75
|
# Display Nikki's latest entires
|
67
76
|
# @return [String]
|
77
|
+
# @option options :sticky [String]
|
78
|
+
# Display Sticky Notification if Nikki hasn't been updated
|
68
79
|
def ls
|
69
80
|
puts latest
|
81
|
+
# StickyNotifications::Note.new.create(
|
82
|
+
# "Nikki hasn't been updated today!", 'Nikki'
|
83
|
+
# )
|
70
84
|
end
|
71
85
|
|
72
|
-
desc
|
86
|
+
desc 'config', "Change Nikki's settings."
|
73
87
|
option :editor, :aliases => :e, :banner => "Set default editor to open journal file in."
|
74
88
|
option :yesterday, :aliases => :y, :type => :boolean, :banner => "Set nikki's \"updated\" date to yesterday."
|
75
89
|
option :today, :aliases => :t, :type => :boolean, :banner => "Set nikki's \"updated\" date to today."
|
@@ -85,22 +99,21 @@ class Generator < Thor
|
|
85
99
|
def config
|
86
100
|
settings = read_config
|
87
101
|
settings[:editor] = options[:editor] || read_config[:editor]
|
88
|
-
settings[:updated] = Date.today-1
|
89
|
-
settings[:updated] = Date.today if options[:today]
|
102
|
+
settings[:updated] = options[:yesterday] ? Date.today - 1 : Date.today
|
90
103
|
write_config(settings)
|
91
104
|
puts settings.to_yaml if options[:print]
|
92
105
|
puts latest if options[:latest]
|
93
106
|
end
|
94
107
|
|
95
|
-
desc
|
108
|
+
desc 'publish YEAR', 'Save Nikki journal from YEAR as Markdown'
|
96
109
|
# @param [String] year of journal entries you wish to pubish as Markdown This
|
97
110
|
# method calls the `markdown` method and creates a MultiMarkdown document
|
98
111
|
# with one big description list. This format is subject to change, but for
|
99
112
|
# now, it seems good enough.
|
100
|
-
def
|
101
|
-
|
102
|
-
IO.write(
|
103
|
-
puts "Markdown saved to \"#{
|
113
|
+
def export(year)
|
114
|
+
export_path = "#{path}nikki_export_#{year}.yml"
|
115
|
+
IO.write(export_path, yamlize(read_file, year.to_i))
|
116
|
+
puts "Markdown saved to \"#{export_path}\"."
|
104
117
|
end
|
105
118
|
|
106
119
|
no_commands do
|
@@ -113,7 +126,7 @@ class Generator < Thor
|
|
113
126
|
end
|
114
127
|
|
115
128
|
def config_file
|
116
|
-
path.join(
|
129
|
+
path.join('nikki.config.yaml')
|
117
130
|
end
|
118
131
|
|
119
132
|
def read_config
|
@@ -141,19 +154,19 @@ class Generator < Thor
|
|
141
154
|
end
|
142
155
|
|
143
156
|
def file
|
144
|
-
path.join(
|
157
|
+
path.join('nikki.yaml')
|
145
158
|
end
|
146
159
|
|
147
160
|
def config_file_exist?
|
148
161
|
return true if config_file.exist?
|
149
162
|
create_config_file
|
150
|
-
|
163
|
+
true
|
151
164
|
end
|
152
165
|
|
153
166
|
def file_exist?
|
154
167
|
return true if file.exist?
|
155
168
|
create_file
|
156
|
-
|
169
|
+
true
|
157
170
|
end
|
158
171
|
|
159
172
|
def create_config_file
|
@@ -167,31 +180,12 @@ class Generator < Thor
|
|
167
180
|
FileUtils.touch(file)
|
168
181
|
end
|
169
182
|
|
170
|
-
def marked
|
171
|
-
Pathname.new("/Applications/Marked.app")
|
172
|
-
end
|
173
|
-
|
174
183
|
def today
|
175
184
|
Date.today
|
176
185
|
end
|
177
186
|
|
178
187
|
def yesterday
|
179
|
-
Date.today-1
|
180
|
-
end
|
181
|
-
|
182
|
-
def months_with_names
|
183
|
-
{1=>{:name=>"January"},
|
184
|
-
2=>{:name=>"February"},
|
185
|
-
3=>{:name=>"March"},
|
186
|
-
4=>{:name=>"April"},
|
187
|
-
5=>{:name=>"May"},
|
188
|
-
6=>{:name=>"June"},
|
189
|
-
7=>{:name=>"July"},
|
190
|
-
8=>{:name=>"August"},
|
191
|
-
9=>{:name=>"September"},
|
192
|
-
10=>{:name=>"October"},
|
193
|
-
11=>{:name=>"November"},
|
194
|
-
12=>{:name=>"December"}}
|
188
|
+
Date.today - 1
|
195
189
|
end
|
196
190
|
|
197
191
|
def leap_year?
|
@@ -203,36 +197,38 @@ class Generator < Thor
|
|
203
197
|
end
|
204
198
|
|
205
199
|
def updated_yesterday?
|
206
|
-
last_updated == Date.today-1
|
200
|
+
last_updated == Date.today - 1
|
207
201
|
end
|
208
202
|
|
209
203
|
def latest
|
210
204
|
list = []
|
211
205
|
(0..3).each do |n|
|
212
|
-
list << "#{today-n}: #{read_file[today-n]}"
|
206
|
+
list << "#{today - n}: #{read_file[today - n]}"
|
213
207
|
end
|
214
208
|
list.reverse!
|
215
209
|
end
|
216
210
|
|
217
|
-
def
|
218
|
-
string = ""
|
211
|
+
def yamlize(hash, year)
|
212
|
+
string = "---\n"
|
219
213
|
hash.each_pair do |date, sentence|
|
220
|
-
if date.year == year
|
221
|
-
string += "#{date}\n: #{sentence}\n"
|
222
|
-
end
|
214
|
+
string += "#{date}: #{sentence}\n" if date.year == year
|
223
215
|
end
|
224
216
|
string
|
225
217
|
end
|
226
218
|
|
227
219
|
def add_to_omnifocus
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
220
|
+
`osascript <<-APPLESCRIPT
|
221
|
+
tell application "OmniFocus"
|
222
|
+
tell default document
|
223
|
+
set nikki_task to first remaining task of flattened context "Home" whose name is "Record what I learned today"
|
224
|
+
set deferDate to defer date of nikki_task
|
225
|
+
if weekday of (deferDate) is weekday of (current date) then
|
226
|
+
set completed of nikki_task to true
|
227
|
+
end if
|
228
|
+
end tell
|
229
|
+
synchronize
|
230
|
+
end tell
|
231
|
+
APPLESCRIPT`
|
236
232
|
end
|
237
233
|
end
|
238
234
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nikki
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Pittman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -111,29 +111,6 @@ files:
|
|
111
111
|
- README.md
|
112
112
|
- Rakefile
|
113
113
|
- bin/nikki
|
114
|
-
- doc/Generator.html
|
115
|
-
- doc/Nikki.html
|
116
|
-
- doc/_index.html
|
117
|
-
- doc/class_list.html
|
118
|
-
- doc/css/common.css
|
119
|
-
- doc/css/cucumber.css
|
120
|
-
- doc/css/full_list.css
|
121
|
-
- doc/css/style.css
|
122
|
-
- doc/feature_list.html
|
123
|
-
- doc/file.README.html
|
124
|
-
- doc/file_list.html
|
125
|
-
- doc/frames.html
|
126
|
-
- doc/index.html
|
127
|
-
- doc/js/app.js
|
128
|
-
- doc/js/cucumber.js
|
129
|
-
- doc/js/full_list.js
|
130
|
-
- doc/js/jquery.js
|
131
|
-
- doc/method_list.html
|
132
|
-
- doc/requirements.html
|
133
|
-
- doc/requirements/step_transformers.html
|
134
|
-
- doc/requirements/tags.html
|
135
|
-
- doc/tag_list.html
|
136
|
-
- doc/top-level-namespace.html
|
137
114
|
- features/new_entry.feature
|
138
115
|
- features/random.feature
|
139
116
|
- features/step_definitions/new_entry.steps.rb
|
@@ -165,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
165
142
|
version: '0'
|
166
143
|
requirements: []
|
167
144
|
rubyforge_project:
|
168
|
-
rubygems_version: 2.4.
|
145
|
+
rubygems_version: 2.4.6
|
169
146
|
signing_key:
|
170
147
|
specification_version: 4
|
171
148
|
summary: A simple one-line-a-day journaling app.
|