sitepress-cli 2.0.0.beta1 → 2.0.0.beta6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a82f49b989bacd6a164a8731236b024e8077f2d0aedbbb6d820e458fa5c25d46
|
4
|
+
data.tar.gz: dadfe14d2356ce24be5a37162be5adb596b16d4feeef4d7389b6c32e9ffce024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63232b800cead44c3c80a98b34a65907c98647ceea89147941c231117d3c1530e7b18735731defd1d7b3e0413625e55cf910bcbd11cdaf342c006e2d1ac99426
|
7
|
+
data.tar.gz: 61f98c78d9a4d962803d70793846cbeb5b293e861c1b67e39acbe07893d1bdeaa530b720b5e8edf9ace0dca68475bc42ec6d45c9895b903c2c40e6a69b74f3eb
|
data/lib/sitepress/cli.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require "thor"
|
2
|
-
require_relative "boot"
|
3
2
|
|
4
3
|
module Sitepress
|
5
4
|
# Command line interface for compiling Sitepress sites.
|
@@ -16,7 +15,7 @@ module Sitepress
|
|
16
15
|
option :port, default: SERVER_DEFAULT_PORT, aliases: :p, type: :numeric
|
17
16
|
desc "server", "Run preview server"
|
18
17
|
def server
|
19
|
-
|
18
|
+
initialize!
|
20
19
|
# This will use whatever server is found in the user's Gemfile.
|
21
20
|
Rack::Server.start app: Sitepress::Server,
|
22
21
|
Port: options.fetch("port"),
|
@@ -26,7 +25,7 @@ module Sitepress
|
|
26
25
|
option :output_path, default: COMPILE_DEFAULT_TARGET_PATH, type: :string
|
27
26
|
desc "compile", "Compile project into static pages"
|
28
27
|
def compile
|
29
|
-
|
28
|
+
initialize!
|
30
29
|
# Sprockets compilation
|
31
30
|
logger.info "Sitepress compiling assets"
|
32
31
|
sprockets_manifest(target_path: options.fetch("output_path")).compile precompile_assets
|
@@ -37,13 +36,17 @@ module Sitepress
|
|
37
36
|
|
38
37
|
desc "console", "Interactive project shell"
|
39
38
|
def console
|
40
|
-
|
39
|
+
initialize!
|
41
40
|
# Start's an interactive console.
|
42
41
|
REPL.new(context: configuration).start
|
43
42
|
end
|
44
43
|
|
45
44
|
desc "new PATH", "Create new project at PATH"
|
46
45
|
def new(target)
|
46
|
+
# Peg the generated site to roughly the released version.
|
47
|
+
*segments, _ = Gem::Version.new(Sitepress::VERSION).segments
|
48
|
+
@target_sitepress_version = segments.join(".")
|
49
|
+
|
47
50
|
inside target do
|
48
51
|
directory self.class.source_root, "."
|
49
52
|
run "bundle install"
|
@@ -52,7 +55,7 @@ module Sitepress
|
|
52
55
|
|
53
56
|
desc "version", "Show version"
|
54
57
|
def version
|
55
|
-
say
|
58
|
+
say Sitepress::VERSION
|
56
59
|
end
|
57
60
|
|
58
61
|
private
|
@@ -82,5 +85,10 @@ module Sitepress
|
|
82
85
|
def precompile_assets
|
83
86
|
rails.config.assets.precompile
|
84
87
|
end
|
88
|
+
|
89
|
+
def initialize!
|
90
|
+
require_relative "boot"
|
91
|
+
Sitepress::Server.initialize!
|
92
|
+
end
|
85
93
|
end
|
86
94
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# Getting started
|
2
|
+
|
3
|
+
Welcome to your new Sitepress site! If you know Rails, you'll feel right at home in Sitepress because it's built on top of Rails. There's a few things you'll need to know to get around:
|
4
|
+
|
5
|
+
## Starting the preview server
|
6
|
+
|
7
|
+
First thing you'll want to do is start the preview server:
|
8
|
+
|
9
|
+
```sh
|
10
|
+
$ sitepress server
|
11
|
+
```
|
12
|
+
|
13
|
+
Then open http://127.0.0.1:8080 and you'll see the welcome page.
|
14
|
+
|
15
|
+
## Layouts
|
16
|
+
|
17
|
+
To specify a layout for a page, add a `layout` key to the pages frontmatter. For example, if I create the layout `tech-support`, I'd add the following frontmatter to the top of a page in `pages/support/router.html.md`:
|
18
|
+
|
19
|
+
```md
|
20
|
+
---
|
21
|
+
title: How to fix a router
|
22
|
+
layout: tech-support
|
23
|
+
---
|
24
|
+
|
25
|
+
# How to fix a router
|
26
|
+
|
27
|
+
1. Unplug the router.
|
28
|
+
2. Plug in the router.
|
29
|
+
```
|
30
|
+
|
31
|
+
Sitepress will look for the layout in the `layouts` folder from the `layout` key in the file's frontmatter.
|
32
|
+
|
33
|
+
Additionally, you may use the `render_layout` function in a page, or layout, to nest the layouts. For example, you could:
|
34
|
+
|
35
|
+
```haml
|
36
|
+
---
|
37
|
+
title: How to fix a scanner
|
38
|
+
---
|
39
|
+
= render_layout "tech-support" do
|
40
|
+
%h1 How to fix a scanner
|
41
|
+
|
42
|
+
%ol
|
43
|
+
%li Unplug the scanner.
|
44
|
+
%li Plug in the scanner.
|
45
|
+
```
|
46
|
+
|
47
|
+
The `render_layout` can be used to nest a layout within a layout, which is a very powerful way to compose content pages.
|
48
|
+
|
49
|
+
## File locations
|
50
|
+
|
51
|
+
Like Rails, Sitepress organizes files in certain directories:
|
52
|
+
|
53
|
+
* `pages` - This is where you'll edit the content. All `erb`, `haml`, and `md` files will be rendered and all other files will be served up. Support for other templating languages should work if you add them to the Gemfile and they already work with Rails.
|
54
|
+
|
55
|
+
* `layouts` - Layouts for all pages may be found in this directory. Layouts are great for headers, footer, and other content that you'd otherwise be repeating across the files in `pages`.
|
56
|
+
|
57
|
+
* `helpers` - Complex view code that you don't want to live in `page` or `layouts` can be extracted into helpers and re-used throughout the website. These are just like Rails helpers.
|
58
|
+
|
59
|
+
* `assets` - If you want Sprockets to fingerprint and manage images, stylesheets, or scripts then put them in the `assets` directory.
|
60
|
+
|
61
|
+
* `config` - All configuration files and initializers belong in this directory. The `config/site.rb` file has settings that can be changed for the Sitepress site. Changes made to this file require the `sitepress server` to be restarted.
|
62
|
+
|
63
|
+
## Compiling & publishing the website
|
64
|
+
|
65
|
+
Once you're satisfied with your website and you're ready to compile it into static HTML files, run `sitepress compile` and the website will be built to `./build`.
|
66
|
+
|
67
|
+
## It's just Rails
|
68
|
+
|
69
|
+
Anything you can do in Rails, you can do in Sitepress. If you find yourself needing more Rails for Sitepress, you could try adding it to the `Gemfile` and integrating it into your website. You can also embed and integrate Sitepress into a full-blown Rails app and serve up the content without statically compiling it.
|
70
|
+
|
71
|
+
## More info
|
72
|
+
|
73
|
+
Check out https://sitepress.cc for the latest and most up-to-date Sitepress documentation.
|
data/templates/default/Rakefile
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
## Example deployment script to an Amazon Web Servie S3 bucket.
|
2
|
-
|
3
|
-
# Change the s3_url to whatever bucket you'd like to deploy to.
|
4
|
-
s3_url = "s3://<insert-your-s3-bucket-here>/"
|
2
|
+
s3_bucket_name = "<replace-with-your-bucket-name>"
|
5
3
|
|
6
4
|
desc "Remove all files from the build directory"
|
7
5
|
task :clean do
|
@@ -16,12 +14,12 @@ end
|
|
16
14
|
namespace :publish do
|
17
15
|
desc "Upload ./build/assets to S3 with cache-control headers optimized for assets"
|
18
16
|
task :assets do
|
19
|
-
sh "aws s3 sync ./build/assets
|
17
|
+
sh "aws s3 sync ./build/assets s3://#{s3_bucket_name}/assets --cache-control max-age=31536000"
|
20
18
|
end
|
21
19
|
|
22
20
|
desc "Upload ./build to S3"
|
23
21
|
task :pages do
|
24
|
-
sh "aws s3 sync ./build
|
22
|
+
sh "aws s3 sync ./build s3://#{s3_bucket_name} --exclude 'assets/**' --cache-control max-age=60"
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
File without changes
|
@@ -3,13 +3,16 @@ title: Welcome to Sitepress
|
|
3
3
|
---
|
4
4
|
|
5
5
|
<h3>Website files</h3>
|
6
|
-
<p>All
|
6
|
+
<p>All the website files are in <code><%= site.root_path.expand_path %></code>. If you've built stuff on <a href="https://rubyonrails.org">Rails</a>, you'll feel right at home because Sitepress is actually running on Rails.</p>
|
7
7
|
|
8
8
|
<h3>Assets</h3>
|
9
|
-
<p>There's an asset pipeline at <code><%= site.assets_path.expand_path %></code> where you can put all of your images, stylesheets, and
|
9
|
+
<p>There's an asset pipeline at <code><%= site.assets_path.expand_path %></code> where you can put all of your images, stylesheets, and scripts, which will be compiled and fingerprinted for your deployment via Sprockets.</p>
|
10
10
|
|
11
11
|
<h3>Compile</h3>
|
12
12
|
<p>When you're ready to build the website, run <code>sitepress compile</code> and the website files and assets will all be built and compiled into the <code><%= site.root_path.join("build").expand_path %></code> path.</p>
|
13
13
|
|
14
|
+
<h3>Deploy</h3>
|
15
|
+
<p>An example Rakefile is included at <code><%= site.root_path.join("Rakefile").expand_path %></code> that deploys the build to an AWS S3 bucket. You can customize it to fit your needs or use a completely different deployment pipeline. Whatever floats your boat.</p>
|
16
|
+
|
14
17
|
<h3>Documentation</h3>
|
15
18
|
<p>Check out the <a href="https://sitepress.cc">Sitepress website</a> for help on getting started and documentation. Since Sitepress is also built on top of Rails, most of the <a href="https://guides.rubyonrails.org/action_view_helpers.html">Rails view helpers</a> work too.</p>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sitepress-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sitepress-server
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.0.0.
|
19
|
+
version: 2.0.0.beta6
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.0.0.
|
26
|
+
version: 2.0.0.beta6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,7 +66,8 @@ files:
|
|
66
66
|
- lib/sitepress/repl.rb
|
67
67
|
- sitepress-cli.gemspec
|
68
68
|
- templates/default/.gitignore
|
69
|
-
- templates/default/Gemfile
|
69
|
+
- templates/default/Gemfile.tt
|
70
|
+
- templates/default/README.md
|
70
71
|
- templates/default/Rakefile
|
71
72
|
- templates/default/assets/config/manifest.js
|
72
73
|
- templates/default/assets/images/logo-brown.svg
|
@@ -76,6 +77,7 @@ files:
|
|
76
77
|
- templates/default/config/site.rb
|
77
78
|
- templates/default/helpers/page_helper.rb
|
78
79
|
- templates/default/layouts/layout.html.erb
|
80
|
+
- templates/default/pages/favicon.ico
|
79
81
|
- templates/default/pages/index.html.erb
|
80
82
|
homepage: https://github.com/sitepress/sitepress
|
81
83
|
licenses: []
|