Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d59b9c9134
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 81 lines (67 sloc) 2.331 kb
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
require_relative "build/robocopy"

ADDON_NAME = "ReputationBars"
BASE_PATH = "#{File.dirname(__FILE__)}"

WOW_PATH = ENV['WOW_PATH'].nil? ? "C:\Program Files\World of Warcraft" : ENV['WOW_PATH']
if not Dir.exists?(WOW_PATH) then
raise "You need to set environment variable 'WOW_PATH' to point to your World of Warcraft installation."
end

ADDON_PATH = File.join(WOW_PATH, "Interface", "Addons")
if not Dir.exists?(ADDON_PATH) then
raise "Could not find addon directory #{ADDON_PATH}"
end

task :default => :deploy

desc "Update files and deploy addon to the WoW folder"
task :deploy => [:updatelocale, :maketoc, :copyaddon, :cleanup]

desc "Perform a deploy and package a release version"
task :release => [:newversion, :deploy, :package]

desc "Update Babelfish locale files"
task :updatelocale do
Dir.chdir(File.join(BASE_PATH, "Source/Locales")) do
sh "lua Babelfish.lua" do |ok, res|
raise "Failed to update locale files. Error #{res.exitstatus}" unless ok
end
end
end

desc "Generate the TOC file stamped with the current version"
task :maketoc do
# Generate TOC file with version and revision info
version = File.read("version.txt").chomp
begin
commit = `git log -1 --pretty=format:%H`
rescue
commit = "unknown"
end
tocfile = getTocFileName()
toc = File.read("#{tocfile}.tmpl").gsub(/%VERSION%/, version).gsub(/%REV%/, commit)
File.open(tocfile, 'w') do |outfile|
outfile.puts toc
end
end

task :newversion do
sh "lua version.lua" do |ok, res|
raise "Failed to update version. Error #{res.exitstatus}" unless ok
end
end

robocopy :copyaddon do |rc|
rc.source = File.join(BASE_PATH, "Source")
rc.target = File.join(ADDON_PATH, ADDON_NAME)
rc.excludeFiles = "*.tmpl *.png"
end

desc "Clean up temporary files"
task :cleanup do
tocfile = getTocFileName()
File.delete(tocfile) if File.exists?(tocfile)
end

task :package do
version = File.read("version.txt").chomp
releasepath = File.join(BASE_PATH, "Releases")
archivefile = File.join(releasepath, "#{ADDON_NAME}-#{version}.zip")
Dir.mkdir(releasepath) unless Dir.exists?(releasepath)
File.delete(archivefile) if File.exists?(archivefile)
Dir.chdir(ADDON_PATH) do
sh '"C:\Program Files\7-Zip\7z.exe"' + " a -tzip #{archivefile} #{ADDON_NAME}"
end
end

def getTocFileName()
return File.join(BASE_PATH, "Source/#{ADDON_NAME}.toc")
end
Something went wrong with that request. Please try again.