12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/translate/translate.rb', line 12
def run
@slm = RallyRestAPI.new(:base_url => @base_url, :username => @username, :password => @password)
@workspace1 = @slm.user.subscription.workspaces.values.flatten.find { |w| w.name == @from_workspace_name }
@workspace2 = @slm.user.subscription.workspaces.values.flatten.find { |w| w.name == @to_workspace_name }
raise "No such workspace #{@from_workspace_name}" unless @workspace1
raise "No such workspace #{@to_workspace_name}" unless @workspace2
$TRANSLATED[:from] = @from_workspace_name
$TRANSLATED[:to] = @to_workspace_name
if File::exists? "TRANSLATED"
File.open("TRANSLATED", "r") do |f|
$TRANSLATED = Marshal.load(f)
end
puts "Read TRANSLATED"
end
[:iteration, :release, :story, :defect, :test_case].each do |type|
@slm.find_all(type, :workspace => @workspace1).each do |o|
puts "Copying #{o.type} -- #{o.name}"
o.copy(@workspace2)
end
end unless $TRANSLATED[:copy]
$TRANSLATED[:copy] = true
dump_oids
[:test_case, :defect].each do |type|
@slm.find_all(type, :workspace => @workspace1).each do |o|
puts "Tangle #{o.type} -- #{o.name}"
o.tangle(@workspace2)
end
end unless $TRANSLATED[:tangle]
$TRANSLATED[:tangle] = true
dump_oids
end
|