soy 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rspec +3 -0
- data/.rubocop.yml +32 -0
- data/CHANGELOG.md +9 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE.txt +21 -0
- data/README.md +125 -0
- data/exe/soy +37 -0
- data/lib/soy/builder.rb +35 -0
- data/lib/soy/page.rb +23 -0
- data/lib/soy/renderer.rb +29 -0
- data/lib/soy/server.rb +61 -0
- data/lib/soy/template/.gitignore +1 -0
- data/lib/soy/template/content/index.html.erb +5 -0
- data/lib/soy/template/views/layout.html.erb +9 -0
- data/lib/soy/version.rb +5 -0
- data/lib/soy.rb +23 -0
- data/sig/sito.rbs +4 -0
- data/soy.gemspec +39 -0
- metadata +109 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d6bd54fbe6410b42d75c37e02b1b31650bb7fd14b41535425b08d9c745b35318
|
4
|
+
data.tar.gz: 2108d0d1526adf9e96830f6ec4fb187653c896793f1ea5ac69ea4da85541d483
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 06bb73badd9937a74e7f452fe282c3497a1471bc144ec17106bd49d4f080746fa512ab59862e5504cbc7d650913fe87c5c54b27a6f0ed8e6495dfdbc04cce0d7
|
7
|
+
data.tar.gz: e6ae9aad16345d5e04bc3bc6d2736e87633ae45bdbbb43ee6dae9c4c585eff987a71f0375e6230ec37e10fa06035aa3f6265b8e954abcb6d759dfb518ef94d51
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require:
|
2
|
+
- rubocop-rspec
|
3
|
+
- rubocop-rake
|
4
|
+
|
5
|
+
AllCops:
|
6
|
+
NewCops: enable
|
7
|
+
|
8
|
+
Style/StringLiterals:
|
9
|
+
Enabled: true
|
10
|
+
EnforcedStyle: double_quotes
|
11
|
+
|
12
|
+
Style/StringLiteralsInInterpolation:
|
13
|
+
Enabled: true
|
14
|
+
EnforcedStyle: double_quotes
|
15
|
+
|
16
|
+
Layout/LineLength:
|
17
|
+
Max: 120
|
18
|
+
|
19
|
+
Metrics/BlockLength:
|
20
|
+
Exclude:
|
21
|
+
- "soy.gemspec"
|
22
|
+
- "spec/**/*.rb"
|
23
|
+
|
24
|
+
Metrics/MethodLength:
|
25
|
+
Max: 20
|
26
|
+
|
27
|
+
RSpec/MultipleExpectations:
|
28
|
+
Enabled: false
|
29
|
+
|
30
|
+
RSpec/ExampleLength:
|
31
|
+
Exclude:
|
32
|
+
- "spec/system/**/*_spec.rb"
|
data/CHANGELOG.md
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
6
|
+
|
7
|
+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
8
|
+
|
9
|
+
## Our Standards
|
10
|
+
|
11
|
+
Examples of behavior that contributes to a positive environment for our community include:
|
12
|
+
|
13
|
+
* Demonstrating empathy and kindness toward other people
|
14
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
15
|
+
* Giving and gracefully accepting constructive feedback
|
16
|
+
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
17
|
+
* Focusing on what is best not just for us as individuals, but for the overall community
|
18
|
+
|
19
|
+
Examples of unacceptable behavior include:
|
20
|
+
|
21
|
+
* The use of sexualized language or imagery, and sexual attention or
|
22
|
+
advances of any kind
|
23
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
24
|
+
* Public or private harassment
|
25
|
+
* Publishing others' private information, such as a physical or email
|
26
|
+
address, without their explicit permission
|
27
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
28
|
+
professional setting
|
29
|
+
|
30
|
+
## Enforcement Responsibilities
|
31
|
+
|
32
|
+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
33
|
+
|
34
|
+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
35
|
+
|
36
|
+
## Scope
|
37
|
+
|
38
|
+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
|
39
|
+
|
40
|
+
## Enforcement
|
41
|
+
|
42
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at brettchalupa@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
|
43
|
+
|
44
|
+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
45
|
+
|
46
|
+
## Enforcement Guidelines
|
47
|
+
|
48
|
+
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
49
|
+
|
50
|
+
### 1. Correction
|
51
|
+
|
52
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
|
53
|
+
|
54
|
+
**Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
|
55
|
+
|
56
|
+
### 2. Warning
|
57
|
+
|
58
|
+
**Community Impact**: A violation through a single incident or series of actions.
|
59
|
+
|
60
|
+
**Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
|
61
|
+
|
62
|
+
### 3. Temporary Ban
|
63
|
+
|
64
|
+
**Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
|
65
|
+
|
66
|
+
**Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
|
67
|
+
|
68
|
+
### 4. Permanent Ban
|
69
|
+
|
70
|
+
**Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
|
71
|
+
|
72
|
+
**Consequence**: A permanent ban from any sort of public interaction within the community.
|
73
|
+
|
74
|
+
## Attribution
|
75
|
+
|
76
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
|
77
|
+
available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
78
|
+
|
79
|
+
Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
|
80
|
+
|
81
|
+
[homepage]: https://www.contributor-covenant.org
|
82
|
+
|
83
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
84
|
+
https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2022 Brett Chalupa
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
![Soy mascot Tofu](demo/content/tofu.png)
|
2
|
+
|
3
|
+
# Soy
|
4
|
+
|
5
|
+
**A static-site generator for Rubyists**
|
6
|
+
|
7
|
+
Soy is a program to generate websites. It embraces Ruby by using ERB for making
|
8
|
+
dynamic templates instead of using another templating language.
|
9
|
+
|
10
|
+
## Why / Vision
|
11
|
+
|
12
|
+
_Ugh, another static site generator?!_ I hear you! I do! There are so many
|
13
|
+
static site generators out there, it's almost disturbing.
|
14
|
+
|
15
|
+
But I think there's space for something a little different.
|
16
|
+
|
17
|
+
Most static site generators are centered around Markdown files or HTML files,
|
18
|
+
but I think static websites have a data model and structure to them. Even a
|
19
|
+
simple blog does. And often times there are needs for more complex data models
|
20
|
+
with associations.
|
21
|
+
|
22
|
+
I want Soy to be a data model-driven site generator with support for multiple
|
23
|
+
data stores, from Markdown to `YAML::Store` to maybe things like SQLite. The
|
24
|
+
key is that the data doesn't vary per environment and is checked into the
|
25
|
+
source code since it's used to generate the site.
|
26
|
+
|
27
|
+
I also think Ruby is really joyous to code with, so by leveraging it for
|
28
|
+
templates, it's expressive and powerful. Also, when it comes to defining the
|
29
|
+
data models and helpers, it'll be easy to stand up and validate.
|
30
|
+
|
31
|
+
Of course it's not going to be as fast or as portable as Go or Rust or C but I
|
32
|
+
hope it'll be fast enough and more than friendly to work with.
|
33
|
+
|
34
|
+
I have a lot of ideas for how Soy could evolve, and I'm excited to make it
|
35
|
+
happen.
|
36
|
+
|
37
|
+
Soy is new and actively under development. You could say it's still
|
38
|
+
fermenting...
|
39
|
+
|
40
|
+
## Bugs / Features
|
41
|
+
|
42
|
+
- Write templates in ERB and use the Ruby you know and love
|
43
|
+
- Boot up a server and watch for changes
|
44
|
+
|
45
|
+
## Installation
|
46
|
+
|
47
|
+
Soy requires a modern, stable Ruby, [see ruby-lang.org](https://www.ruby-lang.org/en/downloads/)
|
48
|
+
|
49
|
+
- 3.1.1
|
50
|
+
- 3.0.3
|
51
|
+
- 2.7.5
|
52
|
+
|
53
|
+
1. Install Soy with `gem install soy`
|
54
|
+
2. Create a new site with `soy new YOUR_SITE_NAME`
|
55
|
+
3. Move into it the new site's directory
|
56
|
+
4. Run `soy server` to get to building!
|
57
|
+
|
58
|
+
Your site will then be accessible at [localhost:9292](http://localhost:9292)
|
59
|
+
|
60
|
+
## Usage
|
61
|
+
|
62
|
+
`soy` or `soy help` will output the commands that are available, but the most
|
63
|
+
common ones are:
|
64
|
+
|
65
|
+
- `soy new your_site_name` – create a new site from Soy's basic template
|
66
|
+
- `soy build` – generate the HTML for your site
|
67
|
+
- `soy server` – start up a web server to handle requests & watch for site changes to trigger rebuilds
|
68
|
+
|
69
|
+
## Structure of a Soy Site
|
70
|
+
|
71
|
+
Browse `./demo/` to see a full site, but here's a breakdown of what goes into a Soy site:
|
72
|
+
|
73
|
+
- `build/` – where the HTML is output to & served from locally, don't check this in
|
74
|
+
- `content/` – where pages, images, styles, etc. live
|
75
|
+
- e.g. `index.html.erb`
|
76
|
+
- `views/` – where page layouts live (to be evaluated)
|
77
|
+
- `layout.html.erb` — default HTML page layout
|
78
|
+
|
79
|
+
## Development
|
80
|
+
|
81
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
82
|
+
`rake spec` to run the tests. You can also run `bin/console` for an interactive
|
83
|
+
prompt that will allow you to experiment.
|
84
|
+
|
85
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
86
|
+
|
87
|
+
## Demo Site
|
88
|
+
|
89
|
+
The `./demo/` directory includes a site that can be built with Soy to test
|
90
|
+
works in progress and experiment with new features. It intends to use as many
|
91
|
+
of the features as possible with the project.
|
92
|
+
|
93
|
+
The `bin/soy` binstub can be used to run the local repo's code, so `bin/soy
|
94
|
+
build demo` will build the demo site.
|
95
|
+
|
96
|
+
## Releasing New Versions
|
97
|
+
|
98
|
+
To release a new version, update the version number in `version.rb`, and then run
|
99
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
100
|
+
git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
101
|
+
|
102
|
+
## Contributing
|
103
|
+
|
104
|
+
Bug reports and pull requests are welcome on GitHub at
|
105
|
+
https://github.com/brettchalupa/soy. This project is intended to be a safe,
|
106
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
107
|
+
the [code of
|
108
|
+
conduct](https://github.com/brettchalupa/soy/blob/main/CODE_OF_CONDUCT.md).
|
109
|
+
|
110
|
+
## License
|
111
|
+
|
112
|
+
The gem is available as open source under the terms of the [MIT
|
113
|
+
License](https://opensource.org/licenses/MIT).
|
114
|
+
|
115
|
+
## Code of Conduct
|
116
|
+
|
117
|
+
Everyone interacting in the Soy project's codebases, issue trackers, chat rooms
|
118
|
+
and mailing lists is expected to follow the [code of
|
119
|
+
conduct](https://github.com/brettchalupa/soy/blob/main/CODE_OF_CONDUCT.md).
|
120
|
+
|
121
|
+
## Friends / Enemies
|
122
|
+
|
123
|
+
- Jekyll — a really useful static site generator that uses Liquid for templating, core inspiration
|
124
|
+
- Middleman — Ruby-based site generator that I used years ago and enjoyed
|
125
|
+
- Hugo — really fast and compelling Go static site generator
|
data/exe/soy
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "soy"
|
5
|
+
|
6
|
+
def elapsed
|
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
|
data/lib/soy/builder.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "fileutils"
|
4
|
+
|
5
|
+
module Soy
|
6
|
+
# Builds the static site content
|
7
|
+
class Builder
|
8
|
+
def initialize(project_dir)
|
9
|
+
@project_dir = project_dir
|
10
|
+
@build_dir = "#{@project_dir}/build/"
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
@layout = File.read("#{@project_dir}/views/layout.html.erb")
|
15
|
+
FileUtils.mkdir_p(@build_dir)
|
16
|
+
process_dir("#{@project_dir}/content")
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def process_dir(dir)
|
22
|
+
content = Dir.glob("#{dir}/*")
|
23
|
+
|
24
|
+
content.each do |file|
|
25
|
+
if file =~ /html.erb$/
|
26
|
+
bare_name = file.split("/").last.split(".").first
|
27
|
+
out = Soy::Renderer.new(File.read(file), @layout).render
|
28
|
+
File.write("#{@build_dir}/#{bare_name}.html", out)
|
29
|
+
else
|
30
|
+
FileUtils.cp(file, @build_dir)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/soy/page.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Soy
|
4
|
+
# Container of data for a given page
|
5
|
+
class Page
|
6
|
+
# Create reader and writers for the passed in hash keys
|
7
|
+
def set(args)
|
8
|
+
raise ArgumentError, "must set with a Hash" unless args.is_a?(Hash)
|
9
|
+
|
10
|
+
args.each do |attr, attr_val|
|
11
|
+
self.class.send(:define_method, "#{attr}=".to_sym) do |value|
|
12
|
+
instance_variable_set("@#{attr}", value)
|
13
|
+
end
|
14
|
+
|
15
|
+
self.class.send(:define_method, attr.to_sym) do
|
16
|
+
instance_variable_get("@#{attr}")
|
17
|
+
end
|
18
|
+
|
19
|
+
public_send("#{attr}=".to_sym, attr_val)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/soy/renderer.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "soy/page"
|
4
|
+
|
5
|
+
module Soy
|
6
|
+
# Takes IO objects and runs them through ERB
|
7
|
+
class Renderer
|
8
|
+
def initialize(template, layout = nil)
|
9
|
+
@template = template
|
10
|
+
@layout = layout
|
11
|
+
@page = Page.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def render
|
15
|
+
template = _render(@template)
|
16
|
+
_render(@layout) { template }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def _render(template)
|
22
|
+
if template.nil?
|
23
|
+
yield
|
24
|
+
else
|
25
|
+
ERB.new(template).result(binding)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/soy/server.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "listen"
|
4
|
+
require "rack"
|
5
|
+
require "rack/common_logger"
|
6
|
+
require "rack/lint"
|
7
|
+
require "rack/server"
|
8
|
+
require "rack/show_exceptions"
|
9
|
+
|
10
|
+
module Soy
|
11
|
+
# Container of data for a given page
|
12
|
+
class Server
|
13
|
+
def self.start(dir = Dir.pwd)
|
14
|
+
new(dir).call
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(dir)
|
18
|
+
@dir = dir || Dir.pwd
|
19
|
+
@relative_output_dir = "build"
|
20
|
+
@output_dir = "#{@dir}/#{@relative_output_dir}"
|
21
|
+
@builder = Builder.new(@dir)
|
22
|
+
end
|
23
|
+
|
24
|
+
def call
|
25
|
+
@builder.call
|
26
|
+
start_watcher
|
27
|
+
start_server
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def start_watcher
|
33
|
+
puts "Watching for changes in #{@dir}"
|
34
|
+
listener = Listen.to(@dir, ignore: [/#{@relative_output_dir}/]) do |modified, added, removed|
|
35
|
+
puts(modified: modified, added: added, removed: removed)
|
36
|
+
@builder.call
|
37
|
+
end
|
38
|
+
listener.start
|
39
|
+
end
|
40
|
+
|
41
|
+
def start_server
|
42
|
+
puts "Serving files from #{@output_dir}"
|
43
|
+
Rack::Server.start(app: app, Port: 9292)
|
44
|
+
end
|
45
|
+
|
46
|
+
def app
|
47
|
+
Rack::CommonLogger.new(
|
48
|
+
Rack::ShowExceptions.new(
|
49
|
+
Rack::Lint.new(
|
50
|
+
Rack::Static.new(
|
51
|
+
-> { [200, { "Content-Type" => "text/html" }, ["Hello from Soy!"]] },
|
52
|
+
urls: [""],
|
53
|
+
root: @output_dir,
|
54
|
+
index: "index.html"
|
55
|
+
)
|
56
|
+
)
|
57
|
+
)
|
58
|
+
)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
build
|
data/lib/soy/version.rb
ADDED
data/lib/soy.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "soy/builder"
|
4
|
+
require_relative "soy/renderer"
|
5
|
+
require_relative "soy/server"
|
6
|
+
require_relative "soy/version"
|
7
|
+
|
8
|
+
require "erb"
|
9
|
+
|
10
|
+
# Entry point into the library
|
11
|
+
module Soy
|
12
|
+
class Error < StandardError; end
|
13
|
+
|
14
|
+
def self.build(dir)
|
15
|
+
dir ||= Dir.pwd
|
16
|
+
Builder.new(dir).call
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.new_site(name)
|
20
|
+
FileUtils.cp_r("#{__dir__}/soy/template/", name)
|
21
|
+
puts "New Soy site created, view in: #{name}"
|
22
|
+
end
|
23
|
+
end
|
data/sig/sito.rbs
ADDED
data/soy.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/soy/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "soy"
|
7
|
+
spec.version = Soy::VERSION
|
8
|
+
spec.authors = ["Brett Chalupa"]
|
9
|
+
spec.email = ["brettchalupa@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Data-backed static site generator"
|
12
|
+
spec.description = "Static site builder with support for data models, helpers, an admin, and more."
|
13
|
+
spec.homepage = "https://github.com/brettchalupa/soy"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.7.5"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
20
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
26
|
+
(f == __FILE__) ||
|
27
|
+
f.match(
|
28
|
+
%r{\A(?:(?:bin|test|spec|features|demo)/|\.(?:git|travis|circleci)|appveyor|Rakefile|Gemfile)}
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
spec.bindir = "exe"
|
33
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
34
|
+
spec.require_paths = ["lib"]
|
35
|
+
|
36
|
+
spec.add_dependency "listen", "~> 3.7"
|
37
|
+
spec.add_dependency "puma", "~> 5.6.2"
|
38
|
+
spec.add_dependency "rack", "~> 2.2"
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: soy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Brett Chalupa
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: listen
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: puma
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.6.2
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.6.2
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rack
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.2'
|
55
|
+
description: Static site builder with support for data models, helpers, an admin,
|
56
|
+
and more.
|
57
|
+
email:
|
58
|
+
- brettchalupa@gmail.com
|
59
|
+
executables:
|
60
|
+
- soy
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- ".rspec"
|
65
|
+
- ".rubocop.yml"
|
66
|
+
- CHANGELOG.md
|
67
|
+
- CODE_OF_CONDUCT.md
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- exe/soy
|
71
|
+
- lib/soy.rb
|
72
|
+
- lib/soy/builder.rb
|
73
|
+
- lib/soy/page.rb
|
74
|
+
- lib/soy/renderer.rb
|
75
|
+
- lib/soy/server.rb
|
76
|
+
- lib/soy/template/.gitignore
|
77
|
+
- lib/soy/template/content/index.html.erb
|
78
|
+
- lib/soy/template/views/layout.html.erb
|
79
|
+
- lib/soy/version.rb
|
80
|
+
- sig/sito.rbs
|
81
|
+
- soy.gemspec
|
82
|
+
homepage: https://github.com/brettchalupa/soy
|
83
|
+
licenses:
|
84
|
+
- MIT
|
85
|
+
metadata:
|
86
|
+
homepage_uri: https://github.com/brettchalupa/soy
|
87
|
+
source_code_uri: https://github.com/brettchalupa/soy
|
88
|
+
changelog_uri: https://github.com/brettchalupa/soy/blob/main/CHANGELOG.md
|
89
|
+
rubygems_mfa_required: 'true'
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 2.7.5
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubygems_version: 3.3.3
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Data-backed static site generator
|
109
|
+
test_files: []
|