petrify 0.3.1 → 0.4.4
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 +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +32 -0
- data/LICENSE +21 -0
- data/lib/petrify.rb +18 -3
- data/lib/petrify/version.rb +1 -1
- data/petrify.gemspec +3 -3
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: de1df71d188f7ec487b065c85ad54bab19b6ff5f4b196c9cb0ad274cd223380a
|
4
|
+
data.tar.gz: e52203392ed03a2f15d4841faf835c7cf5eba7ef2f3debcf72af0695a83ab1c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e08dd2a20fa1448c295aa8f32c92260ca6d7db90b79ca14f87b54f1e59d163716aeb44b086f83209e3e9c24070c4723d29500ba0872eade0f5ec5e2beaf7658a
|
7
|
+
data.tar.gz: bda9ffb56ea2e824eedaca8f71f3271fe649e3583b5600f8041dd6d396e782daac6a6354493cd5590f793e3cb033ca0af71c3557c7b8c73a5070dd09fe094d7d
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased](https://git.adrianshort.org/adrian/petrify)
|
8
|
+
|
9
|
+
This functionality is on git.adrianshort.org but not yet on RubyGems.
|
10
|
+
|
11
|
+
## [0.4.4](https://git.adrianshort.org/adrian/petrify/src/tag/v0.4.4) - 2020-11-17
|
12
|
+
|
13
|
+
- Move development to git.adrianshort.org.
|
14
|
+
|
15
|
+
## [0.4.3](https://git.adrianshort.org/adrian/petrify/src/tag/v0.4.3) - 2020-07-25
|
16
|
+
|
17
|
+
- Move development to GitHub.
|
18
|
+
|
19
|
+
## [0.4.2](https://git.adrianshort.org/adrian/petrify/src/tag/v0.4.2) - 2020-01-16
|
20
|
+
|
21
|
+
## [0.4.1](https://git.adrianshort.org/adrian/petrify/src/tag/v0.4.1) - 2019-11-13
|
22
|
+
|
23
|
+
## [0.4.0](https://git.adrianshort.org/adrian/petrify/src/tag/v0.4.0) - 2019-10-26
|
24
|
+
|
25
|
+
## [0.3.1](https://git.adrianshort.org/adrian/petrify/src/tag/v0.3.1) - 2019-01-22
|
26
|
+
|
27
|
+
## [0.3.0](https://git.adrianshort.org/adrian/petrify/src/tag/v0.3.0) - 2018-10-18
|
28
|
+
|
29
|
+
## [0.2.0](https://git.adrianshort.org/adrian/petrify/src/tag/v0.2.0) - 2018-10-04
|
30
|
+
|
31
|
+
## [0.1.0](https://git.adrianshort.org/adrian/petrify/src/tag/v0.1.0) - 2018-09-24
|
32
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Adrian Short
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/lib/petrify.rb
CHANGED
@@ -13,6 +13,7 @@ module Petrify
|
|
13
13
|
@@log = Logger.new($stdout)
|
14
14
|
@@log.level = Logger::INFO
|
15
15
|
|
16
|
+
# Write an HTML page using a specified template and optional data
|
16
17
|
def self.page(path_items, template, locals = {})
|
17
18
|
dir = create_path(path_items)
|
18
19
|
fn = File.join(dir, 'index.html')
|
@@ -28,18 +29,32 @@ module Petrify
|
|
28
29
|
# https://support.google.com/webmasters/answer/183668?hl=en&ref_topic=4581190
|
29
30
|
end
|
30
31
|
|
32
|
+
# Write a CSV file from an array of hashes (or an empty array)
|
31
33
|
def self.csv(path_items, filename, data)
|
32
34
|
dir = create_path(path_items)
|
33
35
|
fn = File.join(dir, filename + '.csv')
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
if data.size > 0
|
38
|
+
csv_string = CSV.generate do |csv|
|
39
|
+
csv << data.first.keys # header row
|
40
|
+
data.each { |row| csv << row.values }
|
41
|
+
end
|
42
|
+
else
|
43
|
+
# There's no data so write an empty file (no header row either)
|
44
|
+
csv_string = ''
|
38
45
|
end
|
39
46
|
|
40
47
|
File.write(fn, csv_string)
|
41
48
|
@@log.info fn
|
42
49
|
end
|
50
|
+
|
51
|
+
# Write an arbitrary file to output (eg a JSON file)
|
52
|
+
def self.file(path_items, filename, data)
|
53
|
+
dir = create_path(path_items)
|
54
|
+
fn = File.join(dir, filename)
|
55
|
+
File.write(fn, data)
|
56
|
+
@@log.info fn
|
57
|
+
end
|
43
58
|
|
44
59
|
def self.setup
|
45
60
|
# Recursively delete working directory to ensure no redundant files are left behind from previous builds.
|
data/lib/petrify/version.rb
CHANGED
data/petrify.gemspec
CHANGED
@@ -7,11 +7,11 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "petrify"
|
8
8
|
spec.version = Petrify::VERSION
|
9
9
|
spec.authors = ["Adrian Short"]
|
10
|
-
spec.email = ['
|
10
|
+
spec.email = ['adrian@adrianshort.org']
|
11
11
|
spec.licenses = ['MIT']
|
12
12
|
spec.summary = %q{A data(base)-driven static site generator with Haml templates.}
|
13
13
|
#spec.description = %q{TODO: Write a longer description or delete this line.}
|
14
|
-
spec.homepage = "https://
|
14
|
+
spec.homepage = "https://git.adrianshort.org/adrian/petrify"
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
17
|
f.match(%r{^(test|spec|features)/})
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_runtime_dependency "haml", "~> 5.0"
|
26
26
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: petrify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Short
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
26
|
+
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,15 +52,17 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
-
description:
|
55
|
+
description:
|
56
56
|
email:
|
57
|
-
-
|
57
|
+
- adrian@adrianshort.org
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
63
64
|
- Gemfile
|
65
|
+
- LICENSE
|
64
66
|
- README.md
|
65
67
|
- Rakefile
|
66
68
|
- bin/console
|
@@ -68,11 +70,11 @@ files:
|
|
68
70
|
- lib/petrify.rb
|
69
71
|
- lib/petrify/version.rb
|
70
72
|
- petrify.gemspec
|
71
|
-
homepage: https://
|
73
|
+
homepage: https://git.adrianshort.org/adrian/petrify
|
72
74
|
licenses:
|
73
75
|
- MIT
|
74
76
|
metadata: {}
|
75
|
-
post_install_message:
|
77
|
+
post_install_message:
|
76
78
|
rdoc_options: []
|
77
79
|
require_paths:
|
78
80
|
- lib
|
@@ -87,9 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
89
|
- !ruby/object:Gem::Version
|
88
90
|
version: '0'
|
89
91
|
requirements: []
|
90
|
-
|
91
|
-
|
92
|
-
signing_key:
|
92
|
+
rubygems_version: 3.1.2
|
93
|
+
signing_key:
|
93
94
|
specification_version: 4
|
94
95
|
summary: A data(base)-driven static site generator with Haml templates.
|
95
96
|
test_files: []
|