nikki 0.1.7 → 0.2.0
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/README.md +5 -3
- data/features/initialize_journal.feature +1 -0
- data/features/new_entry.feature +3 -0
- data/lib/nikki/version.rb +1 -1
- data/lib/nikki.rb +21 -7
- data/test/tc_nikki.rb +8 -1
- 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: bfaba939a9d1ab7eb954a7754a33e6d8c2a84d6a
|
4
|
+
data.tar.gz: df88a5fe6e5a501c95e4ce08eecee69ad627cd41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fa450eb8394858b22cf2da1f1048e02ea1430ac90a20d28284788f444b3db4e8cab33137ffadcc133a56073ddb0263511cf846ed4efef0d4b38200fd524ddbf
|
7
|
+
data.tar.gz: b947019300adc5c52985db99e1e6c88e6cc3f6e9231971f41c841e5eb1492aacdc81aed0019788bc483df779c56ceca40b5da148615bc6ef11cb6f59f6ab316a
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](http://badge.fury.io/rb/nikki)
|
1
|
+
[](http://badge.fury.io/rb/nikki)
|
2
2
|
|
3
3
|
# nikki
|
4
4
|
|
@@ -24,8 +24,10 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
## Usage
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
nikki config # Change Nikki's settings.
|
28
|
+
nikki help [COMMAND] # Describe available commands or one specific command
|
29
|
+
nikki new ENTRY # Creates a new entry in the Nikki journal.
|
30
|
+
nikki open # Opens current year's journal file in editor.
|
29
31
|
|
30
32
|
## Contributing
|
31
33
|
|
data/features/new_entry.feature
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
@entry_creation
|
1
2
|
Feature: Add a new entry to the journal
|
2
3
|
|
3
4
|
Because I'm keeping a daily one-line journal, I want to be able to be able to save a new line with the day of the month next to it.
|
@@ -5,6 +6,7 @@ Feature: Add a new entry to the journal
|
|
5
6
|
Background:
|
6
7
|
Given I have a journal file
|
7
8
|
|
9
|
+
@file_creation
|
8
10
|
Scenario: I haven't created a journal file
|
9
11
|
When the journal file can't be found
|
10
12
|
Then a file should be created
|
@@ -19,6 +21,7 @@ Scenario: I have a journal file and it's *not* the first of the month
|
|
19
21
|
When it's not the first of the month
|
20
22
|
Then my entry should be appended along with the day of the month
|
21
23
|
|
24
|
+
@missed_day
|
22
25
|
Scenario: I didn't update the journal yesterday
|
23
26
|
When the mtime of the journal isn't yesterday
|
24
27
|
Then the journal should open in my editor
|
data/lib/nikki/version.rb
CHANGED
data/lib/nikki.rb
CHANGED
@@ -7,32 +7,42 @@ module Nikki
|
|
7
7
|
class Generator < Thor
|
8
8
|
|
9
9
|
desc "new ENTRY", "Creates a new entry in the Nikki journal."
|
10
|
-
def new(
|
10
|
+
def new(*args)
|
11
11
|
settings = read_config
|
12
12
|
settings[:updated] = today
|
13
|
+
entry = args.join(" ")
|
13
14
|
file.open('a') { |file| file.puts text(entry)}
|
14
15
|
open unless updated_yesterday?
|
15
16
|
write_config(settings)
|
16
17
|
end
|
17
18
|
|
18
|
-
desc "open", "
|
19
|
+
desc "open", "Open current year's journal file in editor."
|
20
|
+
option :marked, :aliases => :m, :type => :boolean
|
19
21
|
def open
|
20
|
-
|
22
|
+
if options[:marked]
|
23
|
+
%x{open -a Marked #{file}}
|
24
|
+
else
|
25
|
+
%x{open -a "#{editor}" #{file}}
|
26
|
+
end
|
21
27
|
end
|
22
28
|
|
23
29
|
desc "config", "Change Nikki's settings."
|
24
30
|
option :editor, :aliases => :e
|
31
|
+
option :yesterday, :aliases => :y, :type => :boolean
|
32
|
+
option :today, :aliases => :t, :type => :boolean
|
33
|
+
option :display, :aliases => :d, :type => :boolean
|
25
34
|
def config
|
26
35
|
settings = read_config
|
27
|
-
settings[:editor] = options[:editor] ||
|
36
|
+
settings[:editor] = options[:editor] || read_config[:editor]
|
37
|
+
settings[:updated] = Date.today-1 if options[:yesterday]
|
38
|
+
settings[:updated] = Date.today if options[:today]
|
39
|
+
puts settings.to_yaml
|
28
40
|
write_config(settings)
|
29
41
|
end
|
30
42
|
|
31
43
|
no_commands do
|
32
44
|
def path
|
33
|
-
dropbox = Pathname.new("#{ENV['HOME']}/Dropbox/")
|
34
45
|
home = Pathname.new("#{ENV['HOME']}/")
|
35
|
-
path = dropbox.exist? ? dropbox : home
|
36
46
|
end
|
37
47
|
|
38
48
|
def config_file
|
@@ -80,6 +90,10 @@ module Nikki
|
|
80
90
|
FileUtils.touch(file)
|
81
91
|
end
|
82
92
|
|
93
|
+
def marked
|
94
|
+
Pathname.new("/Applications/Marked.app")
|
95
|
+
end
|
96
|
+
|
83
97
|
def today
|
84
98
|
Date.today
|
85
99
|
end
|
@@ -109,4 +123,4 @@ module Nikki
|
|
109
123
|
end
|
110
124
|
end
|
111
125
|
end
|
112
|
-
end
|
126
|
+
end
|
data/test/tc_nikki.rb
CHANGED
@@ -7,6 +7,10 @@ class NikkiTest < MiniTest::Unit::TestCase
|
|
7
7
|
|
8
8
|
include Nikki
|
9
9
|
|
10
|
+
nikki = Generator.new
|
11
|
+
FileUtils.rm(nikki.file) if nikki.file_exist?
|
12
|
+
FileUtils.rm(nikki.config_file) if nikki.config_file_exist?
|
13
|
+
|
10
14
|
def test_file_exist?
|
11
15
|
nikki = Generator.new
|
12
16
|
assert_equal(true,nikki.file_exist?)
|
@@ -19,7 +23,10 @@ class NikkiTest < MiniTest::Unit::TestCase
|
|
19
23
|
|
20
24
|
def test_updated_yesterday?
|
21
25
|
nikki = Generator.new
|
22
|
-
|
26
|
+
settings = nikki.read_config
|
27
|
+
settings[:updated] = nikki.today-1
|
28
|
+
nikki.write_config(settings)
|
29
|
+
assert(nikki.updated_yesterday?,"Journal wasn't updated last yesterday.")
|
23
30
|
end
|
24
31
|
|
25
32
|
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.
|
4
|
+
version: 0.2.0
|
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-03-
|
11
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.2.
|
128
|
+
rubygems_version: 2.2.2
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: A simple one-line-a-day journaling app.
|