zine 0.8.0 → 0.9.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/CHANGELOG.md +5 -0
- data/lib/zine.rb +8 -7
- data/lib/zine/cli.rb +6 -4
- data/lib/zine/page.rb +3 -1
- data/lib/zine/posts_and_headlines.rb +15 -4
- data/lib/zine/server.rb +0 -1
- data/lib/zine/version.rb +1 -1
- data/lib/zine/watcher.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d0c74eb3ad2448eca853a98779f43fc8536e39e
|
4
|
+
data.tar.gz: 5bfbce5f7b26a6289aba3b652b4c13c32e7d1c9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2316b8ac4c8c8dd10fb6761ec77de852dda18dcced1d5b3ef0862ef2e01446ee04b65e32583e5e0495a43f22674ac278a8c4e1f776ab8f565fdbefd347bfecc2
|
7
|
+
data.tar.gz: d63c8be31dc262b119bb536999c6ccfc3f0a85b3008c72ede9d873625c1495ebb210062df521e66f2b65c9ca27987edf6937441650cf79e5a3dabb7ebe5efb5e
|
data/CHANGELOG.md
CHANGED
@@ -112,3 +112,8 @@
|
|
112
112
|
|
113
113
|
- SFTP upload error wasn't caught in 0.7.0... TODO
|
114
114
|
- added a notice command, zine notice [FILE], which adds that file to the build queue without having to force a general build, so zine can be called in scripts to upload particular files (a rake script in Ripley, specifically)
|
115
|
+
|
116
|
+
# 0.9.0, January 1, 2018
|
117
|
+
|
118
|
+
- a bug in 'zine notice' involving full & partial paths that duplicated the post to notice on the history page, fixed
|
119
|
+
- minor code clean-up in cli.rb and server.rb
|
data/lib/zine.rb
CHANGED
@@ -78,6 +78,7 @@ module Zine
|
|
78
78
|
|
79
79
|
# Build the site, noticing this file as having changed
|
80
80
|
# Called by CLI#notice
|
81
|
+
# TODO: common function call across other methods
|
81
82
|
def notice(file)
|
82
83
|
# build
|
83
84
|
init_templates
|
@@ -87,13 +88,13 @@ module Zine
|
|
87
88
|
posts_and_guard = posts.writeless
|
88
89
|
guard = posts_and_guard[:guard]
|
89
90
|
|
90
|
-
#
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
91
|
+
# build the file & add it to the upload array
|
92
|
+
posts_dir = @options['directories']['posts']
|
93
|
+
file_to_notice = File.join posts_dir, file
|
94
|
+
path_to_notice = File.join Dir.getwd, file_to_notice
|
95
|
+
|
96
|
+
dest_path = posts.one_new_post file_to_notice, path_to_notice
|
97
|
+
guard.notice(dest_path)
|
97
98
|
|
98
99
|
# TODO: everywhere
|
99
100
|
guard.listener_array.each(&:stop)
|
data/lib/zine/cli.rb
CHANGED
@@ -55,20 +55,22 @@ module Zine
|
|
55
55
|
desc 'post TITLE', 'Create the file for a new blog post, titled TITLE'
|
56
56
|
def post(name)
|
57
57
|
init_site
|
58
|
-
|
58
|
+
options = @the_site.options
|
59
|
+
option_dir = options['directories']
|
59
60
|
Zine::CLI.source_root option_dir['templates']
|
60
61
|
@date = DateTime.now
|
61
62
|
@name = name
|
62
63
|
file = "#{@date.strftime('%Y-%m-%d')}-#{Zine::Page.slug(name)}.md"
|
63
|
-
new_post_name =
|
64
|
+
new_post_name = options['templates']['new_post']
|
64
65
|
template new_post_name,
|
65
66
|
File.join(Dir.pwd, option_dir['posts'], file)
|
66
67
|
end
|
67
68
|
|
68
69
|
desc 'site', 'Create the skeleton of a new site (overwriting files)'
|
69
70
|
def site
|
70
|
-
@skeleton_dir
|
71
|
-
|
71
|
+
# @skeleton_dir ?
|
72
|
+
skeleton_dir = File.join File.dirname(__FILE__), 'skeleton', '/.'
|
73
|
+
FileUtils.cp_r skeleton_dir, Dir.pwd
|
72
74
|
puts Rainbow('New skeleton site created').green
|
73
75
|
end
|
74
76
|
|
data/lib/zine/page.rb
CHANGED
@@ -12,7 +12,9 @@ module Zine
|
|
12
12
|
# A page on the site where the content comes from a file's markdown, and the
|
13
13
|
# destination's location mirrors its own
|
14
14
|
class Page
|
15
|
-
|
15
|
+
attr_accessor :source_file # used in zine notice --
|
16
|
+
# PostsAndHeadlines.one_new_post
|
17
|
+
attr_reader :dest_path, :formatted_data, :template_bundle
|
16
18
|
# the meta data, passed formatted to the template
|
17
19
|
class FormattedData
|
18
20
|
include ERB::Util
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'zine/data_page'
|
2
2
|
require 'zine/post'
|
3
3
|
require 'zine/tag'
|
4
|
+
require 'zine/watcher'
|
4
5
|
|
5
6
|
module Zine
|
6
7
|
# The blog posts and their associate headline files (the home page, an
|
@@ -42,14 +43,24 @@ module Zine
|
|
42
43
|
template_name: templates['rss'], title: '' }]
|
43
44
|
end
|
44
45
|
|
45
|
-
def
|
46
|
+
def once_only(source_file)
|
47
|
+
@post_array = @post_array.delete_if do |post|
|
48
|
+
post.source_file == source_file
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def one_new_post(source_file, source_full_path)
|
53
|
+
once_only(source_file)
|
46
54
|
post_name = @options['templates']['post']
|
47
|
-
@post_array << Zine::Post.new(
|
55
|
+
@post_array << Zine::Post.new(source_full_path,
|
48
56
|
@site.make_template_bundle(post_name),
|
49
57
|
@options)
|
58
|
+
@post_array.last.source_file = source_file # TODO: path when this's frozen
|
50
59
|
@tags_by_post << @post_array.last.process(File)
|
51
|
-
|
60
|
+
dest_path = @post_array.last.dest_path
|
61
|
+
sort_posts_by_date
|
52
62
|
write_tags_and_headlines
|
63
|
+
dest_path
|
53
64
|
end
|
54
65
|
|
55
66
|
# get build file from post or location, delete build, remove form post_array
|
@@ -121,8 +132,8 @@ module Zine
|
|
121
132
|
@post_array[index] = Zine::Post.new post.source_file,
|
122
133
|
post.template_bundle, @options
|
123
134
|
@tags_by_post[index] = @post_array[index].process File
|
135
|
+
sort_posts_by_date
|
124
136
|
write_tags_and_headlines
|
125
|
-
# TODO: may need to reorder posts by date... means re-doing tags
|
126
137
|
end
|
127
138
|
|
128
139
|
# Read markdown files in the posts folder into an array of Posts
|
data/lib/zine/server.rb
CHANGED
data/lib/zine/version.rb
CHANGED
data/lib/zine/watcher.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Kreuzer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|