sitepress-cli 3.0.1 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sitepress/cli.rb +33 -16
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32ceede4b8b6e20838b244f3444cd761c4d6ce253327fa2724150f37ad8a98b4
|
4
|
+
data.tar.gz: 98f84c60444f09321246f374c1a75de6f5313ae40a13546ec5a6afb7dd1beed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 561ef4a45a3443b81bbae7e2a0c012b530324ccbfca314191e5773b77807b9989651be47e1b645a2310500803cf41c723ee7adf600380d02a02d5ea198264d2c
|
7
|
+
data.tar.gz: 6b72a7a76e1f59b3a11a329029e17c7986e3a8a78fa7abd3bab9b8decfe4759f48edd0f871bf0b6464f0c89bfb31677c2fe2b4b84257d379f385a3c0c3031217
|
data/lib/sitepress/cli.rb
CHANGED
@@ -3,26 +3,43 @@ require "thor"
|
|
3
3
|
module Sitepress
|
4
4
|
# Command line interface for compiling Sitepress sites.
|
5
5
|
class CLI < Thor
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
# Default port address for server port.
|
7
|
+
SERVER_PORT = 8080
|
8
|
+
|
9
|
+
# Default address is public to all IPs.
|
10
|
+
SERVER_BIND_ADDRESS = "0.0.0.0".freeze
|
11
|
+
|
12
|
+
# Default build path for compiler.
|
13
|
+
COMPILE_TARGET_PATH = "./build".freeze
|
14
|
+
|
15
|
+
# Display detailed error messages to the developer. Useful for development environments
|
16
|
+
# where the error should be displayed to the developer so they can debug errors.
|
17
|
+
SERVER_SITE_ERROR_REPORTING = true
|
18
|
+
|
19
|
+
# Reload the site between requests, useful for development environments when
|
20
|
+
# the site has to be rebuilt between requests. Disable in production environments
|
21
|
+
# to run the site faster.
|
22
|
+
SERVER_SITE_RELOADING = true
|
9
23
|
|
10
24
|
include Thor::Actions
|
11
25
|
|
12
26
|
source_root File.expand_path("../../../templates/default", __FILE__)
|
13
27
|
|
14
|
-
option :bind_address, default:
|
15
|
-
option :port, default:
|
28
|
+
option :bind_address, default: SERVER_BIND_ADDRESS, aliases: :a
|
29
|
+
option :port, default: SERVER_PORT, aliases: :p, type: :numeric
|
30
|
+
option :site_reloading, default: SERVER_SITE_RELOADING, aliases: :r, type: :boolean
|
31
|
+
option :site_error_reporting, default: SERVER_SITE_ERROR_REPORTING, aliases: :e, type: :boolean
|
16
32
|
desc "server", "Run preview server"
|
17
33
|
def server
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
34
|
+
# Now boot everything for the Rack server to pickup.
|
35
|
+
initialize! do |app|
|
36
|
+
# Enable Sitepress web error reporting so users have more friendly
|
37
|
+
# error messages instead of seeing a Rails exception.
|
38
|
+
app.config.enable_site_error_reporting = options.fetch("site_error_reporting")
|
39
|
+
|
40
|
+
# Enable reloading the site between requests so we can see changes.
|
41
|
+
app.config.enable_site_reloading = options.fetch("site_reloading")
|
42
|
+
end
|
26
43
|
|
27
44
|
# This will use whatever server is found in the user's Gemfile.
|
28
45
|
Rack::Server.start app: app,
|
@@ -30,7 +47,7 @@ module Sitepress
|
|
30
47
|
Host: options.fetch("bind_address")
|
31
48
|
end
|
32
49
|
|
33
|
-
option :output_path, default:
|
50
|
+
option :output_path, default: COMPILE_TARGET_PATH, type: :string
|
34
51
|
desc "compile", "Compile project into static pages"
|
35
52
|
def compile
|
36
53
|
initialize!
|
@@ -90,9 +107,9 @@ module Sitepress
|
|
90
107
|
rails.config.assets.precompile
|
91
108
|
end
|
92
109
|
|
93
|
-
def initialize!
|
110
|
+
def initialize!(&block)
|
94
111
|
require_relative "boot"
|
95
|
-
app.initialize!
|
112
|
+
app.tap(&block).initialize!
|
96
113
|
end
|
97
114
|
|
98
115
|
def app
|
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: 3.
|
4
|
+
version: 3.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.1.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: 3.1.1
|
55
55
|
description:
|
56
56
|
email:
|
57
57
|
- bradgessler@gmail.com
|