geb 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +37 -0
- data/CODE_OF_CONDUCT.md +84 -0
- data/LICENSE +21 -0
- data/README.md +384 -0
- data/Rakefile +21 -0
- data/bin/geb +21 -0
- data/lib/geb/cli.rb +40 -0
- data/lib/geb/commands/build.rb +59 -0
- data/lib/geb/commands/init.rb +70 -0
- data/lib/geb/commands/release.rb +54 -0
- data/lib/geb/commands/remote.rb +48 -0
- data/lib/geb/commands/server.rb +77 -0
- data/lib/geb/commands/upload.rb +48 -0
- data/lib/geb/commands/version.rb +36 -0
- data/lib/geb/config.rb +103 -0
- data/lib/geb/defaults.rb +44 -0
- data/lib/geb/git.rb +112 -0
- data/lib/geb/page.rb +217 -0
- data/lib/geb/partial.rb +150 -0
- data/lib/geb/samples/basic/assets/css/site.css +7 -0
- data/lib/geb/samples/basic/assets/images/android-chrome-192x192.png +0 -0
- data/lib/geb/samples/basic/assets/images/android-chrome-512x512.png +0 -0
- data/lib/geb/samples/basic/assets/images/apple-touch-icon.png +0 -0
- data/lib/geb/samples/basic/assets/images/favicon-16x16.png +0 -0
- data/lib/geb/samples/basic/assets/images/favicon-32x32.png +0 -0
- data/lib/geb/samples/basic/assets/images/favicon.ico +0 -0
- data/lib/geb/samples/basic/assets/images/hero.png +0 -0
- data/lib/geb/samples/basic/assets/images/og-thumb.png +0 -0
- data/lib/geb/samples/basic/assets/images/twitter-thumb.png +0 -0
- data/lib/geb/samples/basic/assets/js/site.js +5 -0
- data/lib/geb/samples/basic/geb.config.yml +70 -0
- data/lib/geb/samples/basic/index.html +11 -0
- data/lib/geb/samples/basic/page.html +11 -0
- data/lib/geb/samples/basic/shared/partials/_analytics.html +9 -0
- data/lib/geb/samples/basic/shared/partials/_footer.html +3 -0
- data/lib/geb/samples/basic/shared/partials/_global_assets.html +19 -0
- data/lib/geb/samples/basic/shared/partials/_header.html +0 -0
- data/lib/geb/samples/basic/shared/partials/_meta_tags.html +34 -0
- data/lib/geb/samples/basic/shared/templates/_blog_post.html +0 -0
- data/lib/geb/samples/basic/shared/templates/_site.html +19 -0
- data/lib/geb/samples/basic/site.webmanifest +1 -0
- data/lib/geb/samples/bootstrap_jquery/assets/css/site.css +7 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/android-chrome-192x192.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/android-chrome-512x512.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/apple-touch-icon.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/favicon-16x16.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/favicon-32x32.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/favicon.ico +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/hero.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/og-thumb.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/images/twitter-thumb.png +0 -0
- data/lib/geb/samples/bootstrap_jquery/assets/js/site.js +5 -0
- data/lib/geb/samples/bootstrap_jquery/blog/blog_post_1.html +35 -0
- data/lib/geb/samples/bootstrap_jquery/blog/blog_post_2.html +35 -0
- data/lib/geb/samples/bootstrap_jquery/blog/blog_post_3.html +35 -0
- data/lib/geb/samples/bootstrap_jquery/blog/index.html +17 -0
- data/lib/geb/samples/bootstrap_jquery/geb.config.yml +69 -0
- data/lib/geb/samples/bootstrap_jquery/index.html +11 -0
- data/lib/geb/samples/bootstrap_jquery/page.html +11 -0
- data/lib/geb/samples/bootstrap_jquery/shared/partials/_analytics.html +9 -0
- data/lib/geb/samples/bootstrap_jquery/shared/partials/_footer.html +3 -0
- data/lib/geb/samples/bootstrap_jquery/shared/partials/_global_assets.html +19 -0
- data/lib/geb/samples/bootstrap_jquery/shared/partials/_header.html +0 -0
- data/lib/geb/samples/bootstrap_jquery/shared/partials/_meta_tags.html +34 -0
- data/lib/geb/samples/bootstrap_jquery/shared/templates/_blog_post.html +0 -0
- data/lib/geb/samples/bootstrap_jquery/shared/templates/_site.html +19 -0
- data/lib/geb/samples/bootstrap_jquery/site.webmanifest +1 -0
- data/lib/geb/samples/geb.config.yml +70 -0
- data/lib/geb/server.rb +138 -0
- data/lib/geb/site/build.rb +189 -0
- data/lib/geb/site/core.rb +229 -0
- data/lib/geb/site/release.rb +70 -0
- data/lib/geb/site/remote.rb +142 -0
- data/lib/geb/site/template.rb +208 -0
- data/lib/geb/site.rb +83 -0
- data/lib/geb/template.rb +166 -0
- data/lib/geb/utilities.rb +110 -0
- data/lib/geb.rb +36 -0
- data/lib/seth.rb +50 -0
- data/sig/geb.rbs +4 -0
- data/test/api tests/test_cli.rb +200 -0
- data/test/api tests/test_config.rb +330 -0
- data/test/api tests/test_defaults.rb +62 -0
- data/test/api tests/test_git.rb +105 -0
- data/test/api tests/test_page.rb +320 -0
- data/test/api tests/test_partial.rb +152 -0
- data/test/api tests/test_server.rb +416 -0
- data/test/api tests/test_site.rb +1315 -0
- data/test/api tests/test_template.rb +249 -0
- data/test/api tests/test_utilities.rb +162 -0
- data/test/command tests/test_geb_build.rb +199 -0
- data/test/command tests/test_geb_init.rb +312 -0
- data/test/command tests/test_geb_release.rb +166 -0
- data/test/command tests/test_geb_remote.rb +66 -0
- data/test/command tests/test_geb_server.rb +122 -0
- data/test/command tests/test_geb_upload.rb +96 -0
- data/test/command tests/test_geb_version.rb +58 -0
- data/test/support/geb_api_test.rb +37 -0
- data/test/support/geb_cli_test.rb +275 -0
- data/test/support/geb_minitest_ext.rb +35 -0
- data/test/support/geb_test_helpers.rb +84 -0
- data/test/support/geb_web_server_proxy.rb +128 -0
- data/test/test_helper.rb +61 -0
- metadata +301 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4160107ecc6dd44417d6b681fe18e036017228f08d2575245dda26d56b21cacd
|
4
|
+
data.tar.gz: 9dac2e2d7e5c0c2ccdebc40d7092ed1d388236a42ea3a95bb1d12b2683fa124c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8167a7321d3cfabe53e26b06f4c7524b5c0b3626cb27aa4ac387c97a78edb700a3f15610c04f9045653eea1b3bee24db88327de39ff451a4b431ffdcc1d97e5f
|
7
|
+
data.tar.gz: 45ea0613c98e977d295b457a73b4fb5dcc554ef0ad4e3f569b2819d88d96e06d70737cb58d00927c8a8c62f37d1ad55f349c49a9568aacadda373740941f6801
|
data/.yardopts
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
### Added
|
10
|
+
- N/A
|
11
|
+
|
12
|
+
### Changed
|
13
|
+
- N/A
|
14
|
+
|
15
|
+
### Deprecated
|
16
|
+
- N/A
|
17
|
+
|
18
|
+
### Removed
|
19
|
+
- N/A
|
20
|
+
|
21
|
+
### Fixed
|
22
|
+
- N/A
|
23
|
+
|
24
|
+
### Security
|
25
|
+
- N/A
|
26
|
+
|
27
|
+
## [0.1.11] - 2024-07-04
|
28
|
+
### Added
|
29
|
+
- Initial release of Geb with core features for managing and building static websites.
|
30
|
+
- Command-line interface
|
31
|
+
- Support for initializing new sites with `geb init`.
|
32
|
+
- Site building capabilities with `geb build` and `geb release`.
|
33
|
+
- Local server for previewing sites with `geb server`.
|
34
|
+
- Remote upload functionality with `geb upload`.
|
35
|
+
- Built-in site templates including "basic" and "bootstrap_jquery".
|
36
|
+
- Configuration file support with `geb.config.yml`.
|
37
|
+
- Documentation and examples for site structure, pages, templates, and partials.
|
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 edin@actiontwelve.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
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Edin Mustajbegovic <edin@actiontewelve.com>
|
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/README.md
ADDED
@@ -0,0 +1,384 @@
|
|
1
|
+
# Geb
|
2
|
+
|
3
|
+
Geb is a powerful and intuitive static website manager and builder named after the ancient Egyptian god Geb, the deity of the Earth. Just as Geb provides a stable foundation for the world, our software offers a robust and essential foundation for building and managing static websites, which form the very bedrock of the web.
|
4
|
+
|
5
|
+
Geb provides a seamless command line interface, making it easy to create, build, and manage your static websites with efficiency and ease. Whether you are a seasoned developer or a beginner, Geb provides the tools and templates to help you get started quickly and effectively.
|
6
|
+
|
7
|
+
![Geb Logo](lib/geb/samples/basic/assets/images/hero.png)
|
8
|
+
|
9
|
+
With Geb, you can harness the power of site templates to streamline your workflow, ensuring your websites are not only beautiful but also maintainable. Our built-in templates, along with the ability to use previous projects as templates, provide unparalleled flexibility and reusability, enabling you to focus on what matters most: creating amazing content and user experiences.
|
10
|
+
|
11
|
+
## Table of Contents
|
12
|
+
|
13
|
+
- [Installation](#installation)
|
14
|
+
- [Usage](#usage)
|
15
|
+
- [Geb Site Configuration](#geb-site-configuration)
|
16
|
+
- [Site Templates](#site-templates)
|
17
|
+
- [Built-in site templates](#built-in-site-templates)
|
18
|
+
- [Previous project as a template](#previous-project-as-a-template)
|
19
|
+
- [Publishing and using templates](#publishing-and-using-templates)
|
20
|
+
- [Basic Site Structure](#basic-site-structure)
|
21
|
+
- [Pages, Templates and Partials](#pages-templates-and-partials)
|
22
|
+
- [Page Example](#page-example)
|
23
|
+
- [Template Example](#template-example)
|
24
|
+
- [Partial Example](#partial-example)
|
25
|
+
- [Result Page](#result-page)
|
26
|
+
- [Discussion and key takeaways](#discussion-and-key-takeaways)
|
27
|
+
- [Command Reference](#command-reference)
|
28
|
+
- [Roadmap](#roadmap)
|
29
|
+
- [Development](#development)
|
30
|
+
- [Contributing](#contributing)
|
31
|
+
- [License](#license)
|
32
|
+
- [Code of Conduct](#code-of-conduct)
|
33
|
+
|
34
|
+
## Installation
|
35
|
+
|
36
|
+
Installing geb is as simple as installing a Ruby Gem
|
37
|
+
```bash
|
38
|
+
$ gem install geb
|
39
|
+
```
|
40
|
+
|
41
|
+
If you would like to install geb from source, follow the following steps
|
42
|
+
```bash
|
43
|
+
# clone the repository
|
44
|
+
$ git clone https://github.com/mainfram-work/geb.git
|
45
|
+
$ cd geb
|
46
|
+
|
47
|
+
# install dependencies
|
48
|
+
$ bundle install
|
49
|
+
|
50
|
+
# make sure everything works
|
51
|
+
$ rake test
|
52
|
+
|
53
|
+
# build and install the geb gem
|
54
|
+
$ rake build
|
55
|
+
$ rake install
|
56
|
+
```
|
57
|
+
|
58
|
+
## Usage
|
59
|
+
|
60
|
+
Geb has several commands to help you manage your site. running "geb help" will list the available commands.
|
61
|
+
```bash
|
62
|
+
$ geb help
|
63
|
+
Commands:
|
64
|
+
geb build # Build the full site, includes pages and assets
|
65
|
+
geb init SITE_PATH # Initialise geb site, creates folder locations, git repository and initial file structures
|
66
|
+
geb release # Builds the release version of the site (pages and assets)
|
67
|
+
geb remote # Launch remote ssh session using the config file settings
|
68
|
+
geb server # Start a local server to view the site output (runs build first), uses webrick
|
69
|
+
geb upload # Upload the site to the remote server
|
70
|
+
geb version # Print version
|
71
|
+
```
|
72
|
+
|
73
|
+
To get help for a particular command simply run.
|
74
|
+
```bash
|
75
|
+
$ geb [command] --help
|
76
|
+
```
|
77
|
+
|
78
|
+
The basic geb workflow is as follows.
|
79
|
+
|
80
|
+
```bash
|
81
|
+
# initialize a new site in the directory nexthing
|
82
|
+
$ geb init nexthing
|
83
|
+
$ cd nexthing
|
84
|
+
|
85
|
+
# build the site
|
86
|
+
$ geb build
|
87
|
+
|
88
|
+
# start a local web server to access your built site
|
89
|
+
$ geb server
|
90
|
+
|
91
|
+
# build a release version of the site
|
92
|
+
$ geb release
|
93
|
+
|
94
|
+
# upload the released site to your remote server
|
95
|
+
$ geb upload
|
96
|
+
```
|
97
|
+
|
98
|
+
All geb commands (other than the `geb init` command) are executed with the project directory. Geb looks for the site root by finding the `geb.config.yml` file up the directory tree.
|
99
|
+
|
100
|
+
## Geb Site Configuration
|
101
|
+
|
102
|
+
Every Geb site has a configuration file at the root of the site. The file is called `geb.config.yml`
|
103
|
+
The geb command will use values in the configuration file over the default values in almost all cases.
|
104
|
+
|
105
|
+
Check out a [sample geb configuration file](lib/geb/samples/geb.config.yml) for a detailed description of all configuration items.
|
106
|
+
|
107
|
+
## Site Templates
|
108
|
+
|
109
|
+
### Built-in site templates
|
110
|
+
|
111
|
+
Geb has a concept of site templates. Think of it as a way to share site designs, libraries and content.
|
112
|
+
Geb comes with a set of site templates, distributed with the geb gem. These are:
|
113
|
+
|
114
|
+
- **basic** - this is a default template, that provides a simple site structure and placeholders for various concepts such as headers, footers, javascript and CSS and so on.
|
115
|
+
- **bootstrap_jquery** - a site template with Bootstrap 5 and JQuery 3.7, along with example pages.
|
116
|
+
|
117
|
+
To use one of the built-in templates, simply pass the name to the `geb init` command
|
118
|
+
```bash
|
119
|
+
$ geb init new_site --template bootstrap_jquery
|
120
|
+
```
|
121
|
+
If you do not specify a site template, geb will use the **basic** template that comes bundled with the geb gem.
|
122
|
+
|
123
|
+
### Previous project as a template
|
124
|
+
|
125
|
+
Site templates can also be other sites you have developed. To use a previous project as a basis for some new project, you will need the following.
|
126
|
+
|
127
|
+
First, the project you wish to use as a template needs to have `template_paths` configured within its `geb.config.yml` file.
|
128
|
+
Here is an example.
|
129
|
+
```yaml
|
130
|
+
# if you want to share the site as a template site, specify which files and directories
|
131
|
+
# are part of the template.
|
132
|
+
template_paths: ["assets", "shared", "*.html", "site.webmanifest"]
|
133
|
+
```
|
134
|
+
|
135
|
+
To use a previous project as a site template, simply pass it to the `geb init` command
|
136
|
+
```bash
|
137
|
+
$ geb init new_site --template ~/projects/other_site
|
138
|
+
```
|
139
|
+
|
140
|
+
### Publishing and using templates
|
141
|
+
|
142
|
+
To publish the site template along with your site, you will need to specify the `template_paths` configuration within the `geb.config.yml` file and package the template using the `geb release` command
|
143
|
+
```bash
|
144
|
+
$ cd ~/projects/new_site
|
145
|
+
$ geb release --with_template
|
146
|
+
```
|
147
|
+
Geb will generate `geb-template.tar.gz` within the site release directory, which you can then upload using `geb upload` command or what other mechanisms you plan to use to deploy the finished site.
|
148
|
+
|
149
|
+
To use an already published template, simply pass the site URL to `geb init` command.
|
150
|
+
```bash
|
151
|
+
$ geb init new_site --template http://www.some_website.com/
|
152
|
+
```
|
153
|
+
|
154
|
+
You can either pass the URL to the *geb-template.tar.gz*. Geb will try the URL first and if it doesn't find `geb-template.tar.gz` it will append the filename and try again.
|
155
|
+
|
156
|
+
## Basic Site Structure
|
157
|
+
You can structure a Geb site however you want. The only required directories are `assets` and `output` with `local` and `release` sub-directories. `geb init` command will create these directories.
|
158
|
+
```
|
159
|
+
new_site
|
160
|
+
├── assets # [required] assets directory for images, css, js, etc.
|
161
|
+
├── images # images directory
|
162
|
+
├── css # css directory
|
163
|
+
├── js # js directory
|
164
|
+
├── blog # just a directory to hold blog posts
|
165
|
+
├── index.html # the blog index page
|
166
|
+
├── blog_post_1.html # a sample blog post
|
167
|
+
├── geb.config.yml # [required] the site configuration file
|
168
|
+
├── index.html # site index pag, this page
|
169
|
+
├── page.html # another page
|
170
|
+
├── output # [required] the directory where the built site is output
|
171
|
+
├── local # [required] local build directory, server command uses this as root
|
172
|
+
├── release # [required] release build directory, upload command uploads from here
|
173
|
+
├── shared # shared directory for partials, templates, etc.
|
174
|
+
├── partials # partials directory
|
175
|
+
├── _analytics.html # partial with site analytics
|
176
|
+
├── _footer.html # footer partial
|
177
|
+
├── _global_assets.html # global assets partial (js and css references)
|
178
|
+
├── _header.html # header partial
|
179
|
+
├── _meta_tags.html # site mata tags partial
|
180
|
+
├── templates # templates directory
|
181
|
+
├── _blog_post.html # template for blog pages
|
182
|
+
├── _site.html # template for general site pages
|
183
|
+
├── site.webmanifest # site webmanifest file
|
184
|
+
```
|
185
|
+
All references to assets (image, css, js, etc) as well as links should be **relative **to the **site's** root****
|
186
|
+
|
187
|
+
Files that start with _ are partials or templates and are not meant to be served directly.
|
188
|
+
You won't see these files in the output directory.
|
189
|
+
|
190
|
+
It is possible to configure geb to use different directories for assets or output.
|
191
|
+
However, `geb.config.yml` must be updated to reflect these changes and be located in the site root.
|
192
|
+
Check the [sample geb configuration file](lib/geb/samples/geb.config.yml) for more information.
|
193
|
+
|
194
|
+
The rest is up to you. We like the convention of putting partials and templates in the
|
195
|
+
shared directory, but you can put them anywhere. You can create any directory structure
|
196
|
+
that makes sense for your site.
|
197
|
+
|
198
|
+
## Pages, Templates and Partials
|
199
|
+
|
200
|
+
Below are some examples of how to use pages, templates and partials with Geb.
|
201
|
+
Read the examples first, then the discussion located after the examples.
|
202
|
+
### Page Example
|
203
|
+
Here is a simple page example, in the above site structure this might be `index.html` file
|
204
|
+
```erb
|
205
|
+
<% template: shared/templates/_site.html %>
|
206
|
+
|
207
|
+
<% start: title %>
|
208
|
+
Page Title
|
209
|
+
<% end: title %>
|
210
|
+
|
211
|
+
<% start: content %>
|
212
|
+
This is page content
|
213
|
+
<% partial: shared/partials/_featured_product.html %>
|
214
|
+
<% end: content %>
|
215
|
+
```
|
216
|
+
### Template Example
|
217
|
+
This is a page template example, in the above site structure this might be `shared/templates/_site.html`
|
218
|
+
```erb
|
219
|
+
<!DOCTYPE html>
|
220
|
+
<html>
|
221
|
+
<head>
|
222
|
+
<title><% insert: title %></title>
|
223
|
+
<% partial: shared/partials/_analytics.html %>
|
224
|
+
<% partial: shared/partials/_meta_tags.html %>
|
225
|
+
<% partial: shared/partials/_global_assets.html %>
|
226
|
+
</head>
|
227
|
+
<body>
|
228
|
+
<% partial: shared/partials/_header.html %>
|
229
|
+
<% insert: content %>
|
230
|
+
<% partial: shared/partials/_footer.html %>
|
231
|
+
</body>
|
232
|
+
</html>
|
233
|
+
```
|
234
|
+
### Partial Example
|
235
|
+
This is a page partial example, in the above site structure it could be any file in the `shared/partials` directory.
|
236
|
+
```erb
|
237
|
+
<h1>Best Product Ever<h1>
|
238
|
+
<p>This is the best product ever</p>
|
239
|
+
<% partial: shared/partials/_product_analytics.html %>
|
240
|
+
```
|
241
|
+
### Result Page
|
242
|
+
Below is the Page Example above, processed by `geb build` command.
|
243
|
+
```html
|
244
|
+
<!DOCTYPE html>
|
245
|
+
<html>
|
246
|
+
<head>
|
247
|
+
<title>Page Title</title>
|
248
|
+
<!-- content from shared/partials/_analytics.html -->
|
249
|
+
<!-- content from shared/partials/_meta_tags.html -->
|
250
|
+
<!-- content from shared/partials/_global_assets.html -->
|
251
|
+
</head>
|
252
|
+
<body>
|
253
|
+
<!-- content from shared/partials/_header.html -->
|
254
|
+
This is page content
|
255
|
+
<h1>Best Product Ever<h1>
|
256
|
+
<p>This is the best product ever</p>
|
257
|
+
<!-- content from shared/partials/_product_analytics.html -->
|
258
|
+
<!-- content from shared/partials/_footer.html -->
|
259
|
+
</body>
|
260
|
+
</html>
|
261
|
+
```
|
262
|
+
### Discussion and key takeaways
|
263
|
+
|
264
|
+
- Pages are the actual content of the site. They are the only files that are served directly.
|
265
|
+
- The example page above uses a template found in /shared/templates/_site.html
|
266
|
+
- Templates are used to wrap pages in a common structure. They are not served directly.
|
267
|
+
- The example template above has two content blocks, title and content.
|
268
|
+
- The page above has those content areas filled in with whatever is required
|
269
|
+
- Page start: what_ever_name and template insert: what_ever_name must have matching "names"
|
270
|
+
- If a page uses a template, the template must be defined at the top of the page.
|
271
|
+
- If a page uses a template, any content not in a "start: what_ever_name" -> "end: what_ever_name" block is ignored.
|
272
|
+
- Obviously, the "start: what_ever_name" -> "end: what_ever_name" must have matching "names"
|
273
|
+
- Partials are used to include common content in pages and templates. They are not served directly.
|
274
|
+
- Partials can be nested, but be careful not to create circular references.
|
275
|
+
- That's about it... happy coding!
|
276
|
+
|
277
|
+
## Command Reference
|
278
|
+
|
279
|
+
### geb build
|
280
|
+
Build the full site, includes pages and assets.
|
281
|
+
```bash
|
282
|
+
$ geb build [--skip_assets] [--skip_pages]
|
283
|
+
```
|
284
|
+
- `--skip_assets`: Skip building assets (images, css, js)
|
285
|
+
- `--skip_pages`: Skip building pages
|
286
|
+
|
287
|
+
### geb init
|
288
|
+
Initialise geb site, creates folder locations, git repository and initial file structures.
|
289
|
+
```bash
|
290
|
+
$ geb init SITE_PATH [--template=VALUE] [--skip-template] [--skip-git] [--force]
|
291
|
+
```
|
292
|
+
- `--template=VALUE`: Template site, either a path or one of the following: bootstrap_jquery, basic
|
293
|
+
- `--[no-]skip-template`: Skip generating a site from template
|
294
|
+
- `--[no-]skip-git`: Skip initialising git repository
|
295
|
+
- `--[no-]force`: Force overwrite of existing files and git repository
|
296
|
+
|
297
|
+
### geb release
|
298
|
+
Builds the release version of the site (pages and assets).
|
299
|
+
```bash
|
300
|
+
$ geb release [--with_template]
|
301
|
+
```
|
302
|
+
- `--with_template`: Build the release site with a template archive
|
303
|
+
|
304
|
+
### geb remote
|
305
|
+
Launch remote ssh session using the config file settings.
|
306
|
+
```bash
|
307
|
+
$ geb remote
|
308
|
+
```
|
309
|
+
|
310
|
+
### geb server
|
311
|
+
Start a local server to view the site output (runs build first), uses webrick.
|
312
|
+
```bash
|
313
|
+
$ geb server [--port=PORT] [--skip-build] [--skip-auto-build]
|
314
|
+
```
|
315
|
+
- `--port=PORT`: Port to run the server on
|
316
|
+
- `--[no-]skip-build`: Skip building the site before starting the server
|
317
|
+
- `--[no-]skip-auto-build`: Don't automatically rebuild the site when a file changes
|
318
|
+
|
319
|
+
### geb upload
|
320
|
+
Upload the site to the remote server.
|
321
|
+
```bash
|
322
|
+
$ geb upload
|
323
|
+
```
|
324
|
+
|
325
|
+
### geb version
|
326
|
+
Print the current version of Geb.
|
327
|
+
```bash
|
328
|
+
$ geb version
|
329
|
+
```
|
330
|
+
|
331
|
+
## Roadmap
|
332
|
+
|
333
|
+
This roadmap outlines the planned features and improvements for future versions of Geb. The timeline and features are subject to change based on feedback and development priorities.
|
334
|
+
|
335
|
+
### Version 0.3.0
|
336
|
+
**Target Release Date:** Sometime in September 2024
|
337
|
+
|
338
|
+
**Planned Features**
|
339
|
+
- **Template Enhancements**: Improve the existing templates and add more templates for various types of websites.
|
340
|
+
- **Plugin Support**: Introduce a plugin system to extend Geb's functionality.
|
341
|
+
- **Improved Documentation**: Expand the documentation with more examples and tutorials.
|
342
|
+
|
343
|
+
**Improvements**
|
344
|
+
- **Windows Support**: Test and build Geb on windows operating system
|
345
|
+
- **Better Testing**: Ability to better test `geb upload` and `geb remote` commands.
|
346
|
+
|
347
|
+
## Development
|
348
|
+
|
349
|
+
After checking out the repo, run `bin/setup` which just runs `bundle install` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
350
|
+
|
351
|
+
Gab has the following dependencies
|
352
|
+
|
353
|
+
- `Ruby >= 3.0.0`
|
354
|
+
- [dry/cli](https://dry-rb.org/gems/dry-cli/1.0/) - a general-purpose framework for developing Command Line Interface (CLI) applications.
|
355
|
+
- [Webrick](https://github.com/ruby/webrick) - an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.
|
356
|
+
- [Listen](https://github.com/guard/listen) - gem listens to file modifications and notifies you about the changes.
|
357
|
+
|
358
|
+
The development environment has the following dependencies:
|
359
|
+
|
360
|
+
- [Rake](https://ruby.github.io/rake/) - a Make-like program implemented in Ruby.
|
361
|
+
- [minitest](https://github.com/minitest/minitest) - provides a complete suite of testing facilities supporting TDD, BDD, mocking, and benchmarking.
|
362
|
+
- [webmock](https://github.com/bblimke/webmock) - library for stubbing and setting expectations on HTTP requests in Ruby.
|
363
|
+
- [mocha](https://github.com/freerange/mocha) - a Ruby library for mocking and stubbing.
|
364
|
+
- [simplecov](https://github.com/simplecov-ruby/simplecov) - a code coverage analysis tool for Ruby.
|
365
|
+
- [yard](https://yardoc.org) - a Ruby documentation tool.
|
366
|
+
|
367
|
+
To install this gem onto your local machine, run `bundle exec rake build` and then `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
368
|
+
|
369
|
+
You can generate documentation by running `yard doc` and then using `yard server` to view the documentation. Running `rake test` will also generate a coverage report. To view the coverage report, just `open coverage/index.html` from the project directory.
|
370
|
+
|
371
|
+
Happy hacking :)
|
372
|
+
|
373
|
+
## Contributing
|
374
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mainfram-work/geb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/mainfram-work/geb/blob/main/CODE_OF_CONDUCT.md).
|
375
|
+
|
376
|
+
## License
|
377
|
+
|
378
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
379
|
+
|
380
|
+
## Code of Conduct
|
381
|
+
|
382
|
+
Everyone interacting in the Geb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mainfram-work/geb/blob/main/CODE_OF_CONDUCT.md).
|
383
|
+
|
384
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# -----------------------------------------------------------------------------
|
3
|
+
# Ruby Gem: Geb
|
4
|
+
# Author: Edin Mustajbegovic
|
5
|
+
# Email: edin@actiontwelve.com
|
6
|
+
#
|
7
|
+
# Geb gem rakefile
|
8
|
+
#
|
9
|
+
# Licence MIT
|
10
|
+
# -----------------------------------------------------------------------------
|
11
|
+
|
12
|
+
# include the gem tasks
|
13
|
+
require "bundler/gem_tasks"
|
14
|
+
require "minitest/test_task"
|
15
|
+
# no need to require bundler/setup, it's already done in the gemspec
|
16
|
+
|
17
|
+
# setup the test task
|
18
|
+
Minitest::TestTask.create
|
19
|
+
|
20
|
+
# setup the default task (so we don't have to do rake test, just rake will do)
|
21
|
+
task default: :test
|
data/bin/geb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# Main executable file for the geb utility
|
5
|
+
#
|
6
|
+
# @title Geb Executable
|
7
|
+
# @author Edin Mustajbegovic <edin@actiontwelve.com>
|
8
|
+
# @copyright 2024 Edin Mustajbegovic
|
9
|
+
# @license MIT
|
10
|
+
#
|
11
|
+
# @see https://github.com/mainfram-work/geb for more information
|
12
|
+
|
13
|
+
# make sure global encoding is set to UTF-8, we will be working with files alot.
|
14
|
+
Encoding.default_external = Encoding::UTF_8
|
15
|
+
Encoding.default_internal = Encoding::UTF_8
|
16
|
+
|
17
|
+
# include the libraries
|
18
|
+
require_relative "../lib/geb"
|
19
|
+
|
20
|
+
# run the CLI
|
21
|
+
Dry::CLI.new(Geb::CLI::Commands).call
|
data/lib/geb/cli.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# The CLI Registry class, registers all the commands and their alises with
|
4
|
+
# the Dry::CLI framework.
|
5
|
+
#
|
6
|
+
# @title Geb - Command Registry
|
7
|
+
# @author Edin Mustajbegovic <edin@actiontwelve.com>
|
8
|
+
# @copyright 2024 Edin Mustajbegovic
|
9
|
+
# @license MIT
|
10
|
+
#
|
11
|
+
# @see https://github.com/mainfram-work/geb for more information
|
12
|
+
|
13
|
+
# include geb commands
|
14
|
+
require_relative "commands/version"
|
15
|
+
require_relative "commands/build"
|
16
|
+
require_relative "commands/release"
|
17
|
+
require_relative "commands/server"
|
18
|
+
require_relative "commands/init"
|
19
|
+
require_relative "commands/upload"
|
20
|
+
require_relative "commands/remote"
|
21
|
+
|
22
|
+
module Geb
|
23
|
+
module CLI
|
24
|
+
module Commands
|
25
|
+
|
26
|
+
# this is the mail CLI registry class
|
27
|
+
extend Dry::CLI::Registry
|
28
|
+
|
29
|
+
# register all the commands and their aliases
|
30
|
+
register "release", Geb::CLI::Commands::Release, aliases: ["r", "-r", "--release"]
|
31
|
+
register "build", Geb::CLI::Commands::Build, aliases: ["b", "-b", "--build"]
|
32
|
+
register "server", Geb::CLI::Commands::Server, aliases: ["s", "-s", "--server"]
|
33
|
+
register "init", Geb::CLI::Commands::Init
|
34
|
+
register "upload", Geb::CLI::Commands::Upload, aliases: ["u", "-u", "--upload"]
|
35
|
+
register "remote", Geb::CLI::Commands::Remote
|
36
|
+
register "version", Geb::CLI::Commands::Version, aliases: ["v", "-v", "--version"]
|
37
|
+
|
38
|
+
end # module Commands
|
39
|
+
end # module CLI
|
40
|
+
end # module Geb
|