nikki 0.6.0 → 0.6.1
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/lib/nikki/version.rb +1 -1
- data/lib/nikki.rb +15 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a7d629d3ac3b7521921c207ef919f3a2662c930
|
4
|
+
data.tar.gz: a9e340257084abb4e845b95a30a6118579825b33
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa98582611c8d2d742106e56082d0149c965ccbdaf66e48a29af2773ce33845be96548a99057fcae598ff66ebaf27df54514c7fdda771a7823a160a1bc8efcc9
|
7
|
+
data.tar.gz: e660cec908c7f9dcf881be72db0e774535af73c7381e1911449a40090ec9a14bee62627018c1c496ad381b790c9a429cbf6add9374a445e60a04bda0ac7a3162
|
data/lib/nikki/version.rb
CHANGED
data/lib/nikki.rb
CHANGED
@@ -8,8 +8,8 @@ require 'fileutils'
|
|
8
8
|
# This is the main class that interfaces with Thor's methods and does all the
|
9
9
|
# heavy lifting for Nikki. It's a bit of a "God" object. Sorries.
|
10
10
|
class Generator < Thor
|
11
|
-
NIKKI_PATH =
|
12
|
-
NIKKI_FILE =
|
11
|
+
NIKKI_PATH = "#{ENV['HOME']}/.nikki"
|
12
|
+
NIKKI_FILE = "#{ENV['HOME']}/.nikki/nikki.yaml"
|
13
13
|
|
14
14
|
# @!group Data entry
|
15
15
|
desc 'new ENTRY', 'Creates a new entry in the Nikki journal.'
|
@@ -42,7 +42,7 @@ class Generator < Thor
|
|
42
42
|
desc 'open', "Open current year's journal file in editor."
|
43
43
|
# Open Nikki journal in configured text editor
|
44
44
|
def open
|
45
|
-
system(ENV['EDITOR'], NIKKI_FILE
|
45
|
+
system(ENV['EDITOR'], NIKKI_FILE)
|
46
46
|
end
|
47
47
|
|
48
48
|
desc 'ls', 'Displays latest Nikki entries.'
|
@@ -54,18 +54,24 @@ class Generator < Thor
|
|
54
54
|
entries = store['entries'].last(5)
|
55
55
|
entries.each do |entry|
|
56
56
|
entry.each do |date, text|
|
57
|
-
puts "#{date
|
57
|
+
puts "#{date}: #{text}"
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
|
63
|
+
desc 'export YEAR', 'Export Nikki journal from YEAR as YAML'
|
64
64
|
# @param [String] year of journal entries you wish to export
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
def export(export_year)
|
66
|
+
export_path = "#{NIKKI_PATH}/nikki_export_#{export_year}.yml"
|
67
|
+
YAML::Store.new(NIKKI_FILE).transaction do |store|
|
68
|
+
store['entries'].each do |entry|
|
69
|
+
if entry.keys[0].year.to_s == export_year
|
70
|
+
puts "#{entry.keys[0]}: #{entry.values[0]}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
68
74
|
# IO.write(export_path, yamlize(read_file, year.to_i))
|
69
75
|
# puts "YAML saved to \"#{export_path}\"."
|
70
|
-
|
76
|
+
end
|
71
77
|
end
|