-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8a362eb
commit 38fb3d0
Showing
133 changed files
with
1,551 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
The MIT License | ||
|
||
Copyright (c) 2009 Chris Wanstrath (Ruby) | ||
Copyright (c) 2010 Jan Lehnardt (JavaScript) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
require 'rake' | ||
require 'rake/clean' | ||
|
||
task :default => :spec | ||
|
||
desc "Run all specs" | ||
task :spec do | ||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new(:spec) do |t| | ||
#t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""] | ||
t.pattern = 'spec/*_spec.rb' | ||
end | ||
end | ||
|
||
def version | ||
File.read("mustache.js").match('version: "([^\"]+)",$')[1] | ||
end | ||
|
||
# Creates a rule that uses the .tmpl.{pre,post} stuff to make a final, | ||
# wrapped, output file. There is some extra complexity because Dojo and YUI3 | ||
# use different template files and final locations. | ||
def templated_build(name, opts={}) | ||
short = name.downcase | ||
source = File.join("wrappers", short) | ||
dependencies = ["mustache.js"] + Dir.glob("#{source}/*.tpl.*") | ||
target_js = opts[:location] ? "mustache.js" : "#{short}.mustache.js" | ||
|
||
CLEAN.include(opts[:location] ? opts[:location] : target_js) | ||
|
||
desc "Package for #{name}" | ||
task short.to_sym => dependencies do | ||
puts "Packaging for #{name}" | ||
|
||
mkdir_p opts[:location] if opts[:location] | ||
|
||
sh "cat #{source}/#{target_js}.tpl.pre mustache.js \ | ||
#{source}/#{target_js}.tpl.post > #{opts[:location] || '.'}/#{target_js}" | ||
|
||
# extra | ||
if opts[:extra] | ||
sh "sed -e 's/{{version}}/#{version}/' #{source}/#{opts[:extra]} \ | ||
> #{opts[:location]}/#{opts[:extra]}" | ||
end | ||
|
||
puts "Done, see #{opts[:location] || '.'}/#{target_js}" | ||
end | ||
end | ||
|
||
templated_build "CommonJS", :location => "lib", :extra => "package.json" | ||
templated_build "jQuery" | ||
templated_build "Dojo", :location => "dojox/string" | ||
templated_build "YUI3", :location => "yui3/mustache" | ||
templated_build "RequireJS" | ||
templated_build "qooxdoo" | ||
|
||
task :minify do | ||
# npm install uglify-js | ||
mmjs = "mustache.min.js" | ||
`echo "/*! Version: 0.4.2 */" > #{mmjs}` | ||
`uglifyjs mustache.js >> #{mmjs}` | ||
puts "Created #{mmjs}" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
## Running the mustache.js Test Suite | ||
|
||
Notice: the tests are only expected to run on unixoid systems. | ||
|
||
The mustache.js test suite uses the [RSpec](http://rspec.info/) testing | ||
framework. In order to run the tests you'll need to install [Ruby](http://ruby-lang.org/) | ||
as well as the `rake`, `rspec` (>=2), and `json` [RubyGems](http://rubygems.org/). | ||
|
||
### How to install Ruby and the required gems from source | ||
|
||
Make sure you have the required tools to compile it: | ||
|
||
$ apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev | ||
|
||
Download and extract the Ruby source, and install it: | ||
|
||
$ wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz | ||
$ tar xvzf stable-snapshot.tar.gz | ||
$ cd ruby | ||
$ ./configure && make && make install | ||
|
||
Download and extract RubyGems, and install it: | ||
|
||
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.12.tgz | ||
$ tar xzvf rubygems-1.8.12.tgz | ||
$ cd rubygems-1.8.12 | ||
$ ruby setup.rb | ||
|
||
If you want to update RubyGems: | ||
|
||
$ gem update --system | ||
|
||
Install the required gems: | ||
|
||
$ gem install rake rspec json | ||
|
||
That's it! | ||
|
||
### How to install node.js from source | ||
|
||
$ git clone https://github.com/joyent/node.git | ||
$ cd node | ||
$ # select the version to install, master is unstable; | ||
$ # latest stable version is advertised on http://nodejs.org | ||
$ git checkout v0.6.11 | ||
$ ./configure | ||
$ make | ||
$ sudo make install | ||
|
||
### How to run the tests | ||
|
||
The mustache.js test suite currently uses 4 different JavaScript runtime engines | ||
to maximize portability across platforms and browsers. They are: | ||
|
||
* node | ||
* SpiderMonkey (Mozilla, Firefox) | ||
* JavaScriptCore (WebKit, Safari) | ||
* Rhino (Mozilla, Java) | ||
|
||
When the test suite runs it will automatically determine which platforms are | ||
available on your machine and run on all of them. The suite must run on at least | ||
one platform in order to succeed. | ||
|
||
Once you have at least one JavaScript platform installed, you can run the test | ||
suite with the following command: | ||
|
||
$ rake | ||
|
||
### How to create a test | ||
|
||
All test files live in the spec/_files directory. To create a new test: | ||
|
||
* Create a template file `somename.mustache` | ||
* Create a javascript file with data and functions `somename.js` | ||
* Create a file the expected result `somename.txt` |
Oops, something went wrong.