env*_*igo 7 ruby api rest crud rally
在我的公司,我们最近开始使用Rally作为我们的项目管理工具.最初,我们团队外部的人投入了大量时间,使用命名约定手动创建迭代,而这些命名约定与我们团队现有的方案无关.我不想让这个可怜的灵魂一个接一个地手动删除这些空迭代,而是希望使用Rally的REST API自动化这个过程.简而言之,我们需要删除这些100多个空迭代,这些迭代跨越3个不同的项目(它们共享一个共同的父项).
我花了一些时间来看看rally-rest-api ruby gem,虽然我有一些有限的Ruby经验,但是我的API 查询界面仍然让我感到困惑,而且我在绕过它时遇到了一些麻烦.我知道我的正则表达式会是什么,但我只是不知道如何将其提供给查询.
这是我到目前为止:
require 'rubygems'
require 'rally_rest_api'
rally = RallyRestAPI.new(:username => "myuser",
:password => "mypass")
regex = /ET-VT-100/
# get all names that match criteria
iterations = rally.find(:iteration) { "query using above regex?" }
# delete all the matching iterations
iterations.each do |iteration|
iteration.delete
end
Run Code Online (Sandbox Code Playgroud)
任何指向正确方向的人都会非常感激.我觉得我差不多了.
几个月前,当我想重命名一大堆迭代时,我不得不做类似的事情.
首先,确保您要进行身份验证的用户至少在要从中删除迭代的所有项目中分配了"编辑器"角色.此外,如果您的工作区中有任何项目没有读取权限,则必须首先提供项目元素以供查询开始.(您可能甚至不知道它们,组织中的其他人可能已经创建了它们).
以下内容获取对项目的引用,然后使用指定的正则表达式遍历迭代:
require 'rubygems'
require 'rally_rest_api'
rally = RallyRestAPI.new(:username => "myuser",
:password => "mypass")
# Assumes all projects contain "FooBar" in name
projects = rally.find(:project) { contains :name, "FooBar"}
projects.each do |project|
project.iterations.each do |iteration|
if iteration.name =~ /ET-VT-100/
iteration.delete
end
end
end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2046 次 |
| 最近记录: |