Update the package script to work with Git
[bugdar.git] / docs / package.rb
1 #!/usr/bin/ruby
2
3 require 'FileUtils'
4
5 puts ""
6 puts "===================================================="
7 puts "Bugdar Release Preparation System $Revision$"
8 puts "===================================================="
9 puts ""
10
11 puts "What is the human-readable version of Bugdar that you are releasing?"
12 versionhr = gets.chomp
13 versionfs = versionhr.gsub(/\./, "-")
14
15 puts ""
16
17 puts "Where should I export Git from?"
18 gitpath = gets.chomp
19
20 puts ""
21
22 puts "Preparing the release now..."
23
24 # create the directory
25 puts "... making release directory"
26 pwd = FileUtils.pwd + "/"
27 dirpath = "bugdar-" + versionfs
28 FileUtils.mkdir(dirpath)
29 FileUtils.cd(pwd + dirpath)
30
31 # export git
32 puts "... exporting archive from Git"
33 system "cd " + gitpath + "; git archive --format=tar --prefix=upload/ HEAD > /tmp/gitexp.tar; cd - > /dev/null"
34 system "tar xf /tmp/gitexp.tar; rm /tmp/gitexp.tar"
35
36 # remove temp directories
37 puts "... cleaning source export"
38 FileUtils.rm("upload/.gitignore")
39 FileUtils.rm_rf("upload/docs/")
40 FileUtils.rm_rf("upload/framework/dev/")
41
42 # move good files up
43 puts "... preparing main files"
44 FileUtils.mv("upload/INSTALLING", ".")
45 FileUtils.mv("upload/UPGRADING", ".")
46 FileUtils.mv("upload/CREDITS", ".")
47 FileUtils.mv("upload/COPYING", ".")
48
49 # tar and zip the files
50 FileUtils.cd("..")
51 system "zip -rq bugdar-" + versionfs + ".zip " + dirpath
52 puts "... creating ZIP file"
53 system "tar czf bugdar-" + versionfs + ".tgz " + dirpath
54 puts "... creating TAR file"
55
56 # cleanup
57 FileUtils.rm_rf(dirpath)
58 puts "Finished!"