Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 22 lines (17 sloc) 0.861 kb
b027eef Tim Morgan initial import - mini.ajax only
authored
1 #!/usr/bin/env ruby
2
3 NAMESPACE = 'mini'
21a6174 Tim Morgan Add some simple form validation (completion of fields only).
authored
4 LIBS = %w(ajax form)
b027eef Tim Morgan initial import - mini.ajax only
authored
5 README = 'README.textile'
6
243ac4f Tim Morgan Add some usage instructions to the readme.
authored
7 content = File.read(README).split(/^h2. [^(Usage)]/).first.strip + "\n\n"
b027eef Tim Morgan initial import - mini.ajax only
authored
8
9 LIBS.each do |lib|
10 content << "h2. #{NAMESPACE}.#{lib}\n\n"
0d7164b Tim Morgan remove src extension
authored
11 code = File.read(File.join('src', lib + '.js'))
c52ddac Tim Morgan Fix readme generation.
authored
12 code.scan(/((^\/\/.+?\n)+)(mini\.[a-z0-9_]+\.[a-z0-9_]+)=function\(([a-z0-9_,]*)\)/).each do |doc, dummy, name, args|
e546d33 Tim Morgan More readme tweaking.
authored
13 content << "*#{name}(#{args})*\n"
b027eef Tim Morgan initial import - mini.ajax only
authored
14 content << doc.gsub(/^\/\/\s*/, '').sub(/\n+$/, '') + "\n\n"
1e30462 Tim Morgan Add tests for ajax lib
authored
15 end
21a6174 Tim Morgan Add some simple form validation (completion of fields only).
authored
16 code = code.gsub(/^\/\/.+\n/, '').gsub(/^ +/, '').gsub(/([,'"\w;\{\}\(\)\|\[\]])\n/, '\1').gsub(/\s*\/\/.+$/, '').gsub(/^\s+/m, '')
1e30462 Tim Morgan Add tests for ajax lib
authored
17 File.open(File.join('pkg', lib + '.js'), 'w') { |f| f.write(code) }
18 File.open(File.join('test/public/js', lib + '.js'), 'w') { |f| f.write(code) }
b027eef Tim Morgan initial import - mini.ajax only
authored
19 end
20
21 File.open(README, 'w') { |f| f.write(content) }
Something went wrong with that request. Please try again.