darling / ddms
Requires
- composer-runtime-api: ^2.2
- darling/php-darling-dev-tools: ^1.0
- darling/php-file-system-paths: ^1.0
- darling/php-text-types: ^1.1
- darling/php-unit-test-utilities: ^1.0
- darling/roady-module-utilities: ^1.0
- erusev/parsedown: ^1.7
- laravel/prompts: ^0.1.16
Requires (Dev)
- dev-rig
- v2.0.0-alpha-13
- v2.0.0-alpha-12
- v2.0.0-alpha-11
- v2.0.0-alpha-10
- v2.0.0-alpha-9
- v2.0.0-alpha-8
- v2.0.0-alpha-7
- v2.0.0-alpha-6
- v2.0.0-alpha-5
- v2.0.0-alpha-4
- v2.0.0-alpha-3
- v2.0.0-alpha-2
- v2.0.0-alpha-1
- v1.7.5
- v1.7.4
- v1.7.3
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.9
- v1.6.8
- v1.6.7
- v1.6.6
- v1.6.5
- v1.6.4
- v1.6.3
- v1.6.2
- v1.6.1
- v1.6.0
- v1.5.9
- v1.5.8
- v1.5.7
- v1.5.6
- v1.5.5
- v1.5.4
- v1.5.3
- v1.5.2
- v1.5.1
- v1.5.0
- v1.4.9
- v1.4.8
- v1.4.7
- v1.4.6
- v1.4.5
- v1.4.4
- v1.4.3
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.9
- v1.3.8
- v1.3.7
- v1.3.6
- v1.3.5
- v1.3.4
- v1.3.3
- v1.3.2
- v1.3.1
- v1.3.0
- v1.2.9
- v1.2.8
- v1.2.7
- v1.2.6
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- v0.1.8-alpha
- v0.1.7-alpha
- v0.1.6-alpha
- v0.1.5-alpha
- v0.1.4-alpha
- v0.1.3-alpha
- v0.1.2-alpha
- v0.1.1-alpha
- v0.1.0-alpha
- v0.0.9-beta
- v0.0.9-alpha
- v0.0.8-beta
- v0.0.8-alpha
- v0.0.7-beta
- v0.0.7-alpha
- v0.0.6-beta
- v0.0.6-alpha
- v0.0.5-beta
- v0.0.5-alpha
- v0.0.4-beta
- v0.0.4-alpha
- v0.0.3-beta
- v0.0.3-alpha
- v0.0.2-beta
- v0.0.2-alpha
- v0.0.1-beta
- v0.0.1-alpha
- v0.0.0-beta
- v0.0.0-alpha
- dev-Rig1715746398
This package is auto-updated.
Last update: 2024-06-11 17:40:19 UTC
README
____ _ | _ \(_) ____ | |_) | |/ _` | | _ <| | (_| | |_| \_\_|\__, | |___/
rig 是一个命令行工具,旨在帮助使用 Roady php 框架进行开发。
安装
rig 可以通过以下安装方法之一进行安装
通过 composer 安装
composer require darling/rig
注意:如果通过 composer 安装 rig,则 rig、rig.php 和 setupRig.sh 脚本将在 vendor/bin 中可用。
通过 git 安装
git clone https://github.com/sevidmusic/rig
安装 rig 后,在 ~/.local/bin 中创建 rig 的符号链接很有帮助。
为此,rig 提供了一个 setupRig.sh 脚本,它会完成这项工作。
如果使用 composer require darling/rig 安装 rig,请在 vendor/bin 中运行设置脚本
./vendor/bin/setupRig.sh
如果使用 git clone 安装 rig,请在 rig 的根目录中运行设置脚本
./setupRig.sh
注意
setupRig.sh 默认不会覆盖现有的 rig 符号链接。
要强制 setupRig.sh 覆盖现有的 rig 符号链接,请使用 --force 标志
# For composer installation
./vendor/bin/setupRig.sh --force
# For git installation
./setupRig.sh --force
入门
要确保 rig 已安装并可调用,请运行以下命令
rig --version
如果这样做了,那么 rig 已正确安装。
创建模块
rig 可以用于为 Roady 项目创建新的模块。
例如,要创建名为 hello-world 的模块,请运行以下命令
rig --new-module \
--module-name "hello-world"
这将在当前 Roady 项目的 modules 目录中创建名为 hello-world 的模块。
modules/hello-world
它还将创建以下文件
modules/hello-world/output/hello-world.html
modules/hello-world/localhost.8080.json
要使用此模块,通过 rig --start-servers --open-in-browser 在 localhost:8080 上启动开发服务器。
注意:如果 localhost:8080 无法在浏览器中自动打开,请手动打开网页浏览器并导航到 localhost:8080。
如果一切正常,则新模块的输出 Hello hello-world 应在浏览器中显示。
其他文档
有关 rig 单个命令的相关文档如下。
有关使用 rig 与 Roady 一起构建网站的更详细文档可以在 Roady 的 README.md 中找到。
命令
- --help
- --delete-route
- --list-routes
- --new-module
- --new-route
- --start-servers
- --update-route
- --version
- --view-action-log
rig --help
显示有关 rig 或 rig 的命令的文档。
参数
[TOPIC]
示例
rig --help
rig --help about
rig --help delete-route
rig --help getting-started
rig --help help
rig --help installation
rig --help list-routes
rig --help new-module
rig --help new-route
rig --help start-servers
rig --help update-route
rig --help version
rig --help view-action-log
rig --help view-readme
rig --delete-route
删除分配了指定路由哈希的路由。
注意:路由哈希在 rig --list-routes 的输出中显示。
参数
--path-to-roady-project The path to the relevant Roady project's
root directory.
Defaults to current directory: ./
--route-hash The hash of the Route to delete.
示例
rig --delete-route \ --route-hash "016bbd46d3a3fc25c" rig --delete-route \ --path-to-roady-project "./" \ --route-hash "6591c3e1ed38ed5eb"
rig --list-routes
列出由现有模块配置的路由。
注意:如果没有指定参数,则将列出所有现有模块定义的所有路由。
参数
--defined-for-authorities If specified, only list Routes
that are defined for one of the
specified Authorities.
--defined-for-modules If specified, only list Routes
that are defined by one of the
specified Modules.
--defined-for-requests If specified, only list the
Routes that respond to one of
the specified Requests.
--defined-for-named-positions If specified, only list Routes that
are defined for one of the specified
Named Positions.
--defined-for-positions If specified, only list Routes
that are defined for one of the
specified Positions.
--defined-for-files If specified, only list Routes that
are defined for one of the specified
files.
--path-to-roady-project The path to the relevant Roady project's
root directory.
Defaults to current directory: ./
示例
rig --list-routes rig --list-routes --defined-for-modules "hello-world" "hello-universe" rig --list-routes --defined-for-requests "homepage" "global" rig --list-routes --defined-for-named-positions "roady-ui-header" rig --list-routes --defined-for-positions "0" "3" rig --list-routes --defined-for-files "homepage.html" "global.css"
也可以指定多个参数来进一步过滤结果。
rig --list-routes \
--defined-for-modules "hello-world" "hello-universe" \
--defined-for-requests "homepage" "global" \
--defined-for-named-positions "roady-ui-header" \
--defined-for-positions "0" "3" \
--defined-for-files "homepage.html" "global.css"
rig --list-routes 的输出将类似于以下内容:
# Routes ┌───────────────────┬─────────────────────────────────────────────────────┐ │ route-hash: │ 016bbd46d3a3fc25c │ ├───────────────────┼─────────────────────────────────────────────────────┤ │ defined-by-module │ hello-world │ │ responds-to │ homepage │ │ named-positions │ [{"position-name":"roady-ui-footer","position":10}] │ │ relative-path │ output/hello-world.html │ └───────────────────┴─────────────────────────────────────────────────────┘ ┌───────────────────┬────────────────────────────────────────────────────┐ │ route-hash: │ 6591c3e1ed38ed5eb │ ├───────────────────┼────────────────────────────────────────────────────┤ │ defined-by-module │ hello-world │ │ responds-to │ hello-universe, hello-world, homepage │ │ named-positions │ [{"position-name":"roady-ui-header","position":3}] │ │ relative-path │ output/header.html │ └───────────────────┴────────────────────────────────────────────────────┘
rig --new-module
在当前 Roady 项目的 modules 目录中创建一个新的模块。
如果没有指定 --no-boilerplate 标志,将为新模块创建以下初始文件和目录。
注意:名称 NEW_MODULE_NAME 将被替换为新模块的实际名称。
localhost.8080.json
output/NEW_MODULE_NAME.html
为新模块创建的初始文件内容将如下:
output/NEW_MODULE_NAME.html
<p>Hello NEW_MODULE_NAME</p>
-
localhost.8080.json注意:示例中的字符串
NEW_MODULE_NAME将被替换为新模块的实际名称。
[
{
"module-name": "NEW_MODULE_NAME",
"responds-to": [
"homepage"
],
"named-positions": [
{
"position-name": "roady-ui-main-content",
"position": 0
}
],
"relative-path": "output\/NEW_MODULE_NAME.html"
}
]
参数
--for-authority If specified, create an initial Route
configuration file for the specified
domain authority.
Note: If the --for-authority flag is
not specified then an initial Route
configuration file will be created
for the authority:
localhost:8000
Note: If the --no-boilerplate flag is
specified and the --for-authority flag
is not specified then an initial Route
configuration file will not be created.
--no-boilerplate If specified, do not create any
initial files and directories for
the new Module.
--module-name The name to assign to the new Module.
--path-to-roady-project The path to the relevant Roady project's
root directory.
Defaults to current directory: ./
示例
rig --new-module \
--module-name hello-world
rig --new-module \
--module-name hello-universe \
--for-authority "www.example.com"
rig --new-module \
--module-name hello-multiverse \
--for-authority "localhost:8888" \
--no-boilerplate \
--path-to-roady-project "./"
rig --new-route
为现有模块定义一个新的路由。
参数
--module-name The name of the Module to define the new
Route for.
--named-positions A json string that represents an array
of arrays of named positons.
For example:
[{"position-name":"roady-ui-footer","position":10}]
--path-to-roady-project The path to the relevant Roady project's
root directory.
Defaults to current directory: ./
--relative-path The path to the file served by the Route,
relative to the Module's root directory.
--responds-to The names of the Requests the Route will
respond to.
示例
rig --new-route \ --module-name "hello-world" \ --named-positions '[{"position-name":"roady-ui-footer","position":10}]' \ --relative-path "output/hello-world.html" \ --responds-to "homepage" "hello-world"
rig --start-servers
在指定的端口启动一个或多个本地服务器。
如果没有指定端口,则在端口 8080 上启动一个本地服务器。
服务器将在 localhost:PORT 上可用,例如,使用 rig --start-server 8888 将启动一个在 localhost:8888 可访问的本地服务器。
参数
--ports The ports to start servers on.
--open-in-browser If specified, attempt to automatically open
the running servers in a browser.
示例
# start server on localhost:8080 rig --start-servers # start server on localhost:8888 and localhost:8017 rig --start-servers --ports 8888 8017 # start server on localhost:8420 and open it in a browser rig --start-servers --ports 8420 --open-in-browser
rig --update-route
使用指定的标准更新分配给指定路由哈希的路由。
注意:路由哈希在 rig --list-routes 生成的表中显示。
参数
--module-name The name of the Module the Route is
defined for.
--named-positions A json string that represents an array
of arrays of named positons.
For example:
[{"position-name":"roady-ui-footer","position":10}]
--path-to-roady-project The path to the relevant Roady project's
root directory.
Defaults to current directory: ./
--relative-path The path to the file served by the Route,
relative to the Module's root directory.
--responds-to The names of the additional Requests
the Route will respond to.
--route-hash The hash of the Route to update.
示例
rig --update-route \ --module-name "hello-world" \ --named-positions '[{"position-name":"roady-ui-footer","position":10}]' \ --relative-path "output/hello-world.html" \ --responds-to "homepage" "hello-world"
rig --version
显示 rig 的版本。
注意:如果 rig 没有更新到最新版本,将显示警告消息。
示例
rig --version
rig --view-action-log
查看由 rig 运行的命令所采取的 Actions 的日志。
示例
rig --view-action-log