soy 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +9 -0
- data/README.md +72 -4
- data/exe/soy +2 -33
- data/lib/soy/builder.rb +30 -15
- data/lib/soy/cli.rb +81 -0
- data/lib/soy/file.rb +32 -0
- data/lib/soy/helpers.rb +15 -0
- data/lib/soy/page.rb +8 -0
- data/lib/soy/renderer.rb +19 -5
- data/lib/soy/server.rb +23 -5
- data/lib/soy/template/content/styles.css +5 -0
- data/lib/soy/template/views/layout.html.erb +6 -2
- data/lib/soy/version.rb +1 -1
- data/lib/soy.rb +4 -5
- data/soy.gemspec +2 -1
- metadata +22 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51bbd538a472a9b4acac80fdeeadd43397a36b152bcf6634e08e623afc11ff3d
|
4
|
+
data.tar.gz: 6e0828e7e44d5d462f5072d5851cd4251f59c2bc81627a0564760dbc9f948539
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 826df4c995a9addc89897d214d6ff59af353112924383cbc483c34d2bb992848beeb068753d1641ef086383aeda7b491c673c524fca1a3a656333974226be1c9
|
7
|
+
data.tar.gz: 831cf3ef9042b417206985fe827a9cff379caef2e993c790d0ce68335ec28c9c4d4cfdad880074322936178dfa97d4e18bcc05bceb45bf4d7dafe6a5e853cc41
|
data/.rubocop.yml
CHANGED
@@ -28,5 +28,18 @@ RSpec/MultipleExpectations:
|
|
28
28
|
Enabled: false
|
29
29
|
|
30
30
|
RSpec/ExampleLength:
|
31
|
+
Max: 20
|
31
32
|
Exclude:
|
32
33
|
- "spec/system/**/*_spec.rb"
|
34
|
+
|
35
|
+
RSpec/MessageSpies:
|
36
|
+
EnforcedStyle: receive
|
37
|
+
|
38
|
+
RSpec/NestedGroups:
|
39
|
+
Max: 5
|
40
|
+
|
41
|
+
RSpec/NotToNot:
|
42
|
+
EnforcedStyle: to_not
|
43
|
+
|
44
|
+
RSpec/ReturnFromStub:
|
45
|
+
EnforcedStyle: block
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.0] - 2022-03-06
|
4
|
+
|
5
|
+
- Adds support for ingesting Markdown and outputting HTML
|
6
|
+
- Adds support for `.erb`-less HTML and Markdown file names while still processing with ERB
|
7
|
+
- Adds support for extension-less path serving in `soy server`
|
8
|
+
- Changes default port from Puma's default 9292 to 4848
|
9
|
+
- Adds support for `--port` flag with `soy server`, example: `soy server --port 4200` to run local server on another port
|
10
|
+
- Adds ability to process content nested within folders
|
11
|
+
|
3
12
|
## [0.1.0] - 2022-03-03
|
4
13
|
|
5
14
|
- Initial release
|
data/README.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
![Soy mascot Tofu](demo/content/tofu.png)
|
2
2
|
|
3
|
+
```
|
4
|
+
oo_ .-. wWw wWw
|
5
|
+
/ _)-< c(O_O)c (O) (O)
|
6
|
+
\__ `. ,'.---.`,( \ / )
|
7
|
+
`. |/ /|_|_|\ \\ \/ /
|
8
|
+
_| || \_____/ | \o /
|
9
|
+
,-' |'. `---' .`_/ /
|
10
|
+
(_..--' `-...-' (_.'
|
11
|
+
```
|
12
|
+
|
3
13
|
# Soy
|
4
14
|
|
5
15
|
**A static-site generator for Rubyists**
|
@@ -40,22 +50,24 @@ fermenting...
|
|
40
50
|
## Bugs / Features
|
41
51
|
|
42
52
|
- Write templates in ERB and use the Ruby you know and love
|
53
|
+
- Author content in Markdown or HTML
|
43
54
|
- Boot up a server and watch for changes
|
44
55
|
|
45
56
|
## Installation
|
46
57
|
|
47
58
|
Soy requires a modern, stable Ruby, [see ruby-lang.org](https://www.ruby-lang.org/en/downloads/)
|
48
59
|
|
49
|
-
|
50
|
-
- 3.
|
51
|
-
-
|
60
|
+
Supported Rubies:
|
61
|
+
- 3.1
|
62
|
+
- 3.0
|
63
|
+
- 2.7
|
52
64
|
|
53
65
|
1. Install Soy with `gem install soy`
|
54
66
|
2. Create a new site with `soy new YOUR_SITE_NAME`
|
55
67
|
3. Move into it the new site's directory
|
56
68
|
4. Run `soy server` to get to building!
|
57
69
|
|
58
|
-
Your site will then be accessible at [localhost:
|
70
|
+
Your site will then be accessible at [localhost:4848](http://localhost:4848)
|
59
71
|
|
60
72
|
## Usage
|
61
73
|
|
@@ -73,9 +85,63 @@ Browse `./demo/` to see a full site, but here's a breakdown of what goes into a
|
|
73
85
|
- `build/` – where the HTML is output to & served from locally, don't check this in
|
74
86
|
- `content/` – where pages, images, styles, etc. live
|
75
87
|
- e.g. `index.html.erb`
|
88
|
+
- e.g. `about.md`
|
76
89
|
- `views/` – where page layouts live (to be evaluated)
|
77
90
|
- `layout.html.erb` — default HTML page layout
|
78
91
|
|
92
|
+
## Content
|
93
|
+
|
94
|
+
Soy content lives in the `content/` directory. If the file name ends in `.erb`,
|
95
|
+
it'll get run through the Soy renderer for ERB.
|
96
|
+
|
97
|
+
### Markdown
|
98
|
+
|
99
|
+
Content can be authored in Markdown, which outputs HTML. Soy uses
|
100
|
+
[Kramdown](https://rubygems.org/gems/kramdown) for Markdown parsing.
|
101
|
+
|
102
|
+
### ERB
|
103
|
+
|
104
|
+
HTML and Markdown files don't need the `.erb` file extension, they'll always
|
105
|
+
get run through ERB. So that's optional and totally up to you. `.erb` can help
|
106
|
+
with syntax highlighting in your editor.
|
107
|
+
|
108
|
+
ERB content will be rendered inside the layout specified in
|
109
|
+
`views/layout.html.erb`.
|
110
|
+
|
111
|
+
ERB is neat because you can use whatever Ruby you want within it. Here's an
|
112
|
+
example with Markdown:
|
113
|
+
|
114
|
+
``` markdown
|
115
|
+
<% @title = "Neat Products Made of Soy" %>
|
116
|
+
|
117
|
+
# <%= @title %>
|
118
|
+
|
119
|
+
<% ["tofu", "tempeh", "edamame"].each do |product| %>
|
120
|
+
- <%= product %>
|
121
|
+
<% end %>
|
122
|
+
```
|
123
|
+
|
124
|
+
### Links
|
125
|
+
|
126
|
+
Link to pages and content using the relative path. Markdown example:
|
127
|
+
|
128
|
+
``` markdown
|
129
|
+
Check out [my super cool link](/cool-link).
|
130
|
+
```
|
131
|
+
|
132
|
+
That would link to the `cool-link.html` page in the build dir.
|
133
|
+
|
134
|
+
The Soy development server (and many hosts) handle extension-less HTML
|
135
|
+
requests.
|
136
|
+
|
137
|
+
You can include the extension if you want to:
|
138
|
+
|
139
|
+
``` markdown
|
140
|
+
Check out [my super cool link](/cool-link.html).
|
141
|
+
```
|
142
|
+
|
143
|
+
It's really up to you and your preferences.
|
144
|
+
|
79
145
|
## Development
|
80
146
|
|
81
147
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
@@ -93,6 +159,8 @@ of the features as possible with the project.
|
|
93
159
|
The `bin/soy` binstub can be used to run the local repo's code, so `bin/soy
|
94
160
|
build demo` will build the demo site.
|
95
161
|
|
162
|
+
[View the demo site on Netlify.](https://soy-demo.netlify.app)
|
163
|
+
|
96
164
|
## Releasing New Versions
|
97
165
|
|
98
166
|
To release a new version, update the version number in `version.rb`, and then run
|
data/exe/soy
CHANGED
@@ -1,37 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require "soy"
|
4
|
+
require "soy/cli"
|
5
5
|
|
6
|
-
|
7
|
-
starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
8
|
-
yield
|
9
|
-
ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
10
|
-
(ending - starting).round(6)
|
11
|
-
end
|
12
|
-
|
13
|
-
first_arg = ARGV[0]
|
14
|
-
case first_arg
|
15
|
-
when "build", "b"
|
16
|
-
puts "Building site..."
|
17
|
-
time = elapsed do
|
18
|
-
Soy.build(ARGV[1])
|
19
|
-
end
|
20
|
-
puts "Site successfully built in #{time} seconds"
|
21
|
-
when "help", "h", "-h", "--help", nil
|
22
|
-
puts "Soy v#{Soy::VERSION}\n\n"
|
23
|
-
puts "Available commands:\n"
|
24
|
-
puts "\tbuild (b) - generate site in the build directory"
|
25
|
-
puts "\tnew (n) - create a new Soy site\n\t\tsoy new SITE_NAME"
|
26
|
-
puts "\tserver (s) - rebuild site on changes and start HTTP server"
|
27
|
-
puts "\tversion (v) - current version of the library"
|
28
|
-
when "new", "n"
|
29
|
-
Soy.new_site(ARGV[1])
|
30
|
-
when "server", "serve", "s"
|
31
|
-
Soy::Server.start(ARGV[1])
|
32
|
-
when "version", "v", "-v", "--v"
|
33
|
-
puts Soy::VERSION
|
34
|
-
else
|
35
|
-
puts "`#{first_arg}` is not a command"
|
36
|
-
puts "Run `soy help` for list of commands"
|
37
|
-
end
|
6
|
+
Soy::Cli.new(ARGV).run
|
data/lib/soy/builder.rb
CHANGED
@@ -5,30 +5,45 @@ require "fileutils"
|
|
5
5
|
module Soy
|
6
6
|
# Builds the static site content
|
7
7
|
class Builder
|
8
|
+
include Helpers
|
9
|
+
|
8
10
|
def initialize(project_dir)
|
9
|
-
@project_dir = project_dir
|
11
|
+
@project_dir = project_dir || Dir.pwd
|
10
12
|
@build_dir = "#{@project_dir}/build/"
|
13
|
+
@content_dir = "#{@project_dir}/content/"
|
11
14
|
end
|
12
15
|
|
13
16
|
def call
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
puts "Building site..."
|
18
|
+
time = elapsed do
|
19
|
+
FileUtils.rm_rf(@build_dir)
|
20
|
+
FileUtils.mkdir_p(@build_dir)
|
21
|
+
process_content
|
22
|
+
end
|
23
|
+
puts "Site successfully built in #{time} seconds"
|
17
24
|
end
|
18
25
|
|
19
26
|
private
|
20
27
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def process_content
|
29
|
+
Dir.glob("#{@content_dir}**/*").each do |file|
|
30
|
+
process_file(file)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def process_file(file_path)
|
35
|
+
file = Soy::File.new(file_path)
|
36
|
+
|
37
|
+
dest = file_path.gsub(@content_dir, @build_dir).gsub(%r{/[\w-]+(\.\w+)+$}, "/")
|
38
|
+
|
39
|
+
if ::File.directory?(file_path)
|
40
|
+
FileUtils.mkdir_p(file_path.gsub(@content_dir, @build_dir))
|
41
|
+
elsif file.render_with_erb?
|
42
|
+
layout = Soy::File.new("#{@project_dir}/views/layout.html.erb")
|
43
|
+
out = Soy::Renderer.new(file, layout).render
|
44
|
+
::File.write("#{dest}#{file.rendered_name}", out)
|
45
|
+
else
|
46
|
+
FileUtils.cp(file_path, dest)
|
32
47
|
end
|
33
48
|
end
|
34
49
|
end
|
data/lib/soy/cli.rb
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "soy"
|
4
|
+
|
5
|
+
module Soy
|
6
|
+
# Command-Line Interface entrance for Soy
|
7
|
+
class Cli
|
8
|
+
include Helpers
|
9
|
+
|
10
|
+
# @param args - ARGV, array of arguments
|
11
|
+
def initialize(args)
|
12
|
+
@args = Array(args)
|
13
|
+
end
|
14
|
+
|
15
|
+
COMMANDS = {
|
16
|
+
build: {
|
17
|
+
aliases: ["b"],
|
18
|
+
description: "Generate the site, supports passing path to site directory",
|
19
|
+
examples: ["soy build", "soy build path/to/site"],
|
20
|
+
run: ->(args) { Soy::Builder.new(args[1]).call }
|
21
|
+
},
|
22
|
+
help: {
|
23
|
+
aliases: ["h", "-h", "--help"],
|
24
|
+
description: "Generate the site, supports passing path to site directory",
|
25
|
+
examples: ["soy build", "soy build path/to/site"],
|
26
|
+
run: lambda do |_args|
|
27
|
+
puts "Soy v#{Soy::VERSION}\n\n"
|
28
|
+
puts "Available commands:\n"
|
29
|
+
COMMANDS.each do |command, details|
|
30
|
+
puts "\t#{command} - #{details[:description]}"
|
31
|
+
puts "\t\taliases: #{details[:aliases].join(", ")}"
|
32
|
+
puts "\t\texamples:\n\t\t\t#{details[:examples].join("\n\t\t\t")}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
},
|
36
|
+
new: {
|
37
|
+
aliases: ["n"],
|
38
|
+
description: "Create a site from the basic Soy template",
|
39
|
+
examples: ["soy new site_name"],
|
40
|
+
run: ->(args) { Soy.new_site(args[1]) }
|
41
|
+
},
|
42
|
+
server: {
|
43
|
+
aliases: %w[s serve],
|
44
|
+
description: "Start development server & rebuild site on changes," \
|
45
|
+
"supports passing path to site directory and an optional --port arg",
|
46
|
+
examples: ["soy server", "soy server path/to/site", "soy server --port=4040"],
|
47
|
+
run: lambda do |args|
|
48
|
+
opts = {}
|
49
|
+
OptionParser.new do |parser|
|
50
|
+
parser.banner = "soy server option flags"
|
51
|
+
parser.on("-p", "--port [PORT]", Integer, "HTTP to run the server at")
|
52
|
+
end.parse!(args, into: opts)
|
53
|
+
Soy::Server.start(args[1], port: opts[:port])
|
54
|
+
end
|
55
|
+
},
|
56
|
+
version: {
|
57
|
+
aliases: ["v", "-v", "--version"],
|
58
|
+
description: "Output installed Soy version",
|
59
|
+
examples: ["soy version"],
|
60
|
+
run: ->(_args) { puts Soy::VERSION }
|
61
|
+
}
|
62
|
+
}.freeze
|
63
|
+
|
64
|
+
def run
|
65
|
+
first_arg = @args[0]
|
66
|
+
|
67
|
+
return COMMANDS[:help][:run].call(@args) if first_arg.nil?
|
68
|
+
|
69
|
+
command = COMMANDS.find do |key, details|
|
70
|
+
first_arg == key.to_s || details.fetch(:aliases, []).include?(first_arg)
|
71
|
+
end
|
72
|
+
|
73
|
+
if command
|
74
|
+
command[1].fetch(:run).call(@args)
|
75
|
+
else
|
76
|
+
puts "`#{first_arg}` is not a command"
|
77
|
+
puts "Run `soy help` for list of commands"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
data/lib/soy/file.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Soy
|
4
|
+
# Utility class for taking a path to a file and determining what its
|
5
|
+
# capabilities are within Soy
|
6
|
+
class File
|
7
|
+
def initialize(file_path)
|
8
|
+
@file_path = file_path
|
9
|
+
end
|
10
|
+
|
11
|
+
def read
|
12
|
+
::File.read(@file_path)
|
13
|
+
end
|
14
|
+
|
15
|
+
def rendered_name
|
16
|
+
bare_name = @file_path.split("/").last.split(".").first
|
17
|
+
"#{bare_name}.html"
|
18
|
+
end
|
19
|
+
|
20
|
+
def render_with_erb?
|
21
|
+
@file_path =~ /.erb$/ || markdown? || html?
|
22
|
+
end
|
23
|
+
|
24
|
+
def markdown?
|
25
|
+
@file_path =~ /.(md|markdown)/
|
26
|
+
end
|
27
|
+
|
28
|
+
def html?
|
29
|
+
@file_path =~ /.html/
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/soy/helpers.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Soy
|
4
|
+
# Utility methods to be used across classes
|
5
|
+
module Helpers
|
6
|
+
# Returns the time for executing the block, rounded to the sixth
|
7
|
+
# place.
|
8
|
+
def elapsed
|
9
|
+
starting = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
10
|
+
yield
|
11
|
+
ending = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
12
|
+
(ending - starting).round(6)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/soy/page.rb
CHANGED
data/lib/soy/renderer.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "kramdown"
|
3
4
|
require "soy/page"
|
4
5
|
|
5
6
|
module Soy
|
6
|
-
#
|
7
|
+
# Runs the template through ERB and generates HTML from it, within optional
|
8
|
+
# layout.
|
7
9
|
class Renderer
|
8
|
-
|
10
|
+
# template, +Soy::File+ instance
|
11
|
+
# layout, +Soy::File+ instance
|
12
|
+
def initialize(template, layout)
|
9
13
|
@template = template
|
10
14
|
@layout = layout
|
15
|
+
|
11
16
|
@page = Page.new
|
12
17
|
end
|
13
18
|
|
14
19
|
def render
|
15
|
-
|
16
|
-
|
20
|
+
out = _render(@template)
|
21
|
+
out = convert_template(out)
|
22
|
+
out = _render(@layout) { out }
|
23
|
+
out = out.gsub(/^\s+$/, "")
|
24
|
+
out.gsub(/\A\n/, "")
|
17
25
|
end
|
18
26
|
|
19
27
|
private
|
@@ -22,8 +30,14 @@ module Soy
|
|
22
30
|
if template.nil?
|
23
31
|
yield
|
24
32
|
else
|
25
|
-
ERB.new(template).result(binding)
|
33
|
+
ERB.new(template.read).result(binding)
|
26
34
|
end
|
27
35
|
end
|
36
|
+
|
37
|
+
def convert_template(text)
|
38
|
+
text = Kramdown::Document.new(text).to_html if @template.markdown?
|
39
|
+
|
40
|
+
text
|
41
|
+
end
|
28
42
|
end
|
29
43
|
end
|
data/lib/soy/server.rb
CHANGED
@@ -10,12 +10,15 @@ require "rack/show_exceptions"
|
|
10
10
|
module Soy
|
11
11
|
# Container of data for a given page
|
12
12
|
class Server
|
13
|
-
|
14
|
-
|
13
|
+
DEFAULT_PORT = 4848
|
14
|
+
|
15
|
+
def self.start(dir = Dir.pwd, port: DEFAULT_PORT)
|
16
|
+
new(dir, port).call
|
15
17
|
end
|
16
18
|
|
17
|
-
def initialize(dir)
|
19
|
+
def initialize(dir, port)
|
18
20
|
@dir = dir || Dir.pwd
|
21
|
+
@port = port || DEFAULT_PORT
|
19
22
|
@relative_output_dir = "build"
|
20
23
|
@output_dir = "#{@dir}/#{@relative_output_dir}"
|
21
24
|
@builder = Builder.new(@dir)
|
@@ -40,7 +43,7 @@ module Soy
|
|
40
43
|
|
41
44
|
def start_server
|
42
45
|
puts "Serving files from #{@output_dir}"
|
43
|
-
Rack::Server.start(app: app, Port:
|
46
|
+
Rack::Server.start(app: app, Port: @port)
|
44
47
|
end
|
45
48
|
|
46
49
|
def app
|
@@ -48,14 +51,29 @@ module Soy
|
|
48
51
|
Rack::ShowExceptions.new(
|
49
52
|
Rack::Lint.new(
|
50
53
|
Rack::Static.new(
|
51
|
-
|
54
|
+
bare_finder_with_404_fallback,
|
52
55
|
urls: [""],
|
53
56
|
root: @output_dir,
|
57
|
+
cascade: true,
|
54
58
|
index: "index.html"
|
55
59
|
)
|
56
60
|
)
|
57
61
|
)
|
58
62
|
)
|
59
63
|
end
|
64
|
+
|
65
|
+
def bare_finder_with_404_fallback
|
66
|
+
lambda do |env|
|
67
|
+
request_path = env["REQUEST_PATH"]
|
68
|
+
file_path = "#{@output_dir + request_path}.html"
|
69
|
+
[200, { "Content-Type" => "text/html;charset=utf8" }, [::File.read(file_path)]]
|
70
|
+
rescue Errno::ENOENT => e
|
71
|
+
[
|
72
|
+
404,
|
73
|
+
{ "Content-Type" => "text/plain;charset=utf8" },
|
74
|
+
["File Not Found\n\n#{e.message}\n\nCreate content to match the path.\n\n༼☯﹏☯༽"]
|
75
|
+
]
|
76
|
+
end
|
77
|
+
end
|
60
78
|
end
|
61
79
|
end
|
@@ -1,8 +1,12 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
|
1
3
|
<html>
|
2
|
-
<head>
|
4
|
+
<head lang="en">
|
5
|
+
<meta charset="utf-8">
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
3
7
|
<title><%= @page.title || "Your Site" %></title>
|
8
|
+
<link href="/styles.css" rel="stylesheet">
|
4
9
|
</head>
|
5
|
-
|
6
10
|
<body>
|
7
11
|
<%= yield %>
|
8
12
|
</body>
|
data/lib/soy/version.rb
CHANGED
data/lib/soy.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_relative "soy/helpers"
|
4
|
+
|
3
5
|
require_relative "soy/builder"
|
6
|
+
require_relative "soy/cli"
|
7
|
+
require_relative "soy/file"
|
4
8
|
require_relative "soy/renderer"
|
5
9
|
require_relative "soy/server"
|
6
10
|
require_relative "soy/version"
|
@@ -11,11 +15,6 @@ require "erb"
|
|
11
15
|
module Soy
|
12
16
|
class Error < StandardError; end
|
13
17
|
|
14
|
-
def self.build(dir)
|
15
|
-
dir ||= Dir.pwd
|
16
|
-
Builder.new(dir).call
|
17
|
-
end
|
18
|
-
|
19
18
|
def self.new_site(name)
|
20
19
|
FileUtils.cp_r("#{__dir__}/soy/template/", name)
|
21
20
|
puts "New Soy site created, view in: #{name}"
|
data/soy.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "Static site builder with support for data models, helpers, an admin, and more."
|
13
13
|
spec.homepage = "https://github.com/brettchalupa/soy"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.7.
|
15
|
+
spec.required_ruby_version = ">= 2.7.0"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = spec.homepage
|
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
34
|
spec.require_paths = ["lib"]
|
35
35
|
|
36
|
+
spec.add_dependency "kramdown", "~> 2.3"
|
36
37
|
spec.add_dependency "listen", "~> 3.7"
|
37
38
|
spec.add_dependency "puma", "~> 5.6.2"
|
38
39
|
spec.add_dependency "rack", "~> 2.2"
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Chalupa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: kramdown
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.3'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: listen
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,11 +84,15 @@ files:
|
|
70
84
|
- exe/soy
|
71
85
|
- lib/soy.rb
|
72
86
|
- lib/soy/builder.rb
|
87
|
+
- lib/soy/cli.rb
|
88
|
+
- lib/soy/file.rb
|
89
|
+
- lib/soy/helpers.rb
|
73
90
|
- lib/soy/page.rb
|
74
91
|
- lib/soy/renderer.rb
|
75
92
|
- lib/soy/server.rb
|
76
93
|
- lib/soy/template/.gitignore
|
77
94
|
- lib/soy/template/content/index.html.erb
|
95
|
+
- lib/soy/template/content/styles.css
|
78
96
|
- lib/soy/template/views/layout.html.erb
|
79
97
|
- lib/soy/version.rb
|
80
98
|
- sig/sito.rbs
|
@@ -95,14 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
95
113
|
requirements:
|
96
114
|
- - ">="
|
97
115
|
- !ruby/object:Gem::Version
|
98
|
-
version: 2.7.
|
116
|
+
version: 2.7.0
|
99
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
118
|
requirements:
|
101
119
|
- - ">="
|
102
120
|
- !ruby/object:Gem::Version
|
103
121
|
version: '0'
|
104
122
|
requirements: []
|
105
|
-
rubygems_version: 3.3.
|
123
|
+
rubygems_version: 3.3.7
|
106
124
|
signing_key:
|
107
125
|
specification_version: 4
|
108
126
|
summary: Data-backed static site generator
|