-
Notifications
You must be signed in to change notification settings - Fork 7
/
Rakefile
53 lines (41 loc) · 1.53 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
require 'highline/import'
task default: :setup
desc 'Setup local environment'
task :setup do
local_impact_path = './lib/impact'
if File.exist?(File.expand_path(local_impact_path))
# TODO: run game
next
end
default_path = '~/Downloads/Impact'
impact_path = ask("Where is Impact.js located ?") { |p|
p.default = default_path
}
expanded_impact_path = File.expand_path(impact_path)
unless File.exist?(expanded_impact_path)
say_red "Could not find Impact.js under #{expanded_impact_path}"
next
end
impact_lib = "#{impact_path}/lib/impact"
expanded_impact_lib = File.expand_path(impact_lib)
say_green "Copying lib from #{expanded_impact_lib} to #{local_impact_path}"
`cp -R #{expanded_impact_lib}/ #{local_impact_path}`
weltmeister_lib = "#{impact_path}/lib/weltmeister"
local_weltmeister_path = './lib/weltmeister'
expanded_weltmeister_lib = File.expand_path(weltmeister_lib)
say_green "Copying weltmeister from #{expanded_weltmeister_lib} to " +
"#{local_weltmeister_path}"
`cp -R #{expanded_weltmeister_lib}/ #{local_weltmeister_path}`
# Remove the php references
say_green "Removing PHP references from #{local_weltmeister_path}/config.js"
`sed -i.bak 's/\.php//g' #{local_weltmeister_path}/config.js`
weltmeister_html = "#{impact_path}/weltmeister.html"
say_green "Copying weltmeister.html from #{weltmeister_html} to ."
`cp #{weltmeister_html} .`
end
def say_green(message)
say "<%= color('#{message}', :green) %>"
end
def say_red(message)
say "<%= color('#{message}', :red) %>"
end