-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathRakefile
70 lines (56 loc) · 1.85 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
67
68
69
70
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'code_statistics'
# Load up the entire host rails enviroment
require File.dirname(__FILE__) + '/../../../config/environment'
desc 'Default: run eschaton tests.'
task :default => :test
desc 'Test the eschaton plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
desc "Report code statistics (KLOCs, etc) from the eschaton and slices"
task :stats do
STATS_DIRECTORIES = [
%w(eschaton lib/eschaton),
%w(kernel_slice slices/eschaton_kernel),
%w(google_maps_slice slices/google_maps),
%w(jquery_slice slices/jquery)
].collect { |name, dir| [ name, "#{File.dirname(__FILE__)}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
CodeStatistics.new(*STATS_DIRECTORIES).to_s
end
desc 'Generate documentation for the eschaton plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'eschaton'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
rdoc.rdoc_files.include("slices/*/**/*.rb")
end
desc 'Opens documentation for the eschaton plugin.'
task :open_doc do |rdoc|
`open rdoc/index.html`
end
desc 'Default: run eschaton tests.'
task :rdoc_and_open => [:rdoc, :open_doc]
desc 'Updates eschaton related javascript files.'
task :update_javascript do
update_javascript
end
desc 'Clones an eschaton slice from a git repo'
task :clone_slice do
SliceCloner.clone :repo => ENV['slice']
end
def update_javascript
project_dir = RAILS_ROOT + '/public/javascripts/'
scripts = Dir['generators/map/templates/*.js']
FileUtils.cp scripts, project_dir
puts 'Updated javascripts:'
scripts.each do |script|
puts " /public/javascripts/#{File.basename(script)}"
end
end