nikki 0.4.3 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -1
- data/lib/nikki/version.rb +1 -1
- data/lib/nikki.rb +30 -21
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d347080dcf01332640b8f3b1cedc21d5d9b8f24
|
4
|
+
data.tar.gz: da6963a943d8dad877f36e2bb92c0f7959dab365
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c96519fb7c78be496e6b9b05d747c68bf872848199b66b8278394b7d676eff329d891de017726bed0c74309f41f5e150b73068b41bc856cda442c10b0da6714c
|
7
|
+
data.tar.gz: e2a49ff9889337ac09409c0ec6654d159a6e2ed527ad080654772ecef10fc5611f727acae60da3c6546fd41f8187523d5613ba4ecf10016a1e72b636edfbfebc
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
[![Gem Version](https://badge.fury.io/rb/nikki.png)](http://badge.fury.io/rb/nikki)
|
2
|
-
[![Inline docs](http://inch-
|
2
|
+
[![Inline docs](http://inch-ci.org/github/brandonpittman/nikki.png)](http://inch-ci.org/github/brandonpittman/nikki)
|
3
3
|
|
4
4
|
# nikki
|
5
5
|
|
@@ -31,6 +31,15 @@ Or install it yourself as:
|
|
31
31
|
nikki open # Open current year's journal file in editor.
|
32
32
|
nikki setup # Creates new Nikki and config files.
|
33
33
|
|
34
|
+
## Examples
|
35
|
+
|
36
|
+
### New entry
|
37
|
+
nikki new "Brandon Pittman is a super cool guy."
|
38
|
+
|
39
|
+
### Configure Nikki
|
40
|
+
nikki config --yesterday # Reset last updated `datetime`
|
41
|
+
nikki config --list # Prints latest entries
|
42
|
+
|
34
43
|
## Contributing
|
35
44
|
|
36
45
|
1. Fork it ( http://github.com/<my-github-username>/nikki/fork )
|
data/lib/nikki/version.rb
CHANGED
data/lib/nikki.rb
CHANGED
@@ -5,8 +5,8 @@ require "date"
|
|
5
5
|
require 'fileutils'
|
6
6
|
|
7
7
|
# @author Brandon Pittman
|
8
|
-
# This is the main class that interfaces with Thor's methods and does all the
|
9
|
-
# It's a bit of a "God" object. Sorries.
|
8
|
+
# This is the main class that interfaces with Thor's methods and does all the
|
9
|
+
# heavy lifting for Nikki. It's a bit of a "God" object. Sorries.
|
10
10
|
class Generator < Thor
|
11
11
|
|
12
12
|
desc "setup", "Creates new Nikki and config files."
|
@@ -19,16 +19,21 @@ class Generator < Thor
|
|
19
19
|
|
20
20
|
desc "new ENTRY", "Creates a new entry in the Nikki journal."
|
21
21
|
# Add entry to journal
|
22
|
-
# @param entry [String] entry to add to the journal
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
|
22
|
+
# @param --entry [String] entry to add to the journal
|
23
|
+
# @return [Hash] Returns a Hash which is then saved in a YAML file.
|
24
|
+
# @example
|
25
|
+
# "nikki new 'This is a thing I learned today!'"
|
26
|
+
# Will open your configured text editor on OS X if you didn't update the
|
27
|
+
# journal the previous day. This will allow you to add missing entries in
|
28
|
+
# bulk. It reads the settings in from the config YAML file and changes the
|
29
|
+
# date updated. It does the same with the journal file, reading in the YAML
|
30
|
+
# and merging the hash of entries, and then saves the YAML back again.
|
31
|
+
# There's also a method to check off a corresponding task in OmniFocus at the
|
32
|
+
# end.
|
33
|
+
def new(*entry)
|
29
34
|
settings = read_config
|
30
35
|
settings[:updated] = today
|
31
|
-
entry =
|
36
|
+
entry = entry.join(" ")
|
32
37
|
entry_hash = { today => entry }
|
33
38
|
journal = read_file.merge(entry_hash)
|
34
39
|
write_file(journal)
|
@@ -39,16 +44,19 @@ class Generator < Thor
|
|
39
44
|
end
|
40
45
|
|
41
46
|
desc "open", "Open current year's journal file in editor."
|
42
|
-
option :marked, :aliases => :m, :type => :boolean
|
43
47
|
# Open Nikki journal in configured text editor
|
44
48
|
def open
|
45
|
-
|
46
|
-
%x{open -a Marked #{file}}
|
47
|
-
else
|
48
|
-
%x{open -a "#{editor}" #{file}}
|
49
|
-
end
|
49
|
+
%x{open -a "#{editor}" #{file}}
|
50
50
|
end
|
51
51
|
|
52
|
+
desc "ls", "Displays latest Nikki entries."
|
53
|
+
# Display Nikki's latest entires
|
54
|
+
# @return [String]
|
55
|
+
def ls
|
56
|
+
puts latest
|
57
|
+
end
|
58
|
+
|
59
|
+
|
52
60
|
desc "config", "Change Nikki's settings."
|
53
61
|
option :editor, :aliases => :e, :banner => "Set default editor to open journal file in."
|
54
62
|
option :yesterday, :aliases => :y, :type => :boolean, :banner => "Set nikki's \"updated\" date to yesterday."
|
@@ -56,11 +64,12 @@ class Generator < Thor
|
|
56
64
|
option :print, :aliases => :p, :type => :boolean, :banner => "Prints nikki's config settings."
|
57
65
|
option :latest, :aliases => :l, :type => :boolean, :banner => "Prints latest journal entries."
|
58
66
|
# Configure Nikki's settings
|
59
|
-
# @param
|
60
|
-
# @
|
61
|
-
# @
|
62
|
-
# @
|
63
|
-
# @
|
67
|
+
# @param [Hash] options The options for configuring Nikki
|
68
|
+
# @option options :editor [String] (read_config[:editor]) Sets Nikki's editor to open journal file
|
69
|
+
# @option options :yesterday [Boolean] Set `settings[:updated]` to yesterday
|
70
|
+
# @option options :today [Boolean] Set `settings[:updated]` to today
|
71
|
+
# @option options :print [Boolean] Prints Nikki's configuration settings to STDOUT
|
72
|
+
# @option options :latest [Boolean] Prints Nikki's latest entries to STDOUT
|
64
73
|
def config
|
65
74
|
settings = read_config
|
66
75
|
settings[:editor] = options[:editor] || read_config[:editor]
|
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.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Pittman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.4.1
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: A simple one-line-a-day journaling app.
|