mr-edward 0.0.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 +7 -0
- data/bin/edward +6 -0
- data/lib/builder.rb +50 -0
- data/lib/edward.rb +4 -0
- metadata +96 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 53860e34821501a9aef8e8bba268f0506e368480685c951135c86afa5efa080a
|
|
4
|
+
data.tar.gz: c6da92d6db21f8f67ce945243261db3da7338b22dbe6768d639e881e03013cdd
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 348965af2898c31a635a0f0cef65e6085a63c02436d397376a69b2390c1588e6ea0eb7534499b7ca96d92dae532b21fc5bfcf02ae02e4003af06b10726442b3a
|
|
7
|
+
data.tar.gz: c27e449bf7dc7f26cffca20b860ede580dd3bf1aa6c300a962a5cee0f37b3ccb75bb8b837882aa9f2e8efcd5ec63cee5e9e53715589e16872543e2fed4ea4e89
|
data/bin/edward
ADDED
data/lib/builder.rb
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
require "fileutils"
|
|
2
|
+
require "yaml"
|
|
3
|
+
require "tilt"
|
|
4
|
+
|
|
5
|
+
module Edward
|
|
6
|
+
# Builds a website
|
|
7
|
+
class Builder
|
|
8
|
+
|
|
9
|
+
attr_reader :target
|
|
10
|
+
|
|
11
|
+
def initialize
|
|
12
|
+
@target = "_site"
|
|
13
|
+
@gitignore = File.read(".gitignore").lines rescue []
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def start
|
|
17
|
+
FileUtils.rm_r @target if File.exist? @target
|
|
18
|
+
FileUtils.mkdir_p @target
|
|
19
|
+
|
|
20
|
+
Dir.glob("**/*") do |path|
|
|
21
|
+
visit_file path if visit_file?(path)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def visit_file? path
|
|
26
|
+
File.file?(path) &&
|
|
27
|
+
!path.start_with?("_") &&
|
|
28
|
+
!["Gemfile", "Gemfile.lock"].include?(path) &&
|
|
29
|
+
!@gitignore.include?(path)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def visit_file path
|
|
33
|
+
if Page.page?(path)
|
|
34
|
+
page = Edward::Page.new(path)
|
|
35
|
+
puts "converting #{page.path} => #{page.dirname}/#{page.new_name}"
|
|
36
|
+
FileUtils.mkdir_p "#{@target}/#{page.dirname}"
|
|
37
|
+
File.write("#{@target}/#{page.new_path}", page.render)
|
|
38
|
+
else
|
|
39
|
+
copy_plain path
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# simply copy the file
|
|
44
|
+
def copy_plain path
|
|
45
|
+
FileUtils.mkdir_p "#{@target}/#{File.dirname path}"
|
|
46
|
+
FileUtils.cp path, "#{@target}/#{path}"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
data/lib/edward.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: mr-edward
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Rein Fernhout
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: tilt
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.6'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.6'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: webrick
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - "~>"
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '1.9'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - "~>"
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '1.9'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: listen
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - "~>"
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '3.9'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - "~>"
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '3.9'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: deep_merge
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - "~>"
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '1.2'
|
|
61
|
+
type: :runtime
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - "~>"
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '1.2'
|
|
68
|
+
executables:
|
|
69
|
+
- edward
|
|
70
|
+
extensions: []
|
|
71
|
+
extra_rdoc_files: []
|
|
72
|
+
files:
|
|
73
|
+
- bin/edward
|
|
74
|
+
- lib/builder.rb
|
|
75
|
+
- lib/edward.rb
|
|
76
|
+
licenses:
|
|
77
|
+
- MIT
|
|
78
|
+
metadata: {}
|
|
79
|
+
rdoc_options: []
|
|
80
|
+
require_paths:
|
|
81
|
+
- lib
|
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
83
|
+
requirements:
|
|
84
|
+
- - ">="
|
|
85
|
+
- !ruby/object:Gem::Version
|
|
86
|
+
version: '0'
|
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
|
+
requirements:
|
|
89
|
+
- - ">="
|
|
90
|
+
- !ruby/object:Gem::Version
|
|
91
|
+
version: '0'
|
|
92
|
+
requirements: []
|
|
93
|
+
rubygems_version: 3.6.9
|
|
94
|
+
specification_version: 4
|
|
95
|
+
summary: Statis site generator
|
|
96
|
+
test_files: []
|