sitepress-cli 3.0.1 → 3.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sitepress/cli.rb +33 -15
  3. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ee2bd48a67bc6bf606f7357f65fc6c920d3fb60801a5b0caac5d5b13fa2203b
4
- data.tar.gz: a69b8b963170095cf9aa92f17bccaf98608597b7e750f8a459ed9c035e233d05
3
+ metadata.gz: adafa93f69a4df962f04b8c152f1a618d888d88ab24f0a5f38f4ed764e425690
4
+ data.tar.gz: f3253a8410e09c78c4c79ec8170e0ceef7dcbd7c60f6af00764fdbd2bb8ee4b1
5
5
  SHA512:
6
- metadata.gz: 4b45a55f55d40164976522ede44ffc0681519a1fcdf818106ca75c68c7358d26dd8958254a690770c7a2e75dc2a8e134ed89ef2a46247343bfd56c1f9cdbf3f6
7
- data.tar.gz: 263ec19e3a608254385a8a6aa8450e8f11062981b6e76153e3e9d929f5d8a6042ea9eefacbea43ed4dab0dfcef8db0fbb4a547d7ad10781d23db281760107c88
6
+ metadata.gz: 44fc44bf4ec51e539d9fde94673e11e28b4f8c21276e11d7014055e9bd6053f3cbb9d89f1d06b6f47267d7be5fb9c9d3222e5c56a78c763d61b8f6d75bb38f19
7
+ data.tar.gz: 71b95d6c6ffafcba9fd1269712d6b18a81c000af51be393b040bb92c06034a48304526a5c758be0711b30f6e75287d540a5c01c76200c17e1147e9e155aaa446
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
- SERVER_DEFAULT_PORT = 8080
7
- SERVER_DEFAULT_BIND_ADDRESS = "0.0.0.0".freeze
8
- COMPILE_DEFAULT_TARGET_PATH = "./build".freeze
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: SERVER_DEFAULT_BIND_ADDRESS, aliases: :a
15
- option :port, default: SERVER_DEFAULT_PORT, aliases: :p, type: :numeric
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
- initialize!
19
-
20
- # Enable Sitepress web error reporting so users have more friendly
21
- # error messages instead of seeing a Rails exception.
22
- app.config.enable_sitepress_error_reporting = true
23
-
24
- # Enable reloading the site between requests so we can see changes.
25
- app.config.enable_site_reloading = true
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: COMPILE_DEFAULT_TARGET_PATH, type: :string
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,8 +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"
112
+ app.tap(&block) if block_given?
95
113
  app.initialize!
96
114
  end
97
115
 
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.0.1
4
+ version: 3.1.3
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-07-24 00:00:00.000000000 Z
11
+ date: 2022-09-12 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.0.1
47
+ version: 3.1.3
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.0.1
54
+ version: 3.1.3
55
55
  description:
56
56
  email:
57
57
  - bradgessler@gmail.com
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.3.7
101
+ rubygems_version: 3.3.20
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Sitepress command line interface and compilation tools for static site.