public
Description: Useful pieces of JavaScript. Some old, some new.
Homepage: http://alternateidea.com
Clone URL: git://github.com/Caged/javascript-bits.git
commit  16af773a1316774b53805b7fc63b5e1eec34c35d
tree    81a3f4eea4fb7a8ab8bec850530e20339ea6848d
parent  04c7477505d3998b9ab0ebdbdd321407f2af940a
javascript-bits / color / Rakefile
100644 40 lines (34 sloc) 1.098 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
require 'rake'
require 'rake/packagetask'
 
COLOR_ROOT = File.expand_path(File.dirname(__FILE__))
COLOR_SRC_DIR = File.join(COLOR_ROOT, 'src')
COLOR_DIST_DIR = File.join(COLOR_ROOT, 'dist')
COLOR_PKG_DIR = File.join(COLOR_ROOT, 'pkg')
COLOR_VERSION = '0.1.0'
 
desc "Update Prototype to latest"
task :update_prototype do
  rm 'vendor/prototype.js' if File.exists?('vendor/prototype.js')
  `svn export http://dev.rubyonrails.org/svn/rails/trunk/railties/html/javascripts/prototype.js vendor/prototype.js`
  puts '-> Prototype updated sucessfully'
end
 
 
desc "Combine all the files for distribution"
task :dist do
  $:.unshift File.join(COLOR_ROOT, 'lib')
  require 'protodoc'
  
  Dir.chdir(COLOR_SRC_DIR) do
    File.open(File.join(COLOR_DIST_DIR, 'color.js'), 'w+') do |dist|
      dist << Protodoc::Preprocessor.new('color.js')
    end
  end
end
 
Rake::PackageTask.new('color', COLOR_VERSION) do |package|
  package.need_tar_gz = true
  package.package_dir = COLOR_PKG_DIR
  package.package_files.include(
    '[A-Z]*',
    'dist/color.js',
    'lib/**',
    'src/**',
    'test/**'
  )
end