This repository has been archived by the owner on Mar 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathRakefile
66 lines (59 loc) · 2.22 KB
/
Rakefile
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
require 'rubygems'
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require File.expand_path("./lib/bhm/google_maps/version", File.dirname(__FILE__))
desc "Default: run unit tests."
task :default => :test
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "bhm-google-maps"
gem.summary = "Helpers for Google Maps v3 in Rails - Using html 5, the google maps api v3 and the static maps api"
gem.description = "A set of helpers and javascript files that makes it trivial to implement google maps unobtrusively in an application."
gem.email = "[email protected]"
gem.homepage = "http://github.com/YouthTree/bhm-google-maps"
gem.authors = ["Darcy Laycock"]
gem.version = BHM::GoogleMaps::VERSION
end
Jeweler::GemcutterTasks.new
rescue LoadError
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
end
desc "Compiles the javascript from Coffeescript to Javascript"
task :compile_scripts do
system "coffee --no-wrap -o javascripts/ -c coffeescripts/"
end
desc "Interactively compiles coffeescripts as they're changed"
task :watch_scripts do
system "coffee --no-wrap -w -o javascripts/ -c coffeescripts/"
end
desc "Compile scripts, and produce a minified version."
task :build_scripts => [:compile_scripts] do
require 'closure-compiler'
build_prefix = "build/#{BHM::GoogleMaps::VERSION}"
FileUtils.mkdir_p build_prefix
Dir["javascripts/*.js"].each do |js|
new_name = js.gsub(/^javascripts\//, build_prefix + "/").gsub(/\.js$/, "-#{BHM::GoogleMaps::VERSION}.js")
FileUtils.cp js, new_name
min_name = new_name.gsub(/\.js$/, '.min.js')
File.open(min_name, "w+") do |f|
f.write Closure::Compiler.new.compile(File.read(js))
end
end
end
desc "Generate docs for the bhm-google-maps plugin"
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "bhm-google-maps"
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.md')
rdoc.rdoc_files.include('lib/**/*.rb')
end
desc "Test the bhm-google-maps plugin"
Rake::TestTask.new(:test) do |test|
test.libs << 'lib'
test.libs << 'test'
test.pattern = 'test/**/*_test.rb'
test.verbose = true
end