forked from tavon/ruby-ace-editor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
50 lines (42 loc) · 1.21 KB
/
Copy pathRakefile
File metadata and controls
50 lines (42 loc) · 1.21 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
require 'rake/clean'
directory "tmp/"
CLEAN.include "tmp/"
file "tmp/ace" => "tmp/" do
cd "tmp/" do
sh "git clone git://github.com/ajaxorg/ace.git"
end
end
task :build => "tmp/ace" do
cd "tmp/ace" do
sh "git pull"
sh "npm install"
sh "node ./Makefile.dryice.js -nc"
end
end
file "lib/ace/version.rb" => :build do |f|
version = nil
cd "tmp/ace" do
version = `git describe --tags`.chomp
major, minor, sha = version.sub(/^v/, "").split('-')
version = "#{major}.#{minor}"
end
File.open(f.name, 'w') do |io|
io.write "module Ace\n VERSION = #{version.inspect}\nend\n"
end
end
CLOBBER.include "lib/ace/version.rb"
file "lib/ace.js" => :build do |f|
cp "tmp/ace/build/src-noconflict/ace.js", f.name
end
CLOBBER.include "lib/ace.js"
%w( keybinding mode theme worker ).each do |mod|
directory "lib/ace/#{mod}"
task mod => [:build, "lib/ace/#{mod}"] do |t|
Dir["tmp/ace/build/src-noconflict/#{t.name}-*.js"].each do |src|
cp src, "lib/ace/#{t.name}/#{File.basename(src).sub("#{t.name}-", "")}"
end
end
CLOBBER.include "lib/ace/#{mod}"
end
task :copy => ["lib/ace/version.rb", "lib/ace.js", :keybinding, :mode, :theme, :worker]
task :default => [:clobber, :copy]