diff --git a/Rakefile b/Rakefile index 4ef9284..261cf3e 100644 --- a/Rakefile +++ b/Rakefile @@ -2,36 +2,42 @@ require 'fileutils' +def find_version + File.read("yasnippet.el") =~ /;; Version: *([0-9.]+) *$/ + $version = $1 +end +find_version +FileUtils.mkdir_p('pkg') + desc "generate the bundle file." task :bundle do sh 'emacs --batch -l yasnippet.el --eval "(yas/compile-bundle ' + '\"./yasnippet.el\" \"./yasnippet-bundle.el\" \"./snippets\")"' -end - -def find_version - File.read("yasnippet.el") =~ /;; Version: *([0-9.]+) *$/ - version = $1 + sh "tar czf pkg/yasnippet-bundle-#{$version}.el.tgz yasnippet-bundle.el" end desc "create a release package" task :package do - version = find_version - release_dir = "pkg/yasnippet-" + version + release_dir = "pkg/yasnippet-#{$version}" FileUtils.mkdir_p(release_dir) files = ['snippets', 'yasnippet.el', 'Rakefile'] FileUtils.cp_r files, release_dir FileUtils.rm_r Dir[release_dir + "/**/.svn"] FileUtils.cd 'pkg' - sh "tar cjf yasnippet-" + version + ".tar.bz2 yasnippet-" + version + sh "tar cjf yasnippet-#{$version}.tar.bz2 yasnippet-#{$version}" FileUtils.cd ".." end desc "create a release package and upload it to google code" -task :release => :package do +task :release => [:bundle, :package] do version = find_version - sh "googlecode_upload.py -s \"YASnippet Release " + version + "\"" + + sh "googlecode_upload.py -s \"YASnippet Release #{$version}\"" + " -p yasnippet --config-dir=none -l \"Featured,Type-Package,OpSys-All\"" + - " pkg/yasnippet-" + version + ".tar.bz2" + " pkg/yasnippet-#{$version}.tar.bz2" + sh "googlecode_upload.py -s \"YASnippet Bundle #{$version}\"" + + " -p yasnippet --config-dir=none -l \"Featured,Type-Package,OpSys-All\"" + + " pkg/yasnippet-bundle-#{$version}.el.tgz" + end task :default => :bundle