sitepress-cli 4.1.1 → 5.0.0.beta
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/plugin_helpers.rb +59 -0
- data/lib/sitepress/cli.rb +3 -13
- data/lib/sitepress/plugins.rb +76 -0
- data/lib/sitepress/project_template.rb +0 -5
- data/lib/sitepress/repl.rb +4 -5
- data/lib/sitepress-cli.rb +1 -0
- data/sitepress-cli.gemspec +1 -1
- data/templates/default/Gemfile.tt +0 -1
- metadata +10 -15
- data/templates/default/assets/config/manifest.js +0 -3
- /data/templates/default/assets/stylesheets/{site.css.scss → site.css} +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2b74952bd0858a3ba2d642dc8160756ace5783cff8bbd9cb101ae14995e258ff
|
|
4
|
+
data.tar.gz: a1dba56adaa4323102b7ef7fc497536c590c6a0a02fc7f97580227d13b737339
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 020c5ce95d5132ed8cc841a16bf9b3c84a0caf7d477106c35dc12d449280a95311e51fce3727cd5c000281f3e40d0c03963ce7f00e99bc2fca88b81336d68fcc
|
|
7
|
+
data.tar.gz: 9f0862cbc780d3fc60c36c181f8b4afa019a62a1e4cf256bb5c6019c42a0e2d01828b1f9014cc4f3bf339f1a8ff9b905c7e98666480c9a482f47fb536f68e006
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
require "thor"
|
|
2
|
+
|
|
3
|
+
module Sitepress
|
|
4
|
+
class CLI < Thor
|
|
5
|
+
# Helpers for CLI plugin commands.
|
|
6
|
+
#
|
|
7
|
+
# Include this module in your plugin's Thor class to get access
|
|
8
|
+
# to Sitepress configuration, site, and Rails environment.
|
|
9
|
+
#
|
|
10
|
+
# Example:
|
|
11
|
+
#
|
|
12
|
+
# class Sitepress::Deploy::CLI < Thor
|
|
13
|
+
# include Sitepress::CLI::PluginHelpers
|
|
14
|
+
#
|
|
15
|
+
# desc "s3", "Deploy to S3"
|
|
16
|
+
# def s3
|
|
17
|
+
# initialize! # Boot Rails/Sitepress
|
|
18
|
+
# site.resources.each { |r| upload(r) }
|
|
19
|
+
# end
|
|
20
|
+
# end
|
|
21
|
+
#
|
|
22
|
+
module PluginHelpers
|
|
23
|
+
# Boot the Rails/Sitepress environment.
|
|
24
|
+
# Call this at the start of commands that need access to the site.
|
|
25
|
+
#
|
|
26
|
+
# @yield [app] Optional block to configure the app before initialization
|
|
27
|
+
def initialize!(&block)
|
|
28
|
+
require File.expand_path("../boot", __dir__)
|
|
29
|
+
app.tap(&block) if block_given?
|
|
30
|
+
app.initialize! unless app.initialized?
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# The Sitepress::Server Rails application.
|
|
34
|
+
def app
|
|
35
|
+
Sitepress::Server
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# The Sitepress configuration object.
|
|
39
|
+
def configuration
|
|
40
|
+
Sitepress.configuration
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# The configured Site instance.
|
|
44
|
+
def site
|
|
45
|
+
configuration.site
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
# The parent Rails engine (Sitepress::Server or host app).
|
|
49
|
+
def rails
|
|
50
|
+
configuration.parent_engine
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# The Rails logger.
|
|
54
|
+
def logger
|
|
55
|
+
rails.config.logger
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
data/lib/sitepress/cli.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require "thor"
|
|
2
|
+
require "rackup/server"
|
|
2
3
|
|
|
3
4
|
module Sitepress
|
|
4
5
|
# Command line interface for compiling Sitepress sites.
|
|
@@ -42,7 +43,7 @@ module Sitepress
|
|
|
42
43
|
end
|
|
43
44
|
|
|
44
45
|
# This will use whatever server is found in the user's Gemfile.
|
|
45
|
-
|
|
46
|
+
Rackup::Server.start app: app,
|
|
46
47
|
Port: options.fetch("port"),
|
|
47
48
|
Host: options.fetch("bind_address")
|
|
48
49
|
end
|
|
@@ -54,7 +55,7 @@ module Sitepress
|
|
|
54
55
|
initialize!
|
|
55
56
|
|
|
56
57
|
logger.info "Sitepress compiling assets"
|
|
57
|
-
|
|
58
|
+
rails.assets.reveal(full_path: Pathname.new(options.fetch("output_path")).join("assets"))
|
|
58
59
|
|
|
59
60
|
logger.info "Sitepress compiling pages"
|
|
60
61
|
compiler = Compiler::Files.new \
|
|
@@ -110,13 +111,6 @@ module Sitepress
|
|
|
110
111
|
Sitepress.configuration
|
|
111
112
|
end
|
|
112
113
|
|
|
113
|
-
def sprockets_manifest(target_path: )
|
|
114
|
-
target_path = Pathname.new(target_path)
|
|
115
|
-
Sprockets::Manifest.new(rails.assets, target_path.join("assets/manifest.json")).tap do |manifest|
|
|
116
|
-
manifest.environment.logger = logger
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
114
|
def rails
|
|
121
115
|
configuration.parent_engine
|
|
122
116
|
end
|
|
@@ -125,10 +119,6 @@ module Sitepress
|
|
|
125
119
|
rails.config.logger
|
|
126
120
|
end
|
|
127
121
|
|
|
128
|
-
def precompile_assets
|
|
129
|
-
rails.config.assets.precompile
|
|
130
|
-
end
|
|
131
|
-
|
|
132
122
|
def initialize!(&block)
|
|
133
123
|
require_relative "boot"
|
|
134
124
|
app.tap(&block) if block_given?
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
module Sitepress
|
|
2
|
+
# Plugin registry for CLI command extensions.
|
|
3
|
+
#
|
|
4
|
+
# Plugins are discovered via Bundler by looking for gems with
|
|
5
|
+
# `sitepress_plugin: "true"` in their gemspec metadata.
|
|
6
|
+
#
|
|
7
|
+
# Example plugin registration:
|
|
8
|
+
#
|
|
9
|
+
# Sitepress::Plugins.register(
|
|
10
|
+
# name: "deploy",
|
|
11
|
+
# cli: Sitepress::Deploy::CLI,
|
|
12
|
+
# description: "Deploy your site"
|
|
13
|
+
# )
|
|
14
|
+
#
|
|
15
|
+
module Plugins
|
|
16
|
+
class << self
|
|
17
|
+
def registry
|
|
18
|
+
@registry ||= {}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Register a plugin CLI class.
|
|
22
|
+
#
|
|
23
|
+
# @param name [String] The subcommand name (e.g., "deploy")
|
|
24
|
+
# @param cli [Class] A Thor class with the plugin's commands
|
|
25
|
+
# @param description [String] Description shown in `sitepress help`
|
|
26
|
+
def register(name:, cli:, description: nil)
|
|
27
|
+
name = name.to_s
|
|
28
|
+
if registry.key?(name)
|
|
29
|
+
warn "WARNING: Sitepress plugin '#{name}' is already registered, skipping"
|
|
30
|
+
return
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
registry[name] = {
|
|
34
|
+
cli: cli,
|
|
35
|
+
description: description || "#{name} commands"
|
|
36
|
+
}
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Discover and load plugins from Bundler.
|
|
40
|
+
# Looks for gems with `sitepress_plugin: "true"` metadata.
|
|
41
|
+
def discover!
|
|
42
|
+
return unless defined?(Bundler)
|
|
43
|
+
|
|
44
|
+
Bundler.load.specs.each do |spec|
|
|
45
|
+
next unless spec.metadata["sitepress_plugin"] == "true"
|
|
46
|
+
|
|
47
|
+
begin
|
|
48
|
+
require spec.name
|
|
49
|
+
rescue LoadError => e
|
|
50
|
+
warn "WARNING: Could not load Sitepress plugin '#{spec.name}': #{e.message}"
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# List of registered plugin names.
|
|
56
|
+
def registered
|
|
57
|
+
registry.keys
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# Get a specific plugin by name.
|
|
61
|
+
def get(name)
|
|
62
|
+
registry[name.to_s]
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Iterate over all registered plugins.
|
|
66
|
+
def each(&block)
|
|
67
|
+
registry.each(&block)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Clear the registry (useful for testing).
|
|
71
|
+
def reset!
|
|
72
|
+
@registry = {}
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
data/lib/sitepress/repl.rb
CHANGED
|
@@ -7,13 +7,12 @@ module Sitepress
|
|
|
7
7
|
@context = context
|
|
8
8
|
end
|
|
9
9
|
|
|
10
|
-
# Start interactive REPL.
|
|
11
10
|
def start
|
|
12
|
-
|
|
13
|
-
IRB.
|
|
11
|
+
ARGV.clear
|
|
12
|
+
IRB.setup(nil)
|
|
14
13
|
IRB.conf[:PROMPT_MODE] = :SIMPLE
|
|
15
|
-
|
|
16
|
-
IRB.
|
|
14
|
+
workspace = IRB::WorkSpace.new(@context)
|
|
15
|
+
IRB::Irb.new(workspace).run(IRB.conf)
|
|
17
16
|
end
|
|
18
17
|
end
|
|
19
18
|
end
|
data/lib/sitepress-cli.rb
CHANGED
data/sitepress-cli.gemspec
CHANGED
|
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.require_paths = ["lib"]
|
|
23
23
|
|
|
24
24
|
spec.add_runtime_dependency "thor", ">= 1.0.0"
|
|
25
|
-
spec.add_runtime_dependency "
|
|
25
|
+
spec.add_runtime_dependency "rackup", ">= 2.0.0"
|
|
26
26
|
spec.add_runtime_dependency "sitepress-server", spec.version
|
|
27
27
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sitepress-cli
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 5.0.0.beta
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brad Gessler
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date:
|
|
10
|
+
date: 2026-02-20 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: thor
|
|
@@ -24,39 +24,33 @@ dependencies:
|
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
25
|
version: 1.0.0
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
|
-
name:
|
|
27
|
+
name: rackup
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version:
|
|
33
|
-
- - "<"
|
|
34
|
-
- !ruby/object:Gem::Version
|
|
35
|
-
version: 3.0.0
|
|
32
|
+
version: 2.0.0
|
|
36
33
|
type: :runtime
|
|
37
34
|
prerelease: false
|
|
38
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
39
36
|
requirements:
|
|
40
37
|
- - ">="
|
|
41
38
|
- !ruby/object:Gem::Version
|
|
42
|
-
version:
|
|
43
|
-
- - "<"
|
|
44
|
-
- !ruby/object:Gem::Version
|
|
45
|
-
version: 3.0.0
|
|
39
|
+
version: 2.0.0
|
|
46
40
|
- !ruby/object:Gem::Dependency
|
|
47
41
|
name: sitepress-server
|
|
48
42
|
requirement: !ruby/object:Gem::Requirement
|
|
49
43
|
requirements:
|
|
50
44
|
- - '='
|
|
51
45
|
- !ruby/object:Gem::Version
|
|
52
|
-
version:
|
|
46
|
+
version: 5.0.0.beta
|
|
53
47
|
type: :runtime
|
|
54
48
|
prerelease: false
|
|
55
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
56
50
|
requirements:
|
|
57
51
|
- - '='
|
|
58
52
|
- !ruby/object:Gem::Version
|
|
59
|
-
version:
|
|
53
|
+
version: 5.0.0.beta
|
|
60
54
|
email:
|
|
61
55
|
- bradgessler@gmail.com
|
|
62
56
|
executables: []
|
|
@@ -66,6 +60,8 @@ files:
|
|
|
66
60
|
- lib/sitepress-cli.rb
|
|
67
61
|
- lib/sitepress/boot.rb
|
|
68
62
|
- lib/sitepress/cli.rb
|
|
63
|
+
- lib/sitepress/cli/plugin_helpers.rb
|
|
64
|
+
- lib/sitepress/plugins.rb
|
|
69
65
|
- lib/sitepress/project_template.rb
|
|
70
66
|
- lib/sitepress/repl.rb
|
|
71
67
|
- sitepress-cli.gemspec
|
|
@@ -73,11 +69,10 @@ files:
|
|
|
73
69
|
- templates/default/Gemfile.tt
|
|
74
70
|
- templates/default/README.md
|
|
75
71
|
- templates/default/Rakefile
|
|
76
|
-
- templates/default/assets/config/manifest.js
|
|
77
72
|
- templates/default/assets/images/logo-brown.svg
|
|
78
73
|
- templates/default/assets/images/logo-white.svg
|
|
79
74
|
- templates/default/assets/javascripts/.gitkeep
|
|
80
|
-
- templates/default/assets/stylesheets/site.css
|
|
75
|
+
- templates/default/assets/stylesheets/site.css
|
|
81
76
|
- templates/default/components/.gitkeep
|
|
82
77
|
- templates/default/config/site.rb
|
|
83
78
|
- templates/default/helpers/page_helper.rb
|
|
File without changes
|