public
Description: Branch of Dan Webb's JavaScript DOM event library. Small JavaScript library built as an extension to Prototype that makes unobtrusive DOM scripting much easier
Homepage: http://groups.google.co.uk/group/low-pro
Clone URL: git://github.com/brianjlandau/lowpro.git
brianjlandau (author)
Thu Sep 04 07:10:43 -0700 2008
commit  f91e4796fba477de1d1371987e33f48e88f2a2e0
tree    6cf0e8340d609bf2cff309eb686136e592951d2d
parent  8d4617ab4adf720586f425d74cd674d5497d4213
lowpro / Rakefile
100644 68 lines (54 sloc) 1.529 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env ruby -wKU
require 'rake'
require 'rubygems'
require 'zip/zip'
require 'fileutils'
 
ROOT = File.dirname(__FILE__)
SRC = ROOT + '/src'
DIST = ROOT + '/dist'
TEST = ROOT + '/test'
 
def file_list(dir, *files)
  files.collect { |f| dir + "/#{f}" }
end
 
def get_version_string
  File.open(SRC + "/lowpro.js") do |f|
    f.read.match(/LowPro\.Version\s?=\s?'([^']+)'/)
  end
  return $1
end
 
DOC = ROOT + '/doc'
LP_VERSION = get_version_string
 
SOURCE_LIST = file_list SRC, 'lowpro.js', 'dom.js', 'domready.js', 'behavior.js', 'core_behaviors.js'
 
DIST_LIST = file_list DIST, 'lowpro.js', 'README', 'LICENSE'
 
task :default => :dist
 
desc 'Package Low Pro for distribution.'
task :dist => :build do
  puts 'Packaging distribution...'
  FileUtils.cp Dir[DOC + '/**/*'], DIST
  
  Zip::ZipFile.open(DIST + "/lowpro.zip", Zip::ZipFile::CREATE) do |zip|
    DIST_LIST.each do |f|
      zip.get_output_stream(File.basename(f)) { |o| o << File.open(f).read } if File.exists? f
    end
  end
  
end
 
desc 'Delete all files from dist.'
task :clean do
  puts 'Cleaning dist...'
  FileUtils.rm Dir[DIST + '/**/*']
end
 
desc 'Compiles JS into a single file.'
task :build => :clean do
  puts 'Building script...'
  File.open(DIST + '/lowpro.js', 'w') do |lowpro|
    SOURCE_LIST.each do |src|
      File.open(src) do |f|
        lowpro << f.read
        lowpro << "\n\n"
      end
    end
  end
end
 
desc 'Copies a built version of LowPro to test dir.'
task :dist_to_test => :build do
  FileUtils.cp [DIST + '/lowpro.js'], TEST
end