Permalink
Browse files

Add rake release

  • Loading branch information...
1 parent fc4b359 commit b65c10822665dcc96e47153f68c09adf7b3012f5 @ConradIrwin ConradIrwin committed Aug 24, 2012
Showing with 22 additions and 0 deletions.
  1. +22 −0 Rakefile
View
@@ -7,3 +7,25 @@ rescue LoadError
abort "Jasmine is not available. In order to run jasmine, you must: (sudo) gem install jasmine"
end
end
+
+task :release do
+ begin
+ require 'jsmin'
+ rescue LoadError
+ abort "jsmin is not available. In order to run rake release you must: gem install jsmin"
+ end
+ version = `git describe --tags --always --dirty`.sub('v', '').tr('-','.').chomp
+ puts "Writing: release/model-r-#{version}.js"
+ File.open("release/model-r-#{version}.js", 'w') do |output|
+ output.puts "/*** model-r-#{version}.js ***/"
+ Dir["js/lib/*.js"].sort.each do |file|
+ output << File.read(file)
+ end
+ end
+ puts "Writing: release/model-r-#{version}.min.js"
+
+ File.open("release/model-r-#{version}.min.js", 'w') do |minified|
+ minified.write("/*** model-r-#{version}.min.js ***/")
+ minified.write(JSMin.minify(File.read("release/model-r-#{version}.js")))
+ end
+end

0 comments on commit b65c108

Please sign in to comment.