OpenStax Nebu发布工具
项目描述
CNX Nebu发布工具
这是一个用于与connexions内容交互的命令行界面。该工具主要用于将内容发布到cnx.org网站。
此软件需要
Python >= 3.6 <= 3.8
libmagic(libmagic1在Linux上)
JRE >= 6
安装
安装 python3 (在OSX上可以运行 brew install python3)
在终端中运行 pip3 install --upgrade pip setuptools 以升级Python工具
确保已安装libmagic(默认在Linux上,在OSX上使用 brew install libmagic)
在终端中运行 pip3 install nebuchadnezzar
运行 neb --help 以验证应用程序已安装
开发
安装
安装 python3 (在OSX上可以运行 brew install python3)
确保已安装libmagic(默认在Linux上,在OSX上使用 brew install libmagic)
安装 virtualenv (在OSX上可以运行 pip3 install virtualenv)
初始化Python虚拟环境
virtualenv ./venv/ --python=python3.5
source ./venv/bin/activate
pip3 install --upgrade pip setuptools
python setup.py develop 或(更推荐) pip3 install -e .
开发者运行
打开一个新的终端
source ./venv/bin/activate
现在您可以运行各种命令
neb --help 以获取各种命令的帮助
测试
要运行所有测试: make test
运行单个测试 test_main 的方法:使用 make test -- -k test_main
用法
确保 neb 尝试连接到期望的服务器有几种方法
使用配置文件
不使用配置文件,并传递环境名称
(对于 neb get) 不使用配置文件,并传递一个特定的存档主机作为参数
使用配置文件
CLI 期望配置文件为 ~/.config/nebuchadnezzar.ini 或由 NEB_CONFIG 环境变量定义。您可以使用此文件来配置特定于环境的 URL 值,例如:
url:特定环境的 URL
archive_url:存档端点 URL(这是可选的,如果未提供,则工具将根据惯例构造 URL)
使用这两个值定义 test 环境的示例
[settings] [environ-test] url = https://test.cnx.org archive_url = https://archive.test.cnx.org
以环境的形式传递目标主机
对于 get、publish 和 ping 命令,您可以以下列形式指定环境值,避免使用配置文件
目标主机为 environment.cnx.org 的环境
示例:使用 neb publish qa ... 将访问 https://qa.cnx.org
是 FQDN 但不指定协议的环境
示例:使用 neb publish qa.cnx.org ... 将访问 https://qa.cnx.org
是带协议的 FQDN 的环境
示例:使用 neb publish http://host.foobar.org ... 将访问 http://host.foobar.org
指定存档主机
对于 get 命令,如果您需要访问不遵循 archive-{environment} 惯例的存档主机,并且想避免使用配置文件,可以使用 --archive 参数
示例:使用 neb get vagrant --archive archive.local.cnx.org ...
配置编辑器
准备
安装 Java
对于 macOS,您可以通过安装 https://brew.sh.cn 并在终端中运行 brew install java 来安装 Java。
安装(带自动 Atom 配置)
启动 Atom
安装 linter-autocomplete-jing 包
按 <kbd>⌘</kbd>+<kbd>,</kbd>(对于 Mac)以打开设置(或在菜单栏中点击 Atom、首选项…)
点击左侧的 安装
输入 linter-autocomplete-jing 并点击 安装
替代方法:从命令行运行 apm install linter-autocomplete-jing
运行 neb atom-config(注意: 这将覆盖您的 Atom 配置文件。如果您更喜欢自己更新配置文件,请参阅下方的“手动 Atom 配置”)
重新启动 Atom
打开一个未解压的完整压缩文件。(我在终端中运行 atom ~/Downloads/col1234_complete 从终端)
通过打开一个 index.cnxml 文件并在文件中某处输入 <figure> 来验证。你应该会在标签附近看到一个红色的警告标志,上面写着 RNG: 元素 "figure" 缺少必需属性 "id"。
手动 Atom 配置
此步骤仅在您未运行上述 neb atom-config 命令时才需要。完成此步骤后,从“重启 Atom”步骤继续上述说明。
通过单击菜单栏中的 Atom,配置 来添加以下内容到您的 Atom 配置中,并复制粘贴以下内容(注意:缩进很重要)
"*": core: customFileTypes: # Add this to the bottom of the customFileTypes area. # Note: Indentation is important! "text.xml": [ "index.cnxml" ] # And then this to the bottom of the file # 1. Make sure "linter-autocomplete-jing" only occurs once in this file! # 1. make sure it is indented by 2 spaces just like it is in this example. "linter-autocomplete-jing": displaySchemaWarnings: true rules: [ { priority: 1 test: pathRegex: ".cnxml$" outcome: schemaProps: [ { lang: "rng" path: "~/.neb/cnxml-validation/cnxml/xml/cnxml/schema/rng/0.7/cnxml-jing.rng" } ] } ]
许可证
本软件受 GNU Affero 通用公共许可证第 3.0 版(AGPL)的规定。有关详细信息,请参阅 LICENSE.txt。版权所有 (c) 2016-2018 Rice University
项目详情
下载文件
下载适用于您平台的电影文件。如果您不确定选择哪一个,请了解更多关于 安装包 的信息。