nikki 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nikki/version.rb +1 -1
  3. data/lib/nikki.rb +15 -9
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df96721c6f7e903e772be3b0bcb13e0d350d2d7c
4
- data.tar.gz: 0f2cd93c62189cc99dd68c17840b9d7d7c77f50e
3
+ metadata.gz: 4a7d629d3ac3b7521921c207ef919f3a2662c930
4
+ data.tar.gz: a9e340257084abb4e845b95a30a6118579825b33
5
5
  SHA512:
6
- metadata.gz: 28c5cb7d185cf27818f601becdfca46929f60a1759e8c1eea89aa888614244fcf02b238a9e6ff559d0f02753b061b9619060ff5c66cce74d8668dad318b1775f
7
- data.tar.gz: fe47682a4916ed1983e81f68c9f520473bb4b0d116da1561165d2cd7e8dbc248df41d63d342e3cf5f007a68bf3aba7b056eab5cecc9356d542b18fcbb0f0f3e2
6
+ metadata.gz: fa98582611c8d2d742106e56082d0149c965ccbdaf66e48a29af2773ce33845be96548a99057fcae598ff66ebaf27df54514c7fdda771a7823a160a1bc8efcc9
7
+ data.tar.gz: e660cec908c7f9dcf881be72db0e774535af73c7381e1911449a40090ec9a14bee62627018c1c496ad381b790c9a429cbf6add9374a445e60a04bda0ac7a3162
data/lib/nikki/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Sets version for RubyGems
2
2
  module Nikki
3
3
  # Sets version for RubyGems
4
- VERSION = '0.6.0'
4
+ VERSION = '0.6.1'
5
5
  end
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 = Pathname.new("#{ENV['HOME']}/.nikki")
12
- NIKKI_FILE = Pathname.new("#{ENV['HOME']}/.nikki/nikki.yaml")
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.to_s)
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.to_s}: #{text}"
57
+ puts "#{date}: #{text}"
58
58
  end
59
59
  end
60
60
  end
61
61
  end
62
62
 
63
- # desc 'export YEAR', 'Export Nikki journal from YEAR as YAML'
63
+ desc 'export YEAR', 'Export Nikki journal from YEAR as YAML'
64
64
  # @param [String] year of journal entries you wish to export
65
- # def export(year)
66
- # TODO Fix this export command
67
- # export_path = "#{NIKKI_PATH}/nikki_export_#{year}.yml"
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
- # end
76
+ end
71
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nikki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Pittman