-
Notifications
You must be signed in to change notification settings - Fork 3
/
csv2tasks
executable file
·44 lines (36 loc) · 920 Bytes
/
csv2tasks
1
2
3
4
5
6
7
8
9
10
11
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
#!/usr/bin/env ruby
require 'csv'
require 'rally_rest_api'
require 'yaml'
#begin
config = YAML.load_file("#{Dir.home}/.rallyutils")
#rescue
# puts "\nERROR: #{Dir.home}/.rallyutils not found"
# exit
#end
rally_user=config["user"]
rally_pass=config["password"]
if ARGV[0]
csv_file = ARGV[0]
else
puts "Usage: csv2tasks <csvfile>"
exit 1
end
rally = RallyRestAPI.new(:username => rally_user,
:password => rally_pass)
user_story=""
CSV.foreach(csv_file) do |row|
if ! row[0].nil? and ! row[0].empty?
user_story = row[0]
end
task_name = row[1]
if user_story
stories = rally.find( :hierarchical_requirement ) {
equal :formatted_id , user_story
}
story = stories.first
task = rally.create(:task, :name => task_name ,
:work_product => story, :estimate => 1, :to_do => 1)
puts "Task #{task.formatted_i_d} created under story #{story.formatted_i_d}"
end
end