root/lang/javascript/jsdeferred/trunk/Rakefile @ 2659

Revision 2659, 1.3 kB (checked in by cho45, 7 years ago)

lang/javascript/jsdeferred/trunk/Rakefile,
lang/javascript/jsdeferred/trunk/jsdeferred.nodoc.js:

nodoc をもうすこし綺麗に

Line 
1
2require "rubygems"
3require "rake"
4require "rake/clean"
5
6COPYRIGHT = <<EOS
7JSDefeered (c) Copyright (c) 2007 cho45 ( www.lowreal.net )
8See http://coderepos.org/share/wiki/JSDeferred
9EOS
10
11CLEAN.include ["jsdeferred.{nodoc,mini,jquery}.js"]
12
13def mini(js, commentonly=false)
14        js = js.dup
15        js.gsub!(%r|\n?/\*.*?\*/|m, "")
16        js.gsub!(%r|\n?\s*//.*|, "")
17        js.gsub!(/\A\s+|\s+\z/, "")
18        unless commentonly
19                js.gsub!(/^\s+/, "")
20                js.gsub!(/[ \t]+/, " ")
21                js.gsub!(/\n\n+/, "\n")
22                js.gsub!(/\s?;\s?/, ";")
23                js.gsub!(/ ?([{}()<>:=,*\/+-]) ?/, "\\1")
24        end
25        COPYRIGHT.gsub(/^/, "// ") + js
26end
27
28task :default => [:test]
29
30task :test => [:release] do
31end
32
33task :release => ["jsdeferred.nodoc.js", "jsdeferred.mini.js", "jsdeferred.js", "jsdeferred.jquery.js", "doc/index.html"] do
34end
35
36file "jsdeferred.nodoc.js" => ["jsdeferred.js"] do |t|
37        File.open(t.name, "w") {|f|
38                f << mini(File.read("jsdeferred.js"), true)
39        }
40end
41
42file "jsdeferred.mini.js" => ["jsdeferred.js"] do |t|
43        File.open(t.name, "w") {|f|
44                f << mini(File.read("jsdeferred.js"))
45        }
46end
47
48file "jsdeferred.jquery.js" => ["jsdeferred.js", "binding/jquery.js"] do |t|
49        File.open(t.name, "w") {|f|
50                f << mini(File.read("jsdeferred.js") + File.read("binding/jquery.js"))
51        }
52end
53
54
55file "doc/index.html" => ["jsdeferred.js"] do |t|
56        sh %{ruby makedoc.rb}
57end
58
Note: See TracBrowser for help on using the browser.