用于taskcluster资源的标准化url生成器。
taskcluster-urls的Python项目详细描述
taskcluster url构建库
一个简单的库,在我们的各种部署方法中为各种taskcluster资源生成url。
这既是使用javascript的项目的一个简单填充程序,也是 我们如何定义这些路径。
url在“taskcluster url format”文档中定义。
更改日志
在releases page上查看变更日志。
要求
这是在node.js{8, 10}
中的任何一个上测试的,并且应该在其上运行。
js用法
这个包导出了几种基于 一个根url,以及一些用于为预先确定的url生成url的helper类 根URL:
api(rootUrl, service, version, path)
->;String
apiReference(rootUrl, service, version)
->;String
docs(rootUrl, path)
->;String
exchangeReference(rootUrl, service, version)
->;String
schema(rootUrl, service, schema)
->;String
ui(rootUrl, path)
->;String
servicesManifest(rootUrl)
->;String
testRootUrl()
->;String
withRootUrl(rootUrl)
->;Class
以上方法的实例
当rootUrl
是https://taskcluster.net
时,生成的url将指向heroku集群。否则他们会跟着
spec defined in this project。
testRootUrl()
用于在测试中的各种taskcluster mock之间共享一个公共的伪rootUrl
。
URL无法解析。
// Specifying root URL every time:constlibUrls=require('taskcluster-lib-urls');libUrls.api(rootUrl,'auth','v1','foo/bar');libUrls.schema(rootUrl,'auth','v1/foo.yml');// Note that schema names have versions in themlibUrls.apiReference(rootUrl,'auth','v1');libUrls.exchangeReference(rootUrl,'auth','v1');libUrls.ui(rootUrl,'foo/bar');libUrls.servicesManifest(rootUrl);libUrls.docs(rootUrl,'foo/bar');
// Specifying root URL in advance:constlibUrls=require('taskcluster-lib-urls');consturls=libUrls.withRoot(rootUrl);urls.api('auth','v1','foo/bar');urls.schema('auth','v1/foo.yml');urls.apiReference('auth','v1');urls.exchangeReference('auth','v1');urls.ui('foo/bar');urls.servicesManifest();urls.docs('foo/bar');
如果愿意,可以通过taskcluster-lib-loader设置如下:
{libUrlss:{require:['cfg'],setup:({cfg})=>withRootUrl(cfg.rootURl),},}
使用:
yarn install
yarn test
开始使用
go包导出以下功能:
funcAPI(rootURLstring,servicestring,versionstring,pathstring)stringfuncAPIReference(rootURLstring,servicestring,versionstring)stringfuncDocs(rootURLstring,pathstring)stringfuncExchangeReference(rootURLstring,servicestring,versionstring)stringfuncSchema(rootURLstring,servicestring,namestring)stringfuncUI(rootURLstring,pathstring)stringfuncServicesManifest(rootURLstring)string
安装时使用:
go install ./..
使用:
go test -v ./...
python用法
您可以使用pip install taskcluster-urls
;
importtaskcluster_urlstaskcluster_urls.api(root_url,'auth','v1','foo/bar')taskcluster_urls.schema(root_url,'auth','v1/foo.yml')# Note that schema names have versions in themtaskcluster_urls.api_reference(root_url,'auth','v1')taskcluster_urls.exchange_reference(root_url,'auth','v1')taskcluster_urls.ui(root_url,'foo/bar')taskcluster_urls.servicesManifest(root_url)taskcluster_urls.docs(root_url,'foo/bar')Andfortesting,```pythontaskcluster_urls.test_root_url()
使用:
tox
Java用法
为了从您的maven项目中使用此库,只需将其作为项目依赖项包含:
<project>
...
<dependencies>
...
<dependency>
<groupId>org.mozilla.taskcluster</groupId>
<artifactId>taskcluster-lib-urls</artifactId>
<version>1.0.0</version>
</dependency>
</dependencies>
</project>
taskcluster lib url工件现在可以从maven central repository:
要使用库,请执行以下操作:
importorg.mozilla.taskcluster.urls.*;...URLProviderurlProvider=URLs.provider("https://mytaskcluster.acme.org");StringfooBarAPI=urlProvider.api("auth","v1","foo/bar");StringfooSchema=urlProvider.schema("auth","v1/foo.yml");// Note that schema names have versions in themStringauthAPIRef=urlProvider.apiReference("auth","v1");StringauthExchangesRef=urlProvider.exchangeReference("auth","v1");StringuiFooBar=urlProvider.ui("foo/bar");StringservicesManifest=urlProvider.servicesManifest();StringdocsFooBar=urlProvider.docs("foo/bar");...
安装时使用:
mvn install
使用:
mvn test
释放
新版本应该在travis和taskcluster上进行测试,以允许测试各种语言的所有支持版本。一旦对它的工作感到满意,就应该使用
npm version
而不是通过手动编辑package.json
,标签应该被推送到github。
首先释放节点,因为python的版本取决于它的package.json
。这遵循典型的标记和推送发布方法:
$ npm version minor # or patch, or major
$ git push upstream
完成后,构建python sdists(只有通过maintainers on pypi才有可能):
rm -rf dist/* python setup.py sdist bdist_wheel python3 setup.py bdist_wheel pip install twine twine upload dist/*
确保更新the changelog!
许可证
Mozilla Public License Version 2.0