-
Notifications
You must be signed in to change notification settings - Fork 5
/
install.rb
66 lines (58 loc) · 2.1 KB
/
install.rb
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 File.dirname(__FILE__) + '/../../../config/boot'
directory = File.join(RAILS_ROOT, '/vendor/plugins/themes/')
def xcopy(options)
source = options[:source]
dest = options[:dest]
logging = options[:logging].nil? ? true : options[:logging]
Dir.foreach(source) do |entry|
next if entry =~ /^\./
if File.directory?(File.join(source, entry))
unless File.exist?(File.join(dest, entry))
if logging
puts "Creating directory #{entry}..."
end
FileUtils.mkdir File.join(dest, entry)
end
xcopy(:source => File.join(source, entry),
:dest => File.join(dest, entry),
:logging => logging)
else
if logging
puts " Installing file #{entry}..."
end
FileUtils.cp File.join(source, entry), File.join(dest, entry)
end
end
end
puts "** Installing Theme Assets **"
src = File.join(directory, '/assets/')
dst = File.join(RAILS_ROOT, '/public/themes/')
unless File.exists?(dst)
puts "Creating destination directory..."
FileUtils.mkdir(dst)
end
xcopy(:source => src, :dest => dst, :logging => true)
puts "** Successfully Installed Theme Assets **"
puts "** Installing Theme Layouts **"
src = File.join(directory, '/templates/')
dst = File.join(RAILS_ROOT, '/app/views/layouts/')
unless File.exists?(dst)
puts "Creating destination directory..."
FileUtils.mkdir(dst)
end
xcopy(:source => src, :dest => dst, :logging => true)
puts "** Successfully Installed Theme Layouts **"
puts "** Installing Site Config **"
src = File.join(directory, '/config/')
dst = File.join(RAILS_ROOT, '/config/')
xcopy(:source => src, :dest => dst, :logging => true)
src = File.join(directory, '/initializers/')
dst = File.join(RAILS_ROOT, '/config/initializers/')
xcopy(:source => src, :dest => dst, :logging => true)
puts "** Successfully Installed Site Config **"
puts "** Installing Helpers **"
src = File.join(directory, '/helpers/')
dst = File.join(RAILS_ROOT, '/app/helpers/')
xcopy(:source => src, :dest => dst, :logging => true)
puts "** Successfully Installed Helpers **"
puts IO.read(File.join(directory, 'README.rdoc'))