zine 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +258 -0
- data/lib/zine.rb +84 -50
- data/lib/zine/cli.rb +15 -8
- data/lib/zine/page.rb +34 -30
- data/lib/zine/post.rb +15 -12
- data/lib/zine/posts_and_headlines.rb +4 -4
- data/lib/zine/server.rb +45 -44
- data/lib/zine/skeleton/source/screen.css +1 -1
- data/lib/zine/skeleton/source/styles/screen.scss +6 -4
- data/lib/zine/skeleton/source/templates/header_partial.erb +4 -4
- data/lib/zine/skeleton/source/templates/home.erb +2 -2
- data/lib/zine/skeleton/source/templates/post.erb +1 -1
- data/lib/zine/skeleton/source/templates/tag_index.erb +1 -1
- data/lib/zine/skeleton/zine.yaml +3 -4
- data/lib/zine/style.rb +2 -2
- data/lib/zine/upload.rb +34 -104
- data/lib/zine/uploader_github.rb +85 -0
- data/lib/zine/uploader_sftp.rb +137 -0
- data/lib/zine/version.rb +2 -1
- metadata +37 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b288c0de3e56f4d866463af9d47a7297c324f17
|
4
|
+
data.tar.gz: '09a5e9eade1683838fbdea5ca5e0a0f72503e5c2'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1212ef35301f8cda64e1af9ad1b743e21a97ead47fb4e2b980446d13ca7dab579bd99cc7305744e8e9f4bfb241983188b26d4486c6b3146a976826f07b88b5a1
|
7
|
+
data.tar.gz: 937adc8a6c6930d10daa8113f386f6fa5ce8683b40e0655b151cb9e48e9ebca60434d5a59bc2b300d9987b73eba46b3765341da794d49f2c9a39fe496bb6394d
|
data/CHANGELOG.md
CHANGED
@@ -491,3 +491,261 @@ Fixed the bug in file uploads by using .uniq on an array of hashes (which I'd pl
|
|
491
491
|
1. [Repo](https://github.com/mikekreuzer/zine)
|
492
492
|
2. [Gem](https://rubygems.org/gems/zine)
|
493
493
|
3. [Blog](https://mikekreuzer.com)
|
494
|
+
4. [Tweet](https://twitter.com/mikekreuzer/status/833658907054583809)
|
495
|
+
|
496
|
+
### Day 29: February 21, 2017
|
497
|
+
|
498
|
+
**Today's Progress**:
|
499
|
+
|
500
|
+
- deleted the stock post & about files I uploaded to my blog by mistake (hmm)
|
501
|
+
- updated dependencies: Rake & Simplecov
|
502
|
+
- refactored Zine::Site#housekeeping_copy
|
503
|
+
- started chipping away at RDoc, and making some methods private
|
504
|
+
- started to get back into writing tests again
|
505
|
+
|
506
|
+
|
507
|
+
**Thoughts:**
|
508
|
+
|
509
|
+
Need to need make the stock files more obvious, or maybe have an upgrade option, not sure where to draw the line on that... everything but the initial post & the about file? Tests. Finally.
|
510
|
+
|
511
|
+
**Links to work**
|
512
|
+
|
513
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
514
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/834021891383767040)
|
515
|
+
|
516
|
+
### Took the night off: February 22, 2017
|
517
|
+
|
518
|
+
### Day 30: February 23, 2017
|
519
|
+
|
520
|
+
**Today's Progress**:
|
521
|
+
|
522
|
+
- rebased a pull request for BennyHallett/elixir-rss
|
523
|
+
- Page tests
|
524
|
+
|
525
|
+
**Thoughts:**
|
526
|
+
|
527
|
+
Needed a break last night, back into it.
|
528
|
+
|
529
|
+
**Links to work**
|
530
|
+
|
531
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
532
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/834740235460177920)
|
533
|
+
|
534
|
+
### Day 31: February 24, 2017
|
535
|
+
|
536
|
+
**Today's Progress**:
|
537
|
+
|
538
|
+
- trawling through set_trace_func call logs
|
539
|
+
|
540
|
+
**Thoughts:**
|
541
|
+
|
542
|
+
Looking at execution paths, to make sure they are what I think they are.
|
543
|
+
|
544
|
+
**Links to work**
|
545
|
+
|
546
|
+
1. [Tweet](https://twitter.com/mikekreuzer/status/835110622794661889)
|
547
|
+
|
548
|
+
### Day 32: February 25, 2017
|
549
|
+
|
550
|
+
**Today's Progress**:
|
551
|
+
|
552
|
+
- cleaned up Server, setting headers properly
|
553
|
+
- added curb as a development dependency, started on Server tests with tests of those headers
|
554
|
+
- then back in on page tests... some more refactoring required
|
555
|
+
|
556
|
+
**Thoughts:**
|
557
|
+
|
558
|
+
Testing times. :-)
|
559
|
+
|
560
|
+
**Links to work**
|
561
|
+
|
562
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
563
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/835471172967944192)
|
564
|
+
|
565
|
+
### Day 33: February 26, 2017
|
566
|
+
|
567
|
+
**Today's Progress**:
|
568
|
+
|
569
|
+
- added what I thought would've been the default filter to Simplecov (excluding the spec directory)
|
570
|
+
- injecting File into the file writing methods, to make testable versions
|
571
|
+
- rewrote some Page and Server tests
|
572
|
+
|
573
|
+
**Thoughts:**
|
574
|
+
|
575
|
+
Been thinking about my next project while playing around with the tests. Had originally imagined maybe three or four projects, but it seems it'll be more like two, maybe three now. I have at least a week or maybe two of writing tests till I'm willing to slow down on those, having only just started, & a project of a similar size to Zine in mind for my next gig.
|
576
|
+
|
577
|
+
**Links to work**
|
578
|
+
|
579
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
580
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/835809220020707329)
|
581
|
+
|
582
|
+
### Day 34: February 27, 2017
|
583
|
+
|
584
|
+
**Today's Progress**:
|
585
|
+
|
586
|
+
- minor doc work
|
587
|
+
|
588
|
+
**Thoughts:**
|
589
|
+
|
590
|
+
Toyed with using Apple's news format... but RSS seems to work fine. Almost a night off. Almost.
|
591
|
+
|
592
|
+
**Links to work**
|
593
|
+
|
594
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
595
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/836196422722580480)
|
596
|
+
|
597
|
+
### Day 35: February 28, 2017
|
598
|
+
|
599
|
+
**Today's Progress**:
|
600
|
+
|
601
|
+
- more tests (Style and some more of CLI)
|
602
|
+
|
603
|
+
**Thoughts:**
|
604
|
+
|
605
|
+
43.8% covered, supposedly. Realistically there are ten substantive classes, one of which (PostsAndHeadlines) will act as an integration test, and I've written some tests for three... so somewhere around the 33% mark is probably closer to it. Happy with that rate of progress. My memory of rspec's mocking syntax especially is very shaky, but fixing that is what this is all about.
|
606
|
+
|
607
|
+
**Links to work**
|
608
|
+
|
609
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
610
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/836554681690181632)
|
611
|
+
|
612
|
+
### Day 36: March 1, 2017
|
613
|
+
|
614
|
+
**Today's Progress**:
|
615
|
+
|
616
|
+
- Ripley for March
|
617
|
+
- started playing around with GitHub uploads
|
618
|
+
|
619
|
+
**Thoughts:**
|
620
|
+
|
621
|
+
Snuck Ripley in in my first session (the 'only just AM', 'is that the time' session)... Had hoped to be using Zine for the Ripley site for March; April for the first anniversary for sure.
|
622
|
+
|
623
|
+
Overall still want the tests to catch up some more before adding new features, but the upload code needs splitting up, and that's an opportune moment to get both SFTP & Octokit in there.
|
624
|
+
|
625
|
+
**Links to work**
|
626
|
+
|
627
|
+
1. [Ripley](https://mikekreuzer.github.io/Ripley/)
|
628
|
+
2. [Ripley repo](https://github.com/mikekreuzer/Ripley)
|
629
|
+
3. [Ripley Tweet](https://twitter.com/mikekreuzer/status/836564005799915520)
|
630
|
+
4. [Zine Tweet](https://twitter.com/mikekreuzer/status/836925144853467136)
|
631
|
+
|
632
|
+
### Day 37: March 2, 2017
|
633
|
+
|
634
|
+
**Today's Progress**:
|
635
|
+
|
636
|
+
- more work on GitHub uploads
|
637
|
+
|
638
|
+
**Thoughts:**
|
639
|
+
|
640
|
+
Octokit seems to work ok, though yet to integrate it (the Upload code still needs to be split up).
|
641
|
+
|
642
|
+
Having to poll each possible remote copy of a file to see if it exists, to get its sha & to call separate create or update methods is clumsy. With a small number of uploads that's still likely to be fewer calls than getting all the remote files' info to update that locally though, because I'd need to poll each remote directory for its contents.
|
643
|
+
|
644
|
+
**Links to work**
|
645
|
+
|
646
|
+
1. [Tweet](https://twitter.com/mikekreuzer/status/837282872876638209)
|
647
|
+
|
648
|
+
### Day 38: March 3, 2017
|
649
|
+
|
650
|
+
**Today's Progress**:
|
651
|
+
|
652
|
+
- Ripley
|
653
|
+
|
654
|
+
**Thoughts:**
|
655
|
+
|
656
|
+
Started on converting Ripley over to a static site, getting the JSON data to compare locally - to get smooth navigation between months. More Ruby, in what had been an Elixir project (and before that a Go project). :-)
|
657
|
+
|
658
|
+
**Links to work**
|
659
|
+
|
660
|
+
1. [Tweet](https://twitter.com/mikekreuzer/status/837652254773563392)
|
661
|
+
|
662
|
+
### Day 39: March 4, 2017
|
663
|
+
|
664
|
+
**Today's Progress**:
|
665
|
+
|
666
|
+
- more toying with making Ripley data into Zine posts
|
667
|
+
|
668
|
+
**Thoughts:**
|
669
|
+
|
670
|
+
Long week, short night of coding.
|
671
|
+
|
672
|
+
**Links to work**
|
673
|
+
|
674
|
+
1. [Tweet](https://twitter.com/mikekreuzer/status/838004709793280000)
|
675
|
+
|
676
|
+
### Day 40: March 5, 2017
|
677
|
+
|
678
|
+
**Today's Progress**:
|
679
|
+
- shuffled some Upload methods
|
680
|
+
|
681
|
+
**Thoughts:**
|
682
|
+
|
683
|
+
Trying to wind things up by 11:30 so I can get up in the mornings is taking its toll. This is my only coding nowadays, will need to work out a way to square that circle sustainably.
|
684
|
+
|
685
|
+
**Links to work**
|
686
|
+
|
687
|
+
1. [Tweet](https://twitter.com/mikekreuzer/status/838365598643970050)
|
688
|
+
|
689
|
+
### Day 41: March 6, 2017
|
690
|
+
|
691
|
+
**Today's Progress**:
|
692
|
+
|
693
|
+
- the articles page takes its name from its template
|
694
|
+
- zine.yaml - deleted the redundant css preprocessor option
|
695
|
+
- fixed some shouldn't-be-private method bugs
|
696
|
+
- Ruby script added to Ripley, to generate Zine post files from the JSON
|
697
|
+
- Ripley is now a Zine site, though this upload was via git
|
698
|
+
|
699
|
+
**Thoughts:**
|
700
|
+
|
701
|
+
Ripley gets (currently clumsy) navigation between months to show historical data, as well as the benefit of being a (faster to load) static site, in time for next month's first anniversary. And I got to discover all sorts of assumptions I'd made about a site living in the root directory that I'll need to translate back to the stock templates.
|
702
|
+
|
703
|
+
**Links to work**
|
704
|
+
|
705
|
+
1. [Ripley](https://mikekreuzer.github.io/Ripley/)
|
706
|
+
2. [Ripley Ruby](https://github.com/mikekreuzer/Ripley/tree/master/build_table)
|
707
|
+
3. [Zine Repo](https://github.com/mikekreuzer/zine)
|
708
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/838740083792470016)
|
709
|
+
|
710
|
+
### Day 42: March 7, 2017
|
711
|
+
|
712
|
+
**Today's Progress**:
|
713
|
+
|
714
|
+
- fixed root directory assumptions in templates (images, css, links, all absolute) includes a url in the sass for the moment
|
715
|
+
- worked around some URI.join weirdness (join for files doesn't know what dots means, & for URIs expects the first param to be root)
|
716
|
+
- some cosmetic fixes in Ripley
|
717
|
+
- Upload class split up, into Upload and UploadSFTP
|
718
|
+
- UploadGitHub class added
|
719
|
+
|
720
|
+
**Thoughts:**
|
721
|
+
|
722
|
+
Sent some time fixing the bugs I caught yesterday, pushing things live's a good integration test sometimes. :-) Happy with Ripley for now, but will improve the build process. For April I still want to link to the JSON files, have a more natural forwards/backwards navigation between months, & table styles in the RSS. Tables might be a reason to look at Apple News again.
|
723
|
+
|
724
|
+
Will push that code up tomorrow when I've seen it work. Time for a blog update, it's been two weeks. Then it's back to writing tests - it's been a week already.
|
725
|
+
|
726
|
+
**Links to work**
|
727
|
+
|
728
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
729
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/839091283897405440)
|
730
|
+
|
731
|
+
### Took the night off: March 8, 2017
|
732
|
+
|
733
|
+
## 0.5.0
|
734
|
+
|
735
|
+
### Day 43: March 9, 2017
|
736
|
+
|
737
|
+
**Today's Progress**:
|
738
|
+
|
739
|
+
- pushing the new upload classes
|
740
|
+
- version bump, GitHub uploads are worth a version bump
|
741
|
+
|
742
|
+
**Thoughts:**
|
743
|
+
|
744
|
+
Thought about keeping the old lede para split going as an option, instead of pushing styles into the RSS (for tables).
|
745
|
+
|
746
|
+
Tests have fallen to 43.33%...
|
747
|
+
|
748
|
+
**Links to work**
|
749
|
+
|
750
|
+
1. [Repo](https://github.com/mikekreuzer/zine)
|
751
|
+
2. [Tweet](https://twitter.com/mikekreuzer/status/839799560339775489)
|
data/lib/zine.rb
CHANGED
@@ -8,30 +8,19 @@ require 'zine/templates'
|
|
8
8
|
module Zine
|
9
9
|
# the site
|
10
10
|
class Site
|
11
|
+
# Site options read from YAML during the initialisation of the class
|
11
12
|
attr_reader :options
|
12
13
|
|
14
|
+
# Create a new instance of Site, called by CLI#init_site
|
13
15
|
def initialize
|
14
16
|
@templates_by_name = {}
|
15
17
|
init_options
|
16
18
|
clean_option_paths
|
17
19
|
end
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
rescue ArgumentError => err
|
23
|
-
puts Rainbow("Could not parse YAML options: #{err.message}").red
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def init_templates
|
28
|
-
tem_array = Dir[File.join(@options['directories']['templates'], '*.erb')]
|
29
|
-
tem_array.each do |tem|
|
30
|
-
@templates_by_name.merge!(File.basename(tem, '.*') =>
|
31
|
-
ERB.new(File.read(tem), 0, '-'))
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
21
|
+
# A dry run build that generates baseline data to compare changes to during
|
22
|
+
# editting/preview, then generate files where the source files change.
|
23
|
+
# Called by CLI#build
|
35
24
|
def build_site
|
36
25
|
init_templates
|
37
26
|
FileUtils.mkdir_p @options['directories']['build']
|
@@ -40,16 +29,58 @@ module Zine
|
|
40
29
|
preview posts_and_guard
|
41
30
|
end
|
42
31
|
|
32
|
+
# Build the files of the site, generating files immeadiately, suitable for
|
33
|
+
# the initial build or complete rebuild.
|
34
|
+
# Called by CLI#force
|
43
35
|
def build_site_forcing_writes
|
44
36
|
init_templates
|
45
37
|
FileUtils.mkdir_p @options['directories']['build']
|
46
38
|
# posts_and_guard is { posts: @post_array, guard: @guard }
|
47
39
|
posts_and_guard = write_posts_and_headlines
|
48
|
-
|
40
|
+
housekeeping
|
49
41
|
write_other_markdown_pages
|
50
42
|
preview posts_and_guard
|
51
43
|
end
|
52
44
|
|
45
|
+
# Create a new instance of TemplateFiles, looking up the body template in
|
46
|
+
# @templates_by_name, defaults to the template named 'default'
|
47
|
+
#
|
48
|
+
# Called in PostsAndHeadlines.read_post_markdown_files,
|
49
|
+
# PostsAndHeadlines.one_new_post, PostsAndHeadlines.write_headline,
|
50
|
+
# PostsAndHeadlines.write_tags_and_headlines
|
51
|
+
#
|
52
|
+
# ==== Attributes
|
53
|
+
#
|
54
|
+
# * +type+ - The name of the template used for the body eg post
|
55
|
+
#
|
56
|
+
# ==== Eg
|
57
|
+
#
|
58
|
+
# make_template_bundle 'post'
|
59
|
+
#
|
60
|
+
def make_template_bundle(type)
|
61
|
+
TemplateFiles.new(
|
62
|
+
if @templates_by_name.key?(type)
|
63
|
+
@templates_by_name[type]
|
64
|
+
else
|
65
|
+
@templates_by_name['default']
|
66
|
+
end,
|
67
|
+
@templates_by_name['header_partial'],
|
68
|
+
@templates_by_name['footer_partial']
|
69
|
+
)
|
70
|
+
end
|
71
|
+
|
72
|
+
def write_markdown(default_name, src_dir, file)
|
73
|
+
dir = Pathname(File.dirname(file)).relative_path_from(Pathname(src_dir))
|
74
|
+
file_name = "#{File.basename(file, '.*')}.html"
|
75
|
+
dest = File.join @options['directories']['build'], dir
|
76
|
+
FileUtils.mkdir_p dest
|
77
|
+
page = Zine::Page.new(file, File.join(dest, file_name),
|
78
|
+
make_template_bundle(default_name), @options)
|
79
|
+
page.process File
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
53
84
|
def clean_option_paths
|
54
85
|
directories = @options['directories']
|
55
86
|
%w(assets posts styles templates).each do |dir|
|
@@ -58,37 +89,51 @@ module Zine
|
|
58
89
|
directories['blog'] = File.join directories['build'], directories['blog']
|
59
90
|
end
|
60
91
|
|
61
|
-
def
|
92
|
+
def housekeeping
|
62
93
|
directories = @options['directories']
|
63
|
-
|
64
|
-
search = File.join
|
94
|
+
source_directory = directories['source']
|
95
|
+
search = File.join source_directory, '**', '*.*'
|
65
96
|
possible = Dir.glob(search, File::FNM_DOTMATCH).reject do |found|
|
66
|
-
found
|
67
|
-
File.directory?(found) || found[directories['posts']] ||
|
68
|
-
found[directories['templates']] || found[directories['styles']]
|
97
|
+
housekeeping_files_not_to_copy found, directories
|
69
98
|
end
|
70
99
|
possible.each do |file|
|
71
|
-
|
72
|
-
filename = File.basename file
|
73
|
-
dest = File.join directories['build'], dir
|
74
|
-
FileUtils.mkdir_p dest
|
75
|
-
FileUtils.cp file, File.join(dest, filename)
|
100
|
+
housekeeping_copy(file, source_directory, directories['build'])
|
76
101
|
end
|
77
102
|
end
|
78
103
|
|
79
|
-
def
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
)
|
104
|
+
def housekeeping_files_not_to_copy(found, directories)
|
105
|
+
found =~ /^.+\.md$|^.+\.erb$|^\.DS_Store$|^\.$|^\.\.$'/ ||
|
106
|
+
File.directory?(found) ||
|
107
|
+
found[directories['posts']] ||
|
108
|
+
found[directories['templates']] ||
|
109
|
+
found[directories['styles']]
|
110
|
+
end
|
111
|
+
|
112
|
+
def housekeeping_copy(file, src_dir, build_dir)
|
113
|
+
dir = Pathname(File.dirname(file)).relative_path_from(Pathname(src_dir))
|
114
|
+
filename = File.basename file
|
115
|
+
dest = File.join build_dir, dir
|
116
|
+
FileUtils.mkdir_p dest
|
117
|
+
FileUtils.cp file, File.join(dest, filename)
|
118
|
+
end
|
119
|
+
|
120
|
+
def init_options
|
121
|
+
@options ||= begin
|
122
|
+
YAML.safe_load File.open('zine.yaml')
|
123
|
+
rescue ArgumentError => err
|
124
|
+
puts Rainbow("Could not parse YAML options: #{err.message}").red
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def init_templates
|
129
|
+
tem_array = Dir[File.join(@options['directories']['templates'], '*.erb')]
|
130
|
+
tem_array.each do |tem|
|
131
|
+
@templates_by_name.merge!(File.basename(tem, '.*') =>
|
132
|
+
ERB.new(File.read(tem), 0, '-'))
|
133
|
+
end
|
89
134
|
end
|
90
135
|
|
91
|
-
# Generate data without writing files (for
|
136
|
+
# Generate data without writing files (for incremental builds & uploads)
|
92
137
|
# returns posts & guard to use during edits under preview
|
93
138
|
def posts_and_headlines_without_writing
|
94
139
|
posts = Zine::PostsAndHeadlines.new self, @options
|
@@ -101,17 +146,6 @@ module Zine
|
|
101
146
|
guard.delete_array, guard.upload_array
|
102
147
|
end
|
103
148
|
|
104
|
-
def write_markdown(default_name, src_dir, file)
|
105
|
-
dir = Pathname(File.dirname(file)).relative_path_from(Pathname(src_dir))
|
106
|
-
file_name = "#{File.basename(file, '.*')}.html"
|
107
|
-
dest = File.join @options['directories']['build'], dir
|
108
|
-
FileUtils.mkdir_p dest
|
109
|
-
page = Zine::Page.new(file, File.join(dest, file_name),
|
110
|
-
make_template_bundle(default_name), @options)
|
111
|
-
page.process
|
112
|
-
end
|
113
|
-
|
114
|
-
# TODO: structure in common with housekeeping_copy
|
115
149
|
def write_other_markdown_pages
|
116
150
|
dir_options = @options['directories']
|
117
151
|
src_dir = dir_options['source']
|