跳转到主要内容

OpenStax Nebu发布工具

项目描述

CNX Nebu发布工具

这是一个用于与connexions内容交互的命令行界面。该工具主要用于将内容发布到cnx.org网站。

此软件需要

  • Python >= 3.6 <= 3.8

  • libmagic(libmagic1在Linux上)

  • JRE >= 6

安装

  1. 安装 python3 (在OSX上可以运行 brew install python3

  2. 在终端中运行 pip3 install --upgrade pip setuptools 以升级Python工具

  3. 确保已安装libmagic(默认在Linux上,在OSX上使用 brew install libmagic

  4. 在终端中运行 pip3 install nebuchadnezzar

  5. 运行 neb --help 以验证应用程序已安装

开发

安装

  1. 安装 python3 (在OSX上可以运行 brew install python3

  2. 确保已安装libmagic(默认在Linux上,在OSX上使用 brew install libmagic

  3. 安装 virtualenv (在OSX上可以运行 pip3 install virtualenv

  4. 初始化Python虚拟环境

    1. virtualenv ./venv/ --python=python3.5

    2. source ./venv/bin/activate

    3. pip3 install --upgrade pip setuptools

    4. python setup.py develop 或(更推荐) pip3 install -e .

开发者运行

  1. 打开一个新的终端

  2. source ./venv/bin/activate

  3. 现在您可以运行各种命令

    • neb --help 以获取各种命令的帮助

测试

要运行所有测试: make test

运行单个测试 test_main 的方法:使用 make test -- -k test_main

用法

确保 neb 尝试连接到期望的服务器有几种方法

  1. 使用配置文件

  2. 不使用配置文件,并传递环境名称

  3. (对于 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

以环境的形式传递目标主机

对于 getpublishping 命令,您可以以下列形式指定环境值,避免使用配置文件

  1. 目标主机为 environment.cnx.org 的环境

    示例:使用 neb publish qa ... 将访问 https://qa.cnx.org

  2. 是 FQDN 但不指定协议的环境

    示例:使用 neb publish qa.cnx.org ... 将访问 https://qa.cnx.org

  3. 是带协议的 FQDN 的环境

    示例:使用 neb publish http://host.foobar.org ... 将访问 http://host.foobar.org

指定存档主机

对于 get 命令,如果您需要访问不遵循 archive-{environment} 惯例的存档主机,并且想避免使用配置文件,可以使用 --archive 参数

  • 示例:使用 neb get vagrant --archive archive.local.cnx.org ...

配置编辑器

准备

  1. 安装 https://atom.io

  2. 安装 Java

    1. 对于 macOS,您可以通过安装 https://brew.sh.cn 并在终端中运行 brew install java 来安装 Java。

安装(带自动 Atom 配置)

  1. 启动 Atom

  2. 安装 linter-autocomplete-jing

  3. 按 <kbd>⌘</kbd>+<kbd>,</kbd>(对于 Mac)以打开设置(或在菜单栏中点击 Atom首选项…

    1. 点击左侧的 安装

    2. 输入 linter-autocomplete-jing 并点击 安装

    3. 替代方法:从命令行运行 apm install linter-autocomplete-jing

  4. 运行 neb atom-config注意: 这将覆盖您的 Atom 配置文件。如果您更喜欢自己更新配置文件,请参阅下方的“手动 Atom 配置”)

  5. 重新启动 Atom

  6. 打开一个未解压的完整压缩文件。(我在终端中运行 atom ~/Downloads/col1234_complete 从终端

  7. 通过打开一个 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

项目详情


发布历史 发布通知 | RSS 源

下载文件

下载适用于您平台的电影文件。如果您不确定选择哪一个,请了解更多关于 安装包 的信息。

源代码分发

此版本没有提供源代码分发文件。请参阅 生成分发存档教程

构建分发

nebuchadnezzar-9.13.1-py3-none-any.whl (133.0 kB 查看散列)

上传时间 Python 3

支持者