gaffo / active_scaffold forked from activescaffold/active_scaffold

This URL has Read+Write access

commit  0ef10210eee7918fdb2f941dfaee02caf97284e9
tree    bfcce389bb5f69eeda4b411bca41fcd35bb3f005
parent  d3e67ce8044ac64febb3127294c700d8e05ea941
active_scaffold / install_assets.rb
100755 36 lines (28 sloc) 1.29 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
# Workaround a problem with script/plugin and http-based repos.
# See http://dev.rubyonrails.org/ticket/8189
Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do
 
##
## Copy over asset files (javascript/css/images) from the plugin directory to public/
##
 
def copy_files(source_path, destination_path, directory)
  source, destination = File.join(directory, source_path), File.join(Rails.root, destination_path)
  FileUtils.mkdir(destination) unless File.exist?(destination)
  FileUtils.cp_r(Dir.glob(source+'/*.*'), destination)
end
 
directory = File.dirname(__FILE__)
 
copy_files("/public", "/public", directory)
 
available_frontends = Dir[File.join(directory, 'frontends', '*')].collect { |d| File.basename d }
[ :stylesheets, :javascripts, :images].each do |asset_type|
  path = "/public/#{asset_type}/active_scaffold"
  copy_files(path, path, directory)
  
  File.open(File.join(Rails.root, path, 'DO_NOT_EDIT'), 'w') do |f|
    f.puts "Any changes made to files in sub-folders will be lost."
    f.puts "See http://activescaffold.com/tutorials/faq#custom-css."
  end
 
  available_frontends.each do |frontend|
    source = "/frontends/#{frontend}/#{asset_type}/"
    destination = "/public/#{asset_type}/active_scaffold/#{frontend}"
    copy_files(source, destination, directory)
  end
end
 
end