RE: Importing XML data from Basecamp to Redmine » basecamp2redmine_undo.rb
1 |
#!/usr/bin/env ruby
|
---|---|
2 |
|
3 |
# This Ruby script will delete all the projects created by basecamp2redmine.rb, based on a Basecamp "backup" XML file.
|
4 |
# See license file and legal note in basecamp2redmine.rb
|
5 |
|
6 |
require 'rubygems' |
7 |
require 'nokogiri' |
8 |
|
9 |
filename = ARGV[0] or raise ArgumentError, "Must have filename specified on command line" |
10 |
|
11 |
x = Nokogiri::XML(File.read filename) |
12 |
project_ids = x.xpath('//project').map{|p| (p % 'id').content} |
13 |
|
14 |
puts "# Paste the following Ruby code into script/console, or run through script/runner:" |
15 |
project_ids.each do |project_id| |
16 |
puts %{Project.find_by_identifier("basecamp-p-#{project_id}").destroy} |
17 |
end
|
- « Previous
- 1
- 2
- Next »