Skip to content

Commit

Permalink
Add svn import script.
Browse files Browse the repository at this point in the history
  • Loading branch information
beastaugh committed May 23, 2010
1 parent 232aacd commit 48e8954
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions util/svn_import.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# This script was used to import translation files from the old Subversion
# repository on Google Code.
#
# http://tarski.googlecode.com/svn/translations/
#
# Subversion repository layout:
#
# /translations/
# /translations/releases/{1.4...2.4}
# /translations/trunk/

require 'pathname'
require 'find'
require 'fileutils'

SVN_PATH = "http://tarski.googlecode.com/svn/translations/"

THIS_DIR = Pathname.new(File.dirname(__FILE__))

TMP_DIR = THIS_DIR + "tmp"
BIN_DIR = THIS_DIR + "bin"
SRC_DIR = THIS_DIR + "src"

# Check out the translation files from the Subversion repository
`svn co #{SVN_PATH}releases tmp`
`svn cp #{SVN_PATH}/trunk tmp/2.5`

# Copy the files from the temporary directory to the correct location in the
# new repository. It is assumed that the new directory structure already
# exists, e.g. that there are bin/ and src/ directories with correctly numbered
# version directories.
Find.find(TMP_DIR) do |path|
if FileTest.directory?(path)
if File.basename(path)[0] == ?.
Find.prune
else
next
end
else
version = File.dirname(path).split("/").last
ext = File.extname(path)
name = File.basename(path)

if ext == ".mo"
FileUtils.cp(path, BIN_DIR + version + name)
elsif ext == ".po"
FileUtils.cp(path, SRC_DIR + version + name)
end
end
end

0 comments on commit 48e8954

Please sign in to comment.