summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb <michaelrbernstein@gmail.com>2011-02-03 08:46:17 -0500
committermrb <michaelrbernstein@gmail.com>2011-02-03 08:46:17 -0500
commit20ce9011c805023f5847a6b601c22e9553bc5308 (patch)
treee47c4b94854005b4d3a99a4a28f77377ec204c58
parent54e8666c315a373e2d4dc93d3d6dd90ca1496918 (diff)
downloadmustache-spec-20ce9011c805023f5847a6b601c22e9553bc5308.tar.gz
added task
-rw-r--r--README.md8
-rw-r--r--Rakefile12
-rw-r--r--specs/~lambdas.json2
3 files changed, 20 insertions, 2 deletions
diff --git a/README.md b/README.md
index fb16524..384b514 100644
--- a/README.md
+++ b/README.md
@@ -33,5 +33,11 @@ YAML and JSON
-------------
JSON versions of the YML specs were created using a simple ruby script:
+
+ require 'json' # Make sure you're using SYCK
+ require 'yaml'
+ Dir.glob("Mustache-Spec/specs/*").collect{|f| ff=f.gsub("yml","json"); File.open(ff,'w'){|x| x << YAML.parse(File.open(f)).transform.to_json}}
- Dir.glob("Mustache-Spec/specs/*").collect{|f| ff=f.gsub("yml","json"); File.open(ff,'w'){|x| x << YAML.parse(File.open(f)).transform.to_json}} \ No newline at end of file
+Which has been included as a Rake task:
+
+ rake build:json \ No newline at end of file
diff --git a/Rakefile b/Rakefile
new file mode 100644
index 0000000..efd7172
--- /dev/null
+++ b/Rakefile
@@ -0,0 +1,12 @@
+require 'rake/testtask'
+require 'json' # Please use SYCK
+require 'yaml'
+
+namespace :build do
+
+ desc "Build JSON from YAML"
+ task :json do
+ Dir.glob("specs/*").collect{|f| ff=f.gsub("yml","json"); File.open(ff,'w'){|x| x << YAML.parse(File.open(f)).transform.to_json}}
+ end
+
+end \ No newline at end of file
diff --git a/specs/~lambdas.json b/specs/~lambdas.json
index f6cbfa2..f9706be 100644
--- a/specs/~lambdas.json
+++ b/specs/~lambdas.json
@@ -1 +1 @@
-{"tests":[{"name":"Interpolation","data":{"lambda":"#<YAML::DomainType:0x1017bdb10>"},"expected":"Hello, world!","template":"Hello, {{lambda}}!","desc":"A lambda's return value should be interpolated."},{"name":"Interpolation - Expansion","data":{"planet":"world","lambda":"#<YAML::DomainType:0x1017bc2b0>"},"expected":"Hello, world!","template":"Hello, {{lambda}}!","desc":"A lambda's return value should be parsed."},{"name":"Interpolation - Multiple Calls","data":{"lambda":"#<YAML::DomainType:0x1017b9ad8>"},"expected":"1 == 1 == 1","template":"{{lambda}} == {{{lambda}}} == {{lambda}}","desc":"Interpolated lambdas should only be called once."},{"name":"Interpolation - Caches","data":{"context":{"lambda":"#<YAML::DomainType:0x1017b7d28>","key":"Under"},"key":"Top"},"expected":"Under the Big Top","template":"{{#context}}{{key}} the {{lambda}}{{/context}} {{key}}","desc":"Lambda caches should not disrupt normal context operations."},{"name":"Escaping","data":{"lambda":"#<YAML::DomainType:0x1017b5b40>"},"expected":"<&gt;>","template":"<{{lambda}}{{{lambda}}}","desc":"Lambda results should be appropriately escaped."},{"name":"Section","data":{"x":"Error!","lambda":"#<YAML::DomainType:0x1017b3098>"},"expected":"<yes>","template":"<{{#lambda}}{{x}}{{/lambda}}>","desc":"Lambdas used for sections should receive the raw section string."},{"name":"Section - Expansion","data":{"planet":"Earth","lambda":"#<YAML::DomainType:0x1017b18b0>"},"expected":"<-Earth->","template":"<{{#lambda}}-{{/lambda}}>","desc":"Lambdas used for sections should have their results parsed."},{"name":"Section - Multiple Calls","data":{"lambda":"#<YAML::DomainType:0x1017afad8>"},"expected":"__FILE__ != __LINE__","template":"{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}","desc":"Lambdas used for sections should not simply cache the first response."},{"name":"Inverted Section","data":{"static":"static","lambda":"#<YAML::DomainType:0x1017ae598>"},"expected":"<>","template":"<{{^lambda}}{{static}}{{/lambda}}>","desc":"Lambdas used for inverted sections should be considered truthy."}]} \ No newline at end of file
+{"tests":[{"name":"Interpolation","data":{"lambda":"#<YAML::DomainType:0x1017cae28>"},"expected":"Hello, world!","template":"Hello, {{lambda}}!","desc":"A lambda's return value should be interpolated."},{"name":"Interpolation - Expansion","data":{"planet":"world","lambda":"#<YAML::DomainType:0x1017ca388>"},"expected":"Hello, world!","template":"Hello, {{lambda}}!","desc":"A lambda's return value should be parsed."},{"name":"Interpolation - Multiple Calls","data":{"lambda":"#<YAML::DomainType:0x1017c96e0>"},"expected":"1 == 1 == 1","template":"{{lambda}} == {{{lambda}}} == {{lambda}}","desc":"Interpolated lambdas should only be called once."},{"name":"Interpolation - Caches","data":{"context":{"lambda":"#<YAML::DomainType:0x1017c8998>","key":"Under"},"key":"Top"},"expected":"Under the Big Top","template":"{{#context}}{{key}} the {{lambda}}{{/context}} {{key}}","desc":"Lambda caches should not disrupt normal context operations."},{"name":"Escaping","data":{"lambda":"#<YAML::DomainType:0x1017c7b88>"},"expected":"<&gt;>","template":"<{{lambda}}{{{lambda}}}","desc":"Lambda results should be appropriately escaped."},{"name":"Section","data":{"x":"Error!","lambda":"#<YAML::DomainType:0x1017c70e8>"},"expected":"<yes>","template":"<{{#lambda}}{{x}}{{/lambda}}>","desc":"Lambdas used for sections should receive the raw section string."},{"name":"Section - Expansion","data":{"planet":"Earth","lambda":"#<YAML::DomainType:0x1017c6260>"},"expected":"<-Earth->","template":"<{{#lambda}}-{{/lambda}}>","desc":"Lambdas used for sections should have their results parsed."},{"name":"Section - Multiple Calls","data":{"lambda":"#<YAML::DomainType:0x1017c5658>"},"expected":"__FILE__ != __LINE__","template":"{{#lambda}}FILE{{/lambda}} != {{#lambda}}LINE{{/lambda}}","desc":"Lambdas used for sections should not simply cache the first response."},{"name":"Inverted Section","data":{"static":"static","lambda":"#<YAML::DomainType:0x1017c4c58>"},"expected":"<>","template":"<{{^lambda}}{{static}}{{/lambda}}>","desc":"Lambdas used for inverted sections should be considered truthy."}]} \ No newline at end of file