Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

67 lines (53 sloc) 1.504 kB
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
Jump to Line
Something went wrong with that request. Please try again.