Skip to content

Commit

Permalink
Add package.json to CommonJS package (rake commonjs).
Browse files Browse the repository at this point in the history
Use fancy regex to auto-fill the version number.
Closes janl#37.
  • Loading branch information
janl committed May 22, 2010
1 parent 3abfafa commit c6fc49c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
16 changes: 14 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,27 @@ def templated_build(name, opts={})
sh "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}"
puts "Done, see #{opts[:location] || '.'}/#{target_js}"

# extra
if opts[:extra]
sh "cat #{source}/#{opts[:extra]} | sed -e 's/{{version}}/#{version}/' > #{opts[:location]}/#{opts[:extra]}"
end

puts "Done, see #{opts[:location] || '.'}/#{target_js}"

end
end

templated_build "CommonJS", :location => "lib"
templated_build "CommonJS", :location => "lib", :extra => "package.json"
templated_build "jQuery"
templated_build "Dojo", :location => "dojox/string"
templated_build "YUI3", :location => "yui3/mustache"

def version
File.read("mustache.js").match('version: "([^\"]+)",$')[1]
end


desc "Remove temporary files."
task :clean do
sh "git clean -fdx"
Expand Down
7 changes: 7 additions & 0 deletions mustache-commonjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "mustache",
"author": "http://mustache.github.com/",
"description": "{{ mustache }} in JavaScript — Logic-less templates.",
"keywords": ["template"],
"version": "{{version}}"
}
7 changes: 0 additions & 7 deletions package.json

This file was deleted.

0 comments on commit c6fc49c

Please sign in to comment.