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
|
# File 'lib/ie6_fixer.rb', line 12
def self.install_or_update_ie6_fixer
require 'fileutils'
orig = File.join(File.dirname(__FILE__), 'ie6_fixer', 'assets', 'ie6_fixer')
dest = File.join(Rails.root, 'public', 'javascripts', 'ie6_fixer')
readme = File.join(dest, 'README.txt')
unless File.exists?(readme) && FileUtils.identical?(File.join(orig, 'README.txt'), readme)
if File.exists?(readme)
begin
puts "Removing directory #{dest}..."
FileUtils.rm_rf dest
puts "Creating directory #{dest}..."
FileUtils.mkdir_p dest
puts "Copying ie6_fixer to #{dest}..."
FileUtils.cp_r "#{orig}/.", dest
puts "Successfully updated ie6_fixer."
rescue
puts 'ERROR: Problem updating ie6_fixer. Please manually copy '
puts orig
puts 'to'
puts dest
end
else
begin
puts "Creating directory #{dest}..."
FileUtils.mkdir_p dest
puts "Copying ie6_fixer to #{dest}..."
FileUtils.cp_r "#{orig}/.", dest
puts "Successfully installed ie6_fixer."
rescue
puts "ERROR: Problem installing ie6_fixer. Please manually copy "
puts orig
puts "to"
puts dest
end
end
end
end
|