jrn 0.1.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 +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +5 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +30 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/jrn +5 -0
- data/bin/setup +8 -0
- data/jrn.gemspec +35 -0
- data/lib/jrn.rb +16 -0
- data/lib/jrn/day.rb +39 -0
- data/lib/jrn/setup.rb +18 -0
- data/lib/jrn/version.rb +3 -0
- metadata +102 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 58bf8bface5bde9807a8eae54b44e6c4073434b1500aaa609bd332a6fe858206
|
4
|
+
data.tar.gz: 50d35df9b137c1781d67f3d878ff3487bd6cf3e149c061da24f671993bf04e87
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6d995419e7bb572c31a121b1e472bdf3891e66218716b6fdc51d99ca894a7833703bd1bd7d1ebee526609cdc93eb9c25f2236400ecd5b47a5b6b0179d5365f0c
|
7
|
+
data.tar.gz: 0e98b26a1ad8d97df9f90e92038ac108c22e592a8a1f91e4aa9792e4115296be1ce56856901aa6c4fb40aa268ad6e24755b322e35e6e3f4acb4dac619c391bfe
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Ryan O'Neill
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Jrn
|
2
|
+
|
3
|
+
Jrn is a journaling tool for the command line.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem install 'jrn'
|
9
|
+
```
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Run from command line:
|
14
|
+
```
|
15
|
+
> jrn
|
16
|
+
```
|
17
|
+
|
18
|
+
and start journaling
|
19
|
+
|
20
|
+
## Development
|
21
|
+
|
22
|
+
It's a pretty basic gem.
|
23
|
+
|
24
|
+
## Contributing
|
25
|
+
|
26
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rynonl/jrn.
|
27
|
+
|
28
|
+
## License
|
29
|
+
|
30
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "jrn"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/jrn
ADDED
data/bin/setup
ADDED
data/jrn.gemspec
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "jrn/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "jrn"
|
8
|
+
spec.version = Jrn::VERSION
|
9
|
+
spec.authors = ["Ryan O'Neill"]
|
10
|
+
spec.email = ["rco8786@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Jrn}
|
13
|
+
spec.description = %q{Jrn every day}
|
14
|
+
spec.homepage = "https://github.com/rynonl/jrn"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
|
+
|
26
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
|
+
f.match(%r{^(test|spec|features)/})
|
28
|
+
end
|
29
|
+
spec.executables = ["jrn"]
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
end
|
data/lib/jrn.rb
ADDED
data/lib/jrn/day.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'os'
|
2
|
+
require 'time'
|
3
|
+
|
4
|
+
module Jrn
|
5
|
+
Day = Struct.new(:date) do
|
6
|
+
def start
|
7
|
+
user_dir = Etc.getpwuid.dir
|
8
|
+
jrn_dir = "#{user_dir}/.jrn/"
|
9
|
+
day_file = "#{jrn_dir}/#{date}.md"
|
10
|
+
|
11
|
+
is_new_day = !File.exist?(day_file)
|
12
|
+
|
13
|
+
if is_new_day
|
14
|
+
# Start new day from template
|
15
|
+
File.open(day_file, 'w') do |file|
|
16
|
+
file << "####{date}###\n"
|
17
|
+
file << "\n"
|
18
|
+
file << "#{Time.now.strftime("%I:%M%p")}\n"
|
19
|
+
file << "*\s\s"
|
20
|
+
end
|
21
|
+
else
|
22
|
+
# Start new line prompt if needed
|
23
|
+
lines = File.read(day_file).split
|
24
|
+
|
25
|
+
if lines.last != "*\s\s"
|
26
|
+
File.open(day_file, 'a') do |file|
|
27
|
+
file << "\n"
|
28
|
+
file << "#{Time.now.strftime("%I:%M%p")}\n"
|
29
|
+
file << "*\s\s"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
system("/usr/local/bin/vim \"+ normal G$\" +startinsert #{day_file}")
|
35
|
+
|
36
|
+
# Backup here
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/jrn/setup.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'etc'
|
2
|
+
|
3
|
+
module Jrn
|
4
|
+
Setup = Struct.new(:_) do
|
5
|
+
def start
|
6
|
+
user_dir = Etc.getpwuid.dir
|
7
|
+
jrn_dir = "#{user_dir}/.jrn/"
|
8
|
+
config_file = "#{jrn_dir}/.config"
|
9
|
+
|
10
|
+
unless File.directory?(jrn_dir)
|
11
|
+
puts "Jrn is running for the first time"
|
12
|
+
|
13
|
+
Dir.mkdir(jrn_dir)
|
14
|
+
File.open(config_file, 'w') { |f| f.write('# jrn') }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/jrn/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jrn
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan O'Neill
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.16'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.16'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Jrn every day
|
56
|
+
email:
|
57
|
+
- rco8786@gmail.com
|
58
|
+
executables:
|
59
|
+
- jrn
|
60
|
+
extensions: []
|
61
|
+
extra_rdoc_files: []
|
62
|
+
files:
|
63
|
+
- ".gitignore"
|
64
|
+
- ".rspec"
|
65
|
+
- ".travis.yml"
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/jrn
|
72
|
+
- bin/setup
|
73
|
+
- jrn.gemspec
|
74
|
+
- lib/jrn.rb
|
75
|
+
- lib/jrn/day.rb
|
76
|
+
- lib/jrn/setup.rb
|
77
|
+
- lib/jrn/version.rb
|
78
|
+
homepage: https://github.com/rynonl/jrn
|
79
|
+
licenses:
|
80
|
+
- MIT
|
81
|
+
metadata:
|
82
|
+
allowed_push_host: https://rubygems.org
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubygems_version: 3.0.3
|
99
|
+
signing_key:
|
100
|
+
specification_version: 4
|
101
|
+
summary: Jrn
|
102
|
+
test_files: []
|