Permalink
Browse files

Added a Rake task for releasing.

Just bump version in
lib/gl-matrix/version.rb and run:

  $ rake release

...done!

We can add other tasks and call them
from the release task (see Rakefile:35)
so that if any of the other tasks fails,
the release is aborted. This is great
for publishing updated docs, for example.
  • Loading branch information...
1 parent 4d6e2c8 commit c4c1cf8f90c45942b3ef3b95ae3e96925cb61a1d @sinisterchipmunk sinisterchipmunk committed Aug 23, 2012
Showing with 497 additions and 19 deletions.
  1. +0 −6 .gitignore
  2. +3 −0 Gemfile
  3. +2 −0 Gemfile.lock
  4. +26 −8 Rakefile
  5. +23 −0 dist/gl-matrix-min.js
  6. +338 −0 dist/gl-matrix.js
  7. +11 −3 lib/gl-matrix.rb
  8. +84 −0 lib/gl-matrix/release_helper.rb
  9. +8 −0 lib/gl-matrix/version.rb
  10. +1 −1 spec/helpers/node-helper.js
  11. +1 −1 spec/jasmine.yml
View
@@ -1,7 +1 @@
.rvmrc
-
-gl-matrix.js
-
-# these get regenerated every time a test is run
-lib/gl-matrix-min.js
-lib/gl-matrix.js
View
@@ -17,3 +17,6 @@ gem 'uglifier'
# for jasmine:ci task
gem 'json'
+
+# https://github.com/wycats/thor - for release debug
+gem 'thor'
View
@@ -43,6 +43,7 @@ GEM
tilt (~> 1.1, != 1.3.0)
therubyracer (0.10.2)
libv8 (~> 3.3.10)
+ thor (0.14.6)
tilt (1.3.3)
uglifier (1.2.7)
execjs (>= 0.3.0)
@@ -57,4 +58,5 @@ DEPENDENCIES
rake
sprockets
therubyracer
+ thor
uglifier
View
@@ -21,18 +21,36 @@ require File.expand_path('./lib/gl-matrix', File.dirname(__FILE__))
include GLMatrix
# finally... rake tasks!
-desc "compile sources into a single un-minified file"
-task :compile do
- compile 'gl-matrix.js', 'lib/gl-matrix.js'
+desc "tag and release gl-matrix"
+task :release do
+ require 'thor'
+ Bundler.ui = Bundler::UI::Shell.new(Thor::Shell::Basic.new)
+ Bundler.ui.debug! if ENV['DEBUG']
+
+ # Sanity check: rebuild files just in case dev forgot to.
+ # If so, files will change and release will abort since changes
+ # were not checked in.
+ Rake::Task['build'].invoke
+
+ release do
+ # Put other release-related stuff here, such as publishing docs;
+ # if anything fails, gl-matrix will be untagged and not pushed.
+ #
+ # Example:
+ #
+ # Rake::Task['doc:publish'].invoke
+ #
+ end
end
-desc "compile and minify sources"
-task :minify do
- minify 'gl-matrix.js', 'lib/gl-matrix-min.js'
+desc "compile & minify sources into a single file"
+task :build do
+ compile
+ minify
end
desc "run test suite with node.js"
-task :node => :compile do
+task :node => :build do
# make sure jasmine-node exists, and barf if it doesn't
if %x['jasmine-node'] =~ /USAGE/
unless system 'jasmine-node', base_path.join('spec').to_s
@@ -51,7 +69,7 @@ task :node => :compile do
end
desc "Run continuous integration tests"
-RSpec::Core::RakeTask.new('jasmine:ci' => :compile) do |t|
+RSpec::Core::RakeTask.new('jasmine:ci' => :build) do |t|
t.rspec_opts = ["--colour", "--format", ENV['JASMINE_SPEC_FORMAT'] || "progress"]
t.verbose = true
t.rspec_opts += ["-r #{base_path.join('lib/gl-matrix')}"]
View
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2012 Brandon Jones, Colin MacKenzie IV
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty. In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ * claim that you wrote the original software. If you use this software
+ * in a product, an acknowledgment in the product documentation would be
+ * appreciated but is not required.
+ *
+ * 2. Altered source versions must be plainly marked as such, and must not
+ * be misrepresented as being the original software.
+ *
+ * 3. This notice may not be removed or altered from any source
+ * distribution.
+ */
+(function(){"use strict";var e={};typeof exports=="undefined"?e.exports=window:e.exports=exports,function(e){(function(){var t={};t.create=function(){return new Float32Array(2)},t.clone=function(e){var t=new Float32Array(2);return t[0]=e[0],t[1]=e[1],t},t.fromValues=function(e,t){var n=new Float32Array(2);return n[0]=e,n[1]=t,n},t.add=function(e,t,n){return e[0]=t[0]+n[0],e[1]=t[1]+n[1],e},t.sub=t.subtract=function(e,t,n){return e[0]=t[0]-n[0],e[1]=t[1]-n[1],e},t.mul=t.multiply=function(e,t,n){return e[0]=t[0]*n[0],e[1]=t[1]*n[1],e},t.div=t.divide=function(e,t,n){return e[0]=t[0]/n[0],e[1]=t[1]/n[1],e},t.scale=function(e,t,n){return e[0]=t[0]*n,e[1]=t[1]*n,e},t.dist=t.distance=function(e,t){var n=t[0]-e[0],r=t[1]-e[1];return Math.sqrt(n*n+r*r)},t.sqrDist=t.squaredDistance=function(e,t){var n=t[0]-e[0],r=t[1]-e[1];return n*n+r*r},t.len=t.length=function(e){var t=e[0],n=e[1];return Math.sqrt(t*t+n*n)},t.sqrLen=t.squaredLength=function(e){var t=e[0],n=e[1];return t*t+n*n},t.negate=function(e,t){return e[0]=-t[0],e[1]=-t[1],e},t.normalize=function(e,t){var n=t[0]*t[0]+t[1]*t[1];return n>0&&(n=Math.sqrt(n),e[0]=t[0]/n,e[1]=t[1]/n),e},t.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]},t.cross=function(e,t,n){var r=t[0]*n[1]-t[1]*n[0];return e[0]=e[1]=0,e[2]=r,e},t.lerp=function(e,t,n,r){var i=t[0],s=t[1];return e[0]=i+r*(n[0]-i),e[1]=s+r*(n[1]-s),e},t.str=function(e){return"vec2("+e[0]+", "+e[1]+")"},e.vec2=t})()}(e.exports)})();
Oops, something went wrong.

0 comments on commit c4c1cf8

Please sign in to comment.