darling /rig
命令行实用工具,旨在帮助使用Roady进行开发
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-09-11 18:14:29 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"
这将创建一个名为 hello-world
的模块,在当前 Roady
项目的 modules
目录中。
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
注意:示例
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