zine 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: db5b30774a28f16583540f93a394e24f5d34ae96
4
- data.tar.gz: a2330b92a0df349f884af0dc46832f350440a50e
3
+ metadata.gz: 1d0c74eb3ad2448eca853a98779f43fc8536e39e
4
+ data.tar.gz: 5bfbce5f7b26a6289aba3b652b4c13c32e7d1c9a
5
5
  SHA512:
6
- metadata.gz: b1c8600ac22c3e08796fb98f5d5804bee2467254240849a1015a8ead613cbef10d110a726d665ac44a9f14a25683bf94830e130afa2c9af835b0f67c395d3c9e
7
- data.tar.gz: ab65b753769cca93a4fde746ac14c1bc347daadb055ec8bca7e34751c4e244437f1975d93a346dbd5472bf01ae13d616a710a0bb994e2fb48354c2fb21e6154d
6
+ metadata.gz: 2316b8ac4c8c8dd10fb6761ec77de852dda18dcced1d5b3ef0862ef2e01446ee04b65e32583e5e0495a43f22674ac278a8c4e1f776ab8f565fdbefd347bfecc2
7
+ data.tar.gz: d63c8be31dc262b119bb536999c6ccfc3f0a85b3008c72ede9d873625c1495ebb210062df521e66f2b65c9ca27987edf6937441650cf79e5a3dabb7ebe5efb5e
@@ -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
@@ -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
- # give the file watchers something to notice
91
- file_to_notice = File.join Dir.getwd,
92
- @options['directories']['posts'],
93
- file
94
- posts.one_new_post file_to_notice
95
- sleep 0.25
96
- posts.one_new_post file_to_notice # overcome latency in the watcher...
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)
@@ -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
- option_dir = @the_site.options['directories']
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 = @the_site.options['templates']['new_post']
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 = File.join File.dirname(__FILE__), 'skeleton', '/.'
71
- FileUtils.cp_r @skeleton_dir, Dir.pwd
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
 
@@ -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
- attr_reader :dest_path, :formatted_data, :source_file, :template_bundle
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 one_new_post(source_file)
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(source_file,
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
- # TODO: may need to reorder posts by date, and therefor redo tags
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
@@ -3,7 +3,6 @@ require 'rainbow'
3
3
  require 'rack'
4
4
  require 'thin'
5
5
  require 'zine/upload'
6
- require 'zine/watcher'
7
6
 
8
7
  module Zine
9
8
  # Local preview web server
@@ -1,4 +1,4 @@
1
1
  module Zine
2
2
  # The version
3
- VERSION = '0.8.0'.freeze
3
+ VERSION = '0.9.0'.freeze
4
4
  end
@@ -16,6 +16,10 @@ module Zine
16
16
  @listener_array = []
17
17
  end
18
18
 
19
+ def notice(file_name)
20
+ @upload_array << file_name
21
+ end
22
+
19
23
  # Build a delete list & an upload list for SSH from changes in build,
20
24
  # & rebuild & reload on changes in source
21
25
  def start
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.8.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: 2017-10-01 00:00:00.000000000 Z
11
+ date: 2018-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler