jekylljournal 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +13 -0
- data/bin/jekylljournal +2 -2
- data/jekylljournal.gemspec +3 -0
- data/lib/jekylljournal/journalhandler.rb +49 -48
- data/lib/jekylljournal/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fc6ad9978910357a144f88b586328c42aa91174
|
4
|
+
data.tar.gz: d50615a74fae909730492dda69f0d8e155f4c54a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a5f5b91d1a018f411e8a6fe3e4f31522a83b98812b5495bece38ca8df698d101f2f31598f0fee46fc995e680c141dc847a6abf75febc2e695345ff0102eaa0b
|
7
|
+
data.tar.gz: 6a224e4f131a63f8ef16390ec6f2103fcf047dd0432b2fa8e99195975a3e9e1fa0e60b31119953c799c8f083fc64abaad918b6f71a113c5e33df0acc43c7b1ea
|
data/README.rdoc
CHANGED
@@ -22,11 +22,24 @@ below.
|
|
22
22
|
|
23
23
|
:blog_location: /path/to/your/jekyll/blog/root
|
24
24
|
|
25
|
+
== Custom Alias
|
26
|
+
|
27
|
+
It's super handy to map an alias to this app. My configuration just uses
|
28
|
+
`j` to open up my daily journal. Pretty slick, if I do say so myself.
|
29
|
+
Which I do.
|
30
|
+
|
31
|
+
Here's what's in my `.zshrc` file:
|
32
|
+
|
33
|
+
alias j="jekylljournal"
|
34
|
+
|
25
35
|
== Project Links
|
26
36
|
|
27
37
|
Gem on Rubygems:
|
28
38
|
https://rubygems.org/gems/jekylljournal
|
29
39
|
|
40
|
+
Bug tracking on Github:
|
41
|
+
https://github.com/lorentrogers/jekylljournal/issues
|
42
|
+
|
30
43
|
Source on Github:
|
31
44
|
https://github.com/lorentrogers/jekylljournal
|
32
45
|
|
data/bin/jekylljournal
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
require 'gli'
|
3
3
|
require 'yaml'
|
4
4
|
require 'date'
|
5
|
-
require '
|
5
|
+
require 'jekylljournal'
|
6
6
|
|
7
7
|
include GLI::App
|
8
8
|
|
@@ -34,7 +34,7 @@ pre do |global,command,options,args|
|
|
34
34
|
# chosen command
|
35
35
|
# Use skips_pre before a command to skip this block
|
36
36
|
# on that command only
|
37
|
-
@journal_handler = Journalhandler.new
|
37
|
+
@journal_handler = Jekylljournal::Journalhandler.new
|
38
38
|
return false unless @journal_handler
|
39
39
|
true
|
40
40
|
end
|
data/jekylljournal.gemspec
CHANGED
@@ -9,9 +9,11 @@ spec = Gem::Specification.new do |s|
|
|
9
9
|
s.platform = Gem::Platform::RUBY
|
10
10
|
s.summary = 'A super awesome way of writing daily blog posts with Jekyll.'
|
11
11
|
s.license = 'GPL-3.0'
|
12
|
+
s.required_ruby_version = '>= 2.2.0'
|
12
13
|
s.files = `git ls-files`.split("
|
13
14
|
")
|
14
15
|
s.require_paths << 'lib'
|
16
|
+
s.require_paths << 'lib/jekylljournal'
|
15
17
|
s.has_rdoc = true
|
16
18
|
s.extra_rdoc_files = ['README.rdoc','jekylljournal.rdoc']
|
17
19
|
s.rdoc_options << '--title' << 'jekylljournal' << '--main' << 'README.rdoc' << '-ri'
|
@@ -20,5 +22,6 @@ spec = Gem::Specification.new do |s|
|
|
20
22
|
s.add_development_dependency('rake')
|
21
23
|
s.add_development_dependency('rdoc')
|
22
24
|
s.add_development_dependency('aruba')
|
25
|
+
s.add_development_dependency('jekylljournal')
|
23
26
|
s.add_runtime_dependency('gli','2.13.4')
|
24
27
|
end
|
@@ -1,34 +1,34 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
|
1
|
+
module Jekylljournal
|
2
|
+
# This class is used to handle Jekyll Journals.
|
3
|
+
# It is generally called from the command line wrapper.
|
4
|
+
class Journalhandler
|
5
|
+
# Loads the config dotfile from the default directory and sets the
|
6
|
+
# application options
|
7
|
+
def initialize
|
8
|
+
@options = { }
|
4
9
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
if !config_options
|
14
|
-
puts 'Config file empty, please see the readme.'
|
10
|
+
config_file = File.join(ENV['HOME'],'.jekylljournal.yaml')
|
11
|
+
if File.exists? config_file
|
12
|
+
config_options = YAML.load_file(config_file)
|
13
|
+
if !config_options
|
14
|
+
puts 'Config file empty, please see the readme.'
|
15
|
+
else
|
16
|
+
@options.merge!(config_options)
|
17
|
+
end
|
15
18
|
else
|
16
|
-
|
19
|
+
puts 'Config file not found, please create one.'
|
17
20
|
end
|
18
|
-
else
|
19
|
-
puts 'Config file not found, please create one.'
|
20
21
|
end
|
21
|
-
end
|
22
22
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
23
|
+
# Opens today's post if it exists, otherwise
|
24
|
+
# it creates a new post, populates it with
|
25
|
+
# the default yaml frontmatter, then opens
|
26
|
+
# this newly created file.
|
27
|
+
def open
|
28
|
+
today = Date.today.strftime '%Y-%m-%d'
|
29
|
+
file_name = "#{@options[:blog_location]}/_posts/#{today}-#{today}.md"
|
30
|
+
# create the file if it doesn't exist
|
31
|
+
frontmatter = <<eol
|
32
32
|
---
|
33
33
|
layout: post
|
34
34
|
title: #{today}
|
@@ -36,31 +36,32 @@ title: #{today}
|
|
36
36
|
|
37
37
|
eol
|
38
38
|
|
39
|
-
|
39
|
+
File.write file_name, frontmatter unless File.file? file_name
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
puts "Opening #{file_name}"
|
42
|
+
system 'vim', file_name
|
43
|
+
end
|
44
44
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
45
|
+
# Adds and commits all new posts and assets to git, then
|
46
|
+
# pushes to the default repositories.
|
47
|
+
# TODO
|
48
|
+
def save
|
49
|
+
puts 'Saving...'
|
50
|
+
run_git_cmd 'add _posts/*'
|
51
|
+
run_git_cmd 'add assets/*'
|
52
|
+
# TODO: this should use more flexible values.
|
53
|
+
# Date format should be a dotfile option
|
54
|
+
# Message format should be a dotfile option
|
55
|
+
run_git_cmd "commit -m \"Save: #{Date.today.strftime '%Y-%m-%d'}\""
|
56
|
+
run_git_cmd 'push'
|
57
|
+
puts 'done.'
|
58
|
+
end
|
59
59
|
|
60
|
-
|
60
|
+
private
|
61
61
|
|
62
|
-
|
63
|
-
|
64
|
-
|
62
|
+
def run_git_cmd cmd
|
63
|
+
location = @options[:blog_location]
|
64
|
+
`git --git-dir=#{location}/.git --work-tree=#{location} #{cmd}`
|
65
|
+
end
|
65
66
|
end
|
66
67
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekylljournal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Rogers
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: jekylljournal
|
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'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: gli
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,11 +124,12 @@ rdoc_options:
|
|
110
124
|
require_paths:
|
111
125
|
- lib
|
112
126
|
- lib
|
127
|
+
- lib/jekylljournal
|
113
128
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
129
|
requirements:
|
115
130
|
- - ">="
|
116
131
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
132
|
+
version: 2.2.0
|
118
133
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
134
|
requirements:
|
120
135
|
- - ">="
|