nikki 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +21 -0
- data/Gemfile +6 -0
- data/LICENSE +20 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +15 -0
- data/bin/nikki +5 -0
- data/features/new_entry.feature +23 -0
- data/features/step_definitions/new_entry.steps.rb +41 -0
- data/lib/nikki/version.rb +3 -0
- data/lib/nikki.rb +52 -0
- data/nikki.gemspec +26 -0
- data/test/tc_nikki.rb +14 -0
- metadata +117 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 44304d85497a945b10d26b403c1ffde95cd529b4
|
4
|
+
data.tar.gz: e1666230471fd50b243da107cee48a7351c39b79
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1de9407ab295181a8a958e0c22db022cb117de70d67ec5371874078fb3c37a1ccc79ed8f8176c980c26492ddc15a93139aad8892e34d4d1d4e2838844e608b86
|
7
|
+
data.tar.gz: 64825596f66e99613f4d9c08e6a76b6b93463b72a8e2703b56c52063b3603bc93f0edacaf61e8d0a6cdc61ceb94eb448395550f6c663968ad48f738e25115b31
|
data/.gitignore
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
<<<<<<< HEAD
|
2
|
+
*.gem
|
3
|
+
*.rbc
|
4
|
+
.bundle
|
5
|
+
.config
|
6
|
+
.yardoc
|
7
|
+
Gemfile.lock
|
8
|
+
InstalledFiles
|
9
|
+
_yardoc
|
10
|
+
coverage
|
11
|
+
doc/
|
12
|
+
lib/bundler/man
|
13
|
+
pkg
|
14
|
+
rdoc
|
15
|
+
spec/reports
|
16
|
+
test/tmp
|
17
|
+
test/version_tmp
|
18
|
+
tmp
|
19
|
+
=======
|
20
|
+
.codekit
|
21
|
+
>>>>>>> f81665bccd16c1a42bab86632a3bf9fd4d080625
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 brandonpittman
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Brandon Pittman
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# nikki
|
2
|
+
|
3
|
+
> "Record something new learned every day of the year."
|
4
|
+
|
5
|
+
### Track newly learned things
|
6
|
+
|
7
|
+
In Japanese, "nikki" means "daily journal". The idea behind *nikki* is to record one thing you learned today. If all goes well, you've got a 365 line journal formatted in Markdown and ready to be posted to your blog on January 1st next year. The months are H1's and every day in the month is part of an ordered list. The journal file is saved at `~/.nikki_#{year}.md`.
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
gem 'nikki'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install nikki
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
- nikki help [COMMAND] # Describe available commands or one specific command
|
26
|
+
- nikki new ENTRY # Creates a new entry in the Nikki journal.
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
|
30
|
+
1. Fork it ( http://github.com/<my-github-username>/nikki/fork )
|
31
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
32
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
33
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
34
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
require 'cucumber'
|
4
|
+
require 'cucumber/rake/task'
|
5
|
+
|
6
|
+
Rake::TestTask.new do |t|
|
7
|
+
t.libs << 'test'
|
8
|
+
t.test_files = FileList['test/*.rb']
|
9
|
+
end
|
10
|
+
|
11
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
12
|
+
t.cucumber_opts = "features --format pretty"
|
13
|
+
end
|
14
|
+
|
15
|
+
task(default: :test)
|
data/bin/nikki
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Feature: Add a new entry to the journal
|
2
|
+
|
3
|
+
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.
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I have a journal entry to make
|
7
|
+
|
8
|
+
Scenario: I haven't created a journal file
|
9
|
+
When I try to save my entry
|
10
|
+
And the journal file can't be found
|
11
|
+
Then a file should be created
|
12
|
+
And my journal entry saved
|
13
|
+
|
14
|
+
Scenario: I have a journal file and it's the first of the month
|
15
|
+
When I try to save my entry
|
16
|
+
And it's the first of the month
|
17
|
+
Then the name of the month as an H1 header should be appended
|
18
|
+
And and my entry should be saved
|
19
|
+
|
20
|
+
Scenario: I have a journal file and it's *not* the first of the month
|
21
|
+
When I try to save my entry
|
22
|
+
And it's not the first of the month
|
23
|
+
Then my entry should be appended along with the day of the month
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Given(/^I have a (.+) to make$/) do |arg|
|
2
|
+
@text = arg
|
3
|
+
@file = "#{ENV['HOME']}/.nikki_#{Time.now.strftime("%Y")}"
|
4
|
+
end
|
5
|
+
|
6
|
+
When(/^I try to (save) my entry$/) do |arg|
|
7
|
+
arg == "save"
|
8
|
+
end
|
9
|
+
|
10
|
+
When(/^the journal file can't be found$/) do
|
11
|
+
FileUtils.rm(@file) if File.exist?(@file)
|
12
|
+
end
|
13
|
+
|
14
|
+
Then(/^a file should be created$/) do
|
15
|
+
FileUtils.touch(@file)
|
16
|
+
end
|
17
|
+
|
18
|
+
Then(/^(my journal entry) saved$/) do |arg|
|
19
|
+
@entry = arg
|
20
|
+
File.open(@file,"a") { |f| f.puts "#{Time.now.strftime("%d")}. #{arg}" }
|
21
|
+
end
|
22
|
+
|
23
|
+
When(/^it's the first of the month$/) do
|
24
|
+
@date = Date.new(2014,2,1)
|
25
|
+
end
|
26
|
+
|
27
|
+
Then(/^the name of the month as an H1 header should be appended$/) do
|
28
|
+
File.open(@file, "a") { |file| file.puts "#{@date.strftime("%B")}" }
|
29
|
+
end
|
30
|
+
|
31
|
+
Then(/^and my (entry) should be saved$/) do |arg|
|
32
|
+
File.open(@file, "a") { |file| file.puts "#{@date.strftime("%d").strip} #{arg}" }
|
33
|
+
end
|
34
|
+
|
35
|
+
When(/^it's not the first of the month$/) do
|
36
|
+
@date = Date.new(2014,2,2)
|
37
|
+
end
|
38
|
+
|
39
|
+
Then(/^my (entry) should be appended along with the day of the month$/) do |arg|
|
40
|
+
File.open(@file, "a") { |file| file.puts "#{@date.strftime("%d").strip} #{arg}" }
|
41
|
+
end
|
data/lib/nikki.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'thor'
|
2
|
+
require "pathname"
|
3
|
+
|
4
|
+
module Nikki
|
5
|
+
class Generator < Thor
|
6
|
+
|
7
|
+
desc "new ENTRY", "Creates a new entry in the Nikki journal."
|
8
|
+
def new(entry)
|
9
|
+
file.open('a') { |file| file.puts text(entry)}
|
10
|
+
end
|
11
|
+
|
12
|
+
no_commands do
|
13
|
+
def file
|
14
|
+
Pathname.new("#{ENV['HOME']}/.nikki_#{Time.now.strftime("%Y")}.md")
|
15
|
+
end
|
16
|
+
|
17
|
+
def file_exist?
|
18
|
+
if file.exist?
|
19
|
+
return true
|
20
|
+
else
|
21
|
+
create_file
|
22
|
+
return true
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_file
|
27
|
+
FileUtils.touch(file)
|
28
|
+
end
|
29
|
+
|
30
|
+
def first_of_month?
|
31
|
+
Time.now.strftime("%d") == "1"
|
32
|
+
end
|
33
|
+
|
34
|
+
def date
|
35
|
+
Time.now.strftime("%d")
|
36
|
+
end
|
37
|
+
|
38
|
+
def month
|
39
|
+
Time.now.strftime("%B")
|
40
|
+
end
|
41
|
+
|
42
|
+
def text(entry)
|
43
|
+
if first_of_month?
|
44
|
+
"## #{month}\n\n#{date}. #{entry}"
|
45
|
+
else
|
46
|
+
"#{date}. #{entry}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
data/nikki.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'nikki/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "nikki"
|
8
|
+
spec.version = Nikki::VERSION
|
9
|
+
spec.authors = ["Brandon Pittman"]
|
10
|
+
spec.email = ["brandonpittman@gmail.com"]
|
11
|
+
spec.summary = %q{A simple one-line-a-day journaling app.}
|
12
|
+
spec.description = %q{A simple one-line-a-day journaling app.}
|
13
|
+
spec.homepage = "http://github.com/brandonpittman/nikki"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.executables = ['nikki']
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "thor", "~> 0.18"
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "cucumber"
|
26
|
+
end
|
data/test/tc_nikki.rb
ADDED
metadata
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nikki
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brandon Pittman
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.18'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.18'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: cucumber
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: A simple one-line-a-day journaling app.
|
70
|
+
email:
|
71
|
+
- brandonpittman@gmail.com
|
72
|
+
executables:
|
73
|
+
- nikki
|
74
|
+
extensions: []
|
75
|
+
extra_rdoc_files: []
|
76
|
+
files:
|
77
|
+
- ".gitignore"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- LICENSE.txt
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/nikki
|
84
|
+
- features/new_entry.feature
|
85
|
+
- features/step_definitions/new_entry.steps.rb
|
86
|
+
- lib/nikki.rb
|
87
|
+
- lib/nikki/version.rb
|
88
|
+
- nikki.gemspec
|
89
|
+
- test/tc_nikki.rb
|
90
|
+
homepage: http://github.com/brandonpittman/nikki
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.2.2
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: A simple one-line-a-day journaling app.
|
114
|
+
test_files:
|
115
|
+
- features/new_entry.feature
|
116
|
+
- features/step_definitions/new_entry.steps.rb
|
117
|
+
- test/tc_nikki.rb
|