nikki 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -1
  3. data/lib/nikki/version.rb +1 -1
  4. data/lib/nikki.rb +30 -21
  5. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f2b22a3d803a872b060cc4ecfd9dac63c2e67e4
4
- data.tar.gz: c9e68b5e9657caa7ab6b886a429e4375460cf2e4
3
+ metadata.gz: 1d347080dcf01332640b8f3b1cedc21d5d9b8f24
4
+ data.tar.gz: da6963a943d8dad877f36e2bb92c0f7959dab365
5
5
  SHA512:
6
- metadata.gz: 15c40d6f5fbd78673cd4a5a7cc3b5c5959e7446a20e0e3f9a81da4f2bb67e13823bdd86132d5cfd8a986df619286226554f5415c47cf7aa2de2a2e11b36ad901
7
- data.tar.gz: 3d033d1356c87f9c048ce5fc6a6e08b9305fd9ebe2c72ca10f58cb63476cf46b8c7214fa576b9154c83498c1e562d3d76548e1894b7412b49ca6a089f835ef9a
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-pages.github.io/github/brandonpittman/nikki.png)](http://inch-pages.github.io/github/brandonpittman/nikki)
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
@@ -1,5 +1,5 @@
1
1
  # Sets version for RubyGems
2
2
  module Nikki
3
3
  # Sets version for RubyGems
4
- VERSION = "0.4.3"
4
+ VERSION = "0.4.5"
5
5
  end
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 heavy lifting for Nikki.
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
- # Will open your configured text editor on OS X if you didn't update the journal the previous day.
24
- # This will allow you to add missing entries in bulk.
25
- # It reads the settings in from the config YAML file and changes the date updated.
26
- # It does the same with the journal file, reading in the YAML and merging the hash of entries, and then saves the YAML back again.
27
- # There's also a method to check off a corresponding task in OmniFocus at the end.
28
- def new(*args)
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 = args.join(" ")
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
- if options[:marked]
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 --editor [String] (read_config[:editor]) Sets Nikki's editor to open journal file
60
- # @param --yesterday Set `settings[:updated]` to yesterday
61
- # @param --today Set `settings[:updated]` to today
62
- # @param --print Prints Nikki's configuration settings to STDOUT
63
- # @param --latest Prints Nikki's latest entries to STDOUT
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.3
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-05-30 00:00:00.000000000 Z
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.2.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.