All, Wanted to post this modified active_scaffold/install_assets.rb file (AS 2.2.2) that will work with either pure Ruby or JRuby WAR deployments of your app.
Because deploying as a WAR file with Warbler implies that there is no "public" directory, and further that a bunch of the source paths will have "WEB-INF" in them, these pathing issues need to be managed when deploying via WAR file. We can use the absence of the "public" directory as a key throughout to do the right thing. All modifications are commented with a #WG - comment below. Hopefully this may be of some use: # 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) destination.gsub!(/\/WEB-INF/, '') #WG - Remove WEB-INF dir for WAR deployments FileUtils.mkdir(destination) unless File.exist?(destination) FileUtils.cp_r(Dir.glob(source+'/*.*'), destination) end directory = File.dirname(__FILE__) #WG - WAR deployments will not have public path as "public" so respond to that Rails.public_path =~ /public/ ? copy_files("/public", "/public", directory) : copy_files("/public", "", directory) available_frontends = Dir[File.join(directory, 'frontends', '*')].collect { |d| File.basename d } [:stylesheets, :javascripts, :images].each do |asset_type| source_path = target_path = "/public/#{asset_type}/active_scaffold" target_path.gsub!(/\/public/, '') if Rails.public_path !~ /public/ #WG - Remove public from path for WAR deployments copy_files(source_path, target_path, directory) File.open(File.join(Rails.public_path, target_path.sub(/\/public/, ''), 'DO_NOT_EDIT'), 'w') do |f| #WG - Remove public from path since we are using Rails.public_path and it is duplicated 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}" destination.gsub!(/\/public/, '') if Rails.public_path !~ /public/ #WG - Remove public from path for WAR deployments copy_files(source, destination, directory) end end end --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "ActiveScaffold : Ruby on Rails plugin" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/activescaffold?hl=en -~----------~----~----~----~------~----~------~--~---
