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
@@ -0,0 +1,35 @@
|
|
1
|
+
<% template: shared/templates/_blog_post.html %>
|
2
|
+
|
3
|
+
<% start: title %>
|
4
|
+
Blog Post 1
|
5
|
+
<% end: title %>
|
6
|
+
|
7
|
+
<% start: content %>
|
8
|
+
|
9
|
+
<h1>Blog Post 1 Title</h1>
|
10
|
+
|
11
|
+
<p class="lead">
|
12
|
+
This is the first blog post. It is very interesting and you should read it.
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<p>
|
16
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac purus nec
|
17
|
+
libero ultrices ultricies. Nullam nec nunc nec nunc ultricies ultricies. Ut
|
18
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
19
|
+
ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc
|
20
|
+
ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc
|
21
|
+
nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut
|
22
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<p>
|
26
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac purus nec
|
27
|
+
libero ultrices ultricies. Nullam nec nunc nec nunc ultricies ultricies. Ut
|
28
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
29
|
+
ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc
|
30
|
+
ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc
|
31
|
+
nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut
|
32
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
33
|
+
</p>
|
34
|
+
|
35
|
+
<% end: content %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% template: shared/templates/_blog_post.html %>
|
2
|
+
|
3
|
+
<% start: title %>
|
4
|
+
Blog Post 2
|
5
|
+
<% end: title %>
|
6
|
+
|
7
|
+
<% start: content %>
|
8
|
+
|
9
|
+
<h1>Blog Post 2 Title</h1>
|
10
|
+
|
11
|
+
<p class="lead">
|
12
|
+
This is the second blog post. It is very interesting and you should read it.
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<p>
|
16
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac purus nec
|
17
|
+
libero ultrices ultricies. Nullam nec nunc nec nunc ultricies ultricies. Ut
|
18
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
19
|
+
ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc
|
20
|
+
ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc
|
21
|
+
nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut
|
22
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<p>
|
26
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac purus nec
|
27
|
+
libero ultrices ultricies. Nullam nec nunc nec nunc ultricies ultricies. Ut
|
28
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
29
|
+
ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc
|
30
|
+
ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc
|
31
|
+
nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut
|
32
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
33
|
+
</p>
|
34
|
+
|
35
|
+
<% end: content %>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<% template: shared/templates/_blog_post.html %>
|
2
|
+
|
3
|
+
<% start: title %>
|
4
|
+
Blog Post 3
|
5
|
+
<% end: title %>
|
6
|
+
|
7
|
+
<% start: content %>
|
8
|
+
|
9
|
+
<h1>Blog Post 3 Title</h1>
|
10
|
+
|
11
|
+
<p class="lead">
|
12
|
+
This is the third blog post. It is very interesting and you should read it.
|
13
|
+
</p>
|
14
|
+
|
15
|
+
<p>
|
16
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac purus nec
|
17
|
+
libero ultrices ultricies. Nullam nec nunc nec nunc ultricies ultricies. Ut
|
18
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
19
|
+
ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc
|
20
|
+
ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc
|
21
|
+
nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut
|
22
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
23
|
+
</p>
|
24
|
+
|
25
|
+
<p>
|
26
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla ac purus nec
|
27
|
+
libero ultrices ultricies. Nullam nec nunc nec nunc ultricies ultricies. Ut
|
28
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
29
|
+
ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc
|
30
|
+
ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut eget nunc
|
31
|
+
nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies ultricies. Ut
|
32
|
+
eget nunc nec nunc ultricies ultricies. Ut eget nunc nec nunc ultricies
|
33
|
+
</p>
|
34
|
+
|
35
|
+
<% end: content %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<% template: shared/templates/_site.html %>
|
2
|
+
|
3
|
+
<% start: title %>
|
4
|
+
Blog
|
5
|
+
<% end: title %>
|
6
|
+
|
7
|
+
<% start: content %>
|
8
|
+
|
9
|
+
<h1>Welcome to the Blog</h1>
|
10
|
+
|
11
|
+
<ul>
|
12
|
+
<li><a href="blog_post_1.html">First Blog Post</a></li>
|
13
|
+
<li><a href="blog_post_2.html">Second Blog Post</a></li>
|
14
|
+
<li><a href="blog_post_3.html">Third Blog Post</a></li>
|
15
|
+
</ul>
|
16
|
+
|
17
|
+
<% end: content %>
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
# Geb Configuration File
|
3
|
+
# =======================
|
4
|
+
#
|
5
|
+
# This is a sample configuration file for the geb command line tool.
|
6
|
+
# You pretty much don't have to specify anything in this file, unless you want to
|
7
|
+
# customize the site. The default values are good enough for most sites.
|
8
|
+
#
|
9
|
+
# EVEN IF YOU DON"T SPECIFY ANYTHING IN THIS FILE, THIS CONFIG FILE MUST EXIST
|
10
|
+
# AT THE ROOT OF THE SITE DIRECTORY. OTHERWISE, THE GEB COMMANDS WILL NOT WORK.
|
11
|
+
# IT CAN BE EMPTY, BUT IT MUST EXIST. GEB DEMANDS IT.
|
12
|
+
#
|
13
|
+
# However, remote_uri and remote_path are required if you want to use
|
14
|
+
# the geb remote and upload commands. If you plan to upload the site on your own then
|
15
|
+
# you don't need to specify these values.
|
16
|
+
#
|
17
|
+
|
18
|
+
# Name of the site.
|
19
|
+
# If not specified, the default is the name of the directory where the site is located.
|
20
|
+
# Just for display purposes.
|
21
|
+
#site_name: "My Site"
|
22
|
+
|
23
|
+
# The remote_uri is the SSH URI of the remote server that you are deploying to.
|
24
|
+
# Geb remote and upload commands will use this URI to connect to the server.
|
25
|
+
# If you don't specify a remote_uri, geb remote and upload commands will not work.
|
26
|
+
# Typical format is username@server
|
27
|
+
#remote_uri: "user@server.com"
|
28
|
+
|
29
|
+
# The remote_path is the path on the remote server where the site is located.
|
30
|
+
# If you don't specify a remote_path, upload commands will not work.
|
31
|
+
#remote_path: "/path/to/site"
|
32
|
+
|
33
|
+
# Set the local web server port that the site will run on.
|
34
|
+
# Geb server command will use this port to start the local web server
|
35
|
+
# If you don't specify a port, geb server command auto selects a port
|
36
|
+
#local_port: 4000
|
37
|
+
|
38
|
+
# Specifies the output directory, this directory will be used to store the output of
|
39
|
+
# the build and release commands.
|
40
|
+
# the output directory is relative to the site directory.
|
41
|
+
# The default value is "output"
|
42
|
+
#output_dir: "output"
|
43
|
+
|
44
|
+
# Specifies the assets directory, this directory will be used to store the assets.
|
45
|
+
# The assets directory is relative to the site directory.
|
46
|
+
# The default value is "assets"
|
47
|
+
#assets_dir: "assets"
|
48
|
+
|
49
|
+
# Specifies the page extensions that are used in the site. This can be any text file extension.
|
50
|
+
# Default value is ['.md', '.markdown', '.html', '.htm', '.txt', '.js', '.css']
|
51
|
+
#page_extensions: ["html", "htm", "md", "markdown"]
|
52
|
+
|
53
|
+
# Template and partial identifier is a regular expression that is used to identify the template
|
54
|
+
# and partial files in the site. The default value is /^_/, any filename that starts with an underscore.
|
55
|
+
# These files are processed, but not included in the output directory, local or release.
|
56
|
+
# This setting does not impact template paths below, which are used to share the site as a template,
|
57
|
+
# which will include the template and partial files, if the template_paths includes them.
|
58
|
+
#template_and_partial_identifier: /^_/
|
59
|
+
|
60
|
+
# if you want to share the site as a template site, specify which files and directories
|
61
|
+
# are part of the template.
|
62
|
+
# When you create a new site, these files and directories will be copied to the new site
|
63
|
+
# If you don't specify template_paths, the site will not be shared as a template site and
|
64
|
+
# the geb release --with_template option will not work.
|
65
|
+
# Likewise, for other sites to use this site as a template, you must specify the template_paths.
|
66
|
+
# The site template files will be archived into geb-template.tar.gz file and put within
|
67
|
+
# the release directory.
|
68
|
+
# e.g. template_paths: ["assets", "shared", "*.html", "site.webmanifest"]
|
69
|
+
template_paths: ["assets", "shared", "*.html", "site.webmanifest", "geb.config.yml"]
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
<!-- Global Site Tag (gtag-js) - Google Analytics -->
|
3
|
+
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
|
4
|
+
<script>
|
5
|
+
window.dataLayer = window.dataLayer || [];
|
6
|
+
function gtag() {databayer-push (arguments) ; }
|
7
|
+
gtag( 'js', new Date());
|
8
|
+
gtag( 'config', 'GA_TRACKING_ID' );
|
9
|
+
</script>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!-- Bootstrap icons-->
|
2
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css" rel="stylesheet" >
|
3
|
+
|
4
|
+
<!-- Bootstrap CSS -->
|
5
|
+
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
|
6
|
+
|
7
|
+
<!-- Custom CSS styles -->
|
8
|
+
<link href="_{site_url}_/assets/css/site.css" rel="stylesheet" />
|
9
|
+
|
10
|
+
<!--
|
11
|
+
The Bootstrap JavaScript bundle is not here, but is included in the footer of the page.
|
12
|
+
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
|
13
|
+
-->
|
14
|
+
|
15
|
+
<!-- jQuery -->
|
16
|
+
<script src="https://code.jquery.com/jquery-3.7.1.slim.min.js" integrity="sha256-kmHvs0B+OpCW5GVHUNjv9rOmY0IvSIRcf7zGUDTDQM8=" crossorigin="anonymous"></script>
|
17
|
+
|
18
|
+
<!-- Custom Javascript -->
|
19
|
+
<script src="_{site_url}_/assets/js/site.js"></script>
|
File without changes
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
<!-- Meta tags -->
|
3
|
+
<meta charset="utf-8" />
|
4
|
+
<meta name="generator" content="Geb 1.0.0" />
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
6
|
+
<meta name=”robots” content="index, follow" />
|
7
|
+
<meta name="description" content="_{title}_" />
|
8
|
+
<meta name="keywords" content="geb,geb static site,static site" />
|
9
|
+
<meta name="author" content="Geb, the Egyptian god of earth" />
|
10
|
+
|
11
|
+
<!-- Favicon and site icon -->
|
12
|
+
<link rel="apple-touch-icon" type="image/png" sizes="180x180" href="_{site_url}_/assets/images/apple-touch-icon.png" />
|
13
|
+
<link rel="icon" type="image/png" sizes="32x32" href="_{site_url}_/assets/images/favicon-32x32.png" />
|
14
|
+
<link rel="icon" type="image/png" sizes="16x16" href="_{site_url}_/assets/images/favicon-16x16.png" />
|
15
|
+
<link rel="icon" type="image/x-icon" href="_{site_url}_/assets/images/favicon.ico" />
|
16
|
+
<link rel="shortcut icon" type="image/x-icon" href="_{site_url}_/assets/images/favicon.ico" />
|
17
|
+
|
18
|
+
<!-- Site manifest -->
|
19
|
+
<link rel="canonical" href="_{site_url}_/_{relative_path}_" />
|
20
|
+
<link rel="manifest" type="image/png" href="/site.webmanifest" />
|
21
|
+
|
22
|
+
<!-- Open Graph -->
|
23
|
+
<meta property="og:type" content="website" />
|
24
|
+
<meta property="og:title" content="_{title}_" />
|
25
|
+
<meta property="og:description" content="_{title}_." />
|
26
|
+
<meta property="og:image" content="_{site_url}_/assets/images/og-thumb.png" />
|
27
|
+
|
28
|
+
<!-- Twitter Cards -->
|
29
|
+
<meta name="twitter:card" content="summary_large_image" />
|
30
|
+
<meta name="twitter:site" content="@twitter" />
|
31
|
+
<meta name="twitter:title" content="_{title}_" />
|
32
|
+
<meta name="twitter:description" content="_{title}_" />
|
33
|
+
<meta name="twitter:image" content="_{site_url}_/assets/images/twitter-thumb.png" />
|
34
|
+
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
|
5
|
+
<title><%= insert: title %></title>
|
6
|
+
|
7
|
+
<%= partial: shared/partials/_analytics.html %>
|
8
|
+
<%= partial: shared/partials/_meta_tags.html %>
|
9
|
+
<%= partial: shared/partials/_global_assets.html %>
|
10
|
+
|
11
|
+
</head>
|
12
|
+
<body>
|
13
|
+
|
14
|
+
<%= partial: shared/partials/_header.html %>
|
15
|
+
<%= insert: content %>
|
16
|
+
<%= partial: shared/partials/_footer.html %>
|
17
|
+
|
18
|
+
</body>
|
19
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
{"name":"","short_name":"","icons":[{"src":"/assets/images/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/assets/images/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}
|
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
# Geb Configuration File
|
3
|
+
# =======================
|
4
|
+
#
|
5
|
+
# This is a sample configuration file for the geb command line tool.
|
6
|
+
# You pretty much don't have to specify anything in this file, unless you want to
|
7
|
+
# customize the site. The default values are good enough for most sites.
|
8
|
+
#
|
9
|
+
# EVEN IF YOU DON"T SPECIFY ANYTHING IN THIS FILE, THIS CONFIG FILE MUST EXIST
|
10
|
+
# AT THE ROOT OF THE SITE DIRECTORY. OTHERWISE, THE GEB COMMANDS WILL NOT WORK.
|
11
|
+
# IT CAN BE EMPTY, BUT IT MUST EXIST. GEB DEMANDS IT.
|
12
|
+
#
|
13
|
+
# However, remote_uri and remote_path are required if you want to use
|
14
|
+
# the geb remote and upload commands. If you plan to upload the site on your own then
|
15
|
+
# you don't need to specify these values.
|
16
|
+
#
|
17
|
+
|
18
|
+
# Name of the site.
|
19
|
+
# If not specified, the default is the name of the directory where the site is located.
|
20
|
+
# Just for display purposes.
|
21
|
+
#site_name: "My Site"
|
22
|
+
|
23
|
+
# The remote_uri is the SSH URI of the remote server that you are deploying to.
|
24
|
+
# Geb remote and upload commands will use this URI to connect to the server.
|
25
|
+
# If you don't specify a remote_uri, geb remote and upload commands will not work.
|
26
|
+
# Typical format is username@server
|
27
|
+
#remote_uri: "user@server.com"
|
28
|
+
|
29
|
+
# The remote_path is the path on the remote server where the site is located.
|
30
|
+
# If you don't specify a remote_path, upload commands will not work.
|
31
|
+
#remote_path: "/path/to/site"
|
32
|
+
|
33
|
+
# Set the local web server port that the site will run on.
|
34
|
+
# Geb server command will use this port to start the local web server
|
35
|
+
# If you don't specify a port, geb server command auto selects a port
|
36
|
+
#local_port: 4000
|
37
|
+
|
38
|
+
# Specifies the output directory, this directory will be used to store the output of
|
39
|
+
# the build and release commands.
|
40
|
+
# the output directory is relative to the site directory.
|
41
|
+
# The default value is "output"
|
42
|
+
#output_dir: "output"
|
43
|
+
|
44
|
+
# Specifies the assets directory, this directory will be used to store the assets.
|
45
|
+
# The assets directory is relative to the site directory.
|
46
|
+
# The default value is "assets"
|
47
|
+
#assets_dir: "assets"
|
48
|
+
|
49
|
+
# Specifies the page extensions that are used in the site. This can be any text file extension.
|
50
|
+
# Default value is ['.md', '.markdown', '.html', '.htm', '.txt', '.js', '.css']
|
51
|
+
#page_extensions: ["html", "htm", "md", "markdown"]
|
52
|
+
|
53
|
+
# Template and partial identifier is a regular expression that is used to identify the template
|
54
|
+
# and partial files in the site. The default value is /^_/, any filename that starts with an underscore.
|
55
|
+
# These files are processed, but not included in the output directory, local or release.
|
56
|
+
# This setting does not impact template paths below, which are used to share the site as a template,
|
57
|
+
# which will include the template and partial files, if the template_paths includes them.
|
58
|
+
#template_and_partial_identifier: /^_/
|
59
|
+
|
60
|
+
# if you want to share the site as a template site, specify which files and directories
|
61
|
+
# are part of the template.
|
62
|
+
# When you create a new site, these files and directories will be copied to the new site
|
63
|
+
# If you don't specify template_paths, the site will not be shared as a template site and
|
64
|
+
# the geb release --with_template option will not work.
|
65
|
+
# Likewise, for other sites to use this site as a template, you must specify the template_paths.
|
66
|
+
# The site template files will be archived into geb-template.tar.gz file and put within
|
67
|
+
# the release directory.
|
68
|
+
# e.g. template_paths: ["assets", "shared", "*.html", "site.webmanifest"]
|
69
|
+
#template_paths: []
|
70
|
+
|
data/lib/geb/server.rb
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
#
|
3
|
+
# The http server class. This class is used to run a simple http server
|
4
|
+
# for the Geb gem. It also contains the file monitoring code to automatically.
|
5
|
+
# build the site when a file changes.
|
6
|
+
#
|
7
|
+
# @title Geb - Server
|
8
|
+
# @author Edin Mustajbegovic <edin@actiontwelve.com>
|
9
|
+
# @copyright 2024 Edin Mustajbegovic
|
10
|
+
# @license MIT
|
11
|
+
#
|
12
|
+
# @see https://github.com/mainfram-work/geb for more information
|
13
|
+
|
14
|
+
# include the required libraries
|
15
|
+
require 'webrick'
|
16
|
+
require 'listen'
|
17
|
+
|
18
|
+
module Geb
|
19
|
+
class Server
|
20
|
+
|
21
|
+
# initialise the http server class with the site and port, use auto_build to start the file watcher.
|
22
|
+
# @param site [Geb::Site] the site instance to serve
|
23
|
+
# @param port [Integer] the port to run the server on
|
24
|
+
# @param auto_build [Boolean] whether to start the file watcher
|
25
|
+
def initialize(site, port, auto_build)
|
26
|
+
|
27
|
+
# set the site and port
|
28
|
+
@site = site
|
29
|
+
@port = port
|
30
|
+
|
31
|
+
# get the http server instance and file watcher if auto_build is set
|
32
|
+
@http_server = get_http_server()
|
33
|
+
@file_watcher = auto_build ? get_file_watcher() : nil
|
34
|
+
|
35
|
+
# initialize the http server and file watcher threads
|
36
|
+
@http_server_thread = nil
|
37
|
+
@file_watcher_thread = nil
|
38
|
+
|
39
|
+
end # def initialize
|
40
|
+
|
41
|
+
# start the http server and file watcher
|
42
|
+
def start
|
43
|
+
|
44
|
+
# start the http server in its own thread
|
45
|
+
@http_server_thread = Thread.new { @http_server.start }
|
46
|
+
|
47
|
+
# start the file watcher if it is set in its own thread
|
48
|
+
@file_watcher_thread = @file_watcher ? Thread.new { @file_watcher.start } : nil
|
49
|
+
|
50
|
+
end # def start
|
51
|
+
|
52
|
+
# stop the http server and file watcher
|
53
|
+
def stop
|
54
|
+
|
55
|
+
# shutdown the http server
|
56
|
+
Geb.log "Shutting down http server."
|
57
|
+
@http_server.shutdown
|
58
|
+
@http_server_thread.join
|
59
|
+
|
60
|
+
# shutdown the file watcher
|
61
|
+
Geb.log "Shutting down file watcher." if @file_watcher
|
62
|
+
@file_watcher.stop if @file_watcher
|
63
|
+
@file_watcher_thread.join if @file_watcher_thread
|
64
|
+
|
65
|
+
end # def stop
|
66
|
+
|
67
|
+
private
|
68
|
+
|
69
|
+
# Get an instance of the http server
|
70
|
+
# @return [WEBrick::HTTPServer] the http server instance
|
71
|
+
def get_http_server
|
72
|
+
|
73
|
+
# Create a new WEBrick server
|
74
|
+
server = WEBrick::HTTPServer.new(
|
75
|
+
Port: @port,
|
76
|
+
DocumentRoot: @site.get_site_output_directory()
|
77
|
+
) # WEBrick::HTTPServer.new
|
78
|
+
|
79
|
+
Geb.log "Server running on http://localhost:#{server.config[:Port]}/"
|
80
|
+
|
81
|
+
# return the http server
|
82
|
+
return server
|
83
|
+
|
84
|
+
end # get an instance of the http server
|
85
|
+
|
86
|
+
# Get an instance of the file watcher
|
87
|
+
# @return [Listen] the file watcher instance
|
88
|
+
# @note the file watcher will ignore the output and release directories
|
89
|
+
# @note the file watcher will attempt to rebuild the site when a file changes
|
90
|
+
# @note the file watcher will log any errors to the console, but will not stop watching
|
91
|
+
def get_file_watcher()
|
92
|
+
|
93
|
+
# create a new file watcher and define the block to run when a file changes
|
94
|
+
watcher = Listen.to(@site.site_path) do |modified, added, removed|
|
95
|
+
|
96
|
+
# check if any files have been modified, added or removed
|
97
|
+
if modified.any? || added.any? || removed.any?
|
98
|
+
|
99
|
+
Geb.log "Modified files detected: #{modified}" if modified.any?
|
100
|
+
Geb.log "New files detected: #{added}" if added.any?
|
101
|
+
Geb.log "File removal detected: #{removed}" if removed.any?
|
102
|
+
Geb.log_start "Found changes, rebuilding site ... "
|
103
|
+
|
104
|
+
# attempt to rebuild the site, log any errors but do not stop watching
|
105
|
+
begin
|
106
|
+
|
107
|
+
# rebuild the site, suppress log output
|
108
|
+
Geb.no_log { @site.build() }
|
109
|
+
|
110
|
+
rescue Geb::Error => e
|
111
|
+
Geb.log "\nError rebuilding site: #{e.message}"
|
112
|
+
end # begin rescue
|
113
|
+
|
114
|
+
Geb.log "done."
|
115
|
+
|
116
|
+
end # if
|
117
|
+
|
118
|
+
end # Listen.to(site.site_path) do |modified, added, removed|
|
119
|
+
|
120
|
+
# set ignore the output and release directories, cleanup the paths and make them relative to the site path
|
121
|
+
ignore_output_dir = @site.get_site_output_directory().gsub(@site.site_path, '').gsub(/\A\W+/, '')
|
122
|
+
ignore_release_dir = @site.get_site_release_directory().gsub(@site.site_path, '').gsub(/\A\W+/, '')
|
123
|
+
|
124
|
+
Geb.log "Watching for changes in [#{@site.site_path}]"
|
125
|
+
Geb.log "Ignoring [#{ignore_output_dir}]"
|
126
|
+
Geb.log "Ignoring [#{ignore_release_dir}]"
|
127
|
+
|
128
|
+
# ignore the output directory and the release directory
|
129
|
+
watcher.ignore(%r{^#{Regexp.escape(ignore_output_dir)}})
|
130
|
+
watcher.ignore(%r{^#{Regexp.escape(ignore_release_dir)}})
|
131
|
+
|
132
|
+
# return the file watcher
|
133
|
+
return watcher
|
134
|
+
|
135
|
+
end # def get_file_watcher
|
136
|
+
|
137
|
+
end # class Server
|
138
|
+
end # module Geb
|