Changeset 1235
- Timestamp:
- 2008-10-23 13:23:05 (3 months ago)
- Files:
-
- trunk/app/models/iformat.rb (modified) (1 diff)
- trunk/config/deploy.rb (modified) (8 diffs)
- trunk/test/unit/iformat_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/app/models/iformat.rb
r1016 r1235 23 23 end 24 24 end 25 res.sort {|a,b| a[:name] <=> b[:name]} 25 res.sort do |a,b| 26 if a.size == 'keep' 27 b.size == 'keep' ? a[:name] <=> b[:name] : 1 28 else 29 (a.width * a.height) <=> (b.width * b.height) 30 end 31 end 26 32 end 27 33 trunk/config/deploy.rb
r1234 r1235 28 28 29 29 set :deploy_to, "/var/zena" 30 set :zena_sites, "/var/www/zena" 31 set :apache2_vhost_root, "/etc/apache2/sites-available" 32 set :apache2_deflate, true 33 set :apache2_debug_deflate, false 34 set :apache2_debug_rewrite, false 35 set :apache2_static, [] 36 set :apache2_reload_cmd, "/etc/init.d/apache2 reload" 37 set :debian_host, true 38 30 39 role :web, "root@#{server_ip}" 31 40 role :app, "root@#{server_ip}" 32 41 role :db, "root@#{server_ip}", :primary => true 33 set :apache2_deflate, true34 set :apache2_debug_deflate, false35 set :apache2_debug_rewrite, false36 # cgi-bin not working...? FIXME: set :apache2_static, ['cgi-bin', 'awstats-icon']37 set :apache2_static, []38 42 39 43 load File.join(File.dirname(__FILE__), 'deploy_config') … … 70 74 task :set_permissions, :roles => :app do 71 75 run "chown -R www-data:www-data #{deploy_to}" 72 run "chown -R www-data:www-data /var/www/zena"76 run "chown -R www-data:www-data #{zena_sites}" 73 77 end 74 78 … … 100 104 task :app_update_symlinks, :roles => :app do 101 105 run "test ! -e #{deploy_to}/current/sites || rm #{deploy_to}/current/sites" 102 run "ln -sf /var/www/zena#{deploy_to}/current/sites"106 run "ln -sf #{zena_sites} #{deploy_to}/current/sites" 103 107 set_permissions 104 108 end … … 112 116 task :app_setup, :roles => :app do 113 117 run "test -e #{deploy_to} || mkdir #{deploy_to}" 114 run "test -e /var/www/zena || mkdir /var/www/zena"118 run "test -e #{zena_sites} || mkdir #{zena_sites}" 115 119 deploy::setup 116 120 end … … 197 201 :balancer => db_name 198 202 ) 199 put(vhost, "/etc/apache2/sites-available/#{self[:host]}") 200 run "test -e /etc/apache2/sites-enabled/#{self[:host]} || a2ensite #{self[:host]}" 203 put(vhost, "#{apache2_vhost_root}/#{self[:host]}") 204 205 run "test -e /etc/apache2/sites-enabled/#{self[:host]} || a2ensite #{self[:host]}" if debian_host 201 206 202 207 unless self[:host] =~ /^www/ … … 204 209 :host => self[:host] 205 210 ) 206 put(vhost_www, " /etc/apache2/sites-available/www.#{self[:host]}")207 run "test -e /etc/apache2/sites-enabled/www.#{self[:host]} || a2ensite www.#{self[:host]}" 208 end 209 run "/etc/init.d/apache2 reload"211 put(vhost_www, "#{apache2_vhost_root}/www.#{self[:host]}") 212 run "test -e /etc/apache2/sites-enabled/www.#{self[:host]} || a2ensite www.#{self[:host]}" if debian_host 213 end 214 run apache2_reload_cmd 210 215 end 211 216 end … … 214 219 desc "Update awstats configuration file" 215 220 task :create_awstats, :roles => :web do 216 unless self[:host] && self[:pass]217 puts " host or password not set (use -s host=... -s pass=...)"221 unless debian_host 222 puts "skipping debian specific awstats" 218 223 else 219 # create awstats config file 220 awstats_conf = render("config/awstats.conf.rhtml", :host => self[:host] ) 221 put(awstats_conf, "/etc/awstats/awstats.#{self[:host]}.conf") 222 223 # create stats vhost 224 stats_vhost = render("config/stats.vhost.rhtml", :host => self[:host] ) 225 put(stats_vhost, "/etc/apache2/sites-available/stats.#{self[:host]}") 226 run "test -e /etc/apache2/sites-enabled/stats.#{self[:host]} || a2ensite stats.#{self[:host]}" 227 228 # directory setup for stats 229 run "test -e /var/www/zena/#{self[:host]}/log/awstats || mkdir /var/www/zena/#{self[:host]}/log/awstats" 230 run "chown www-data:www-data /var/www/zena/#{self[:host]}/log/awstats" 231 232 # setup cron task for awstats 233 run "cat /etc/cron.d/awstats | grep \"#{self[:host]}\" || echo \"0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.#{self[:host]}.conf -a -r /var/www/zena/#{self[:host]}/log/apache2.access.log ] && /usr/lib/cgi-bin/awstats.pl -config=#{self[:host]} -update >/dev/null\n\" >> /etc/cron.d/awstats" 234 235 # create .htpasswd file 236 run "test ! -e /var/www/zena/#{self[:host]}/log/.awstatspw || rm /var/www/zena/#{self[:host]}/log/.awstatspw" 237 run "htpasswd -c -b /var/www/zena/#{self[:host]}/log/.awstatspw 'admin' '#{self[:pass]}'" 238 239 # reload apache 240 run "/etc/init.d/apache2 reload" 224 unless self[:host] && self[:pass] 225 puts "host or password not set (use -s host=... -s pass=...)" 226 else 227 # create awstats config file 228 awstats_conf = render("config/awstats.conf.rhtml", :host => self[:host] ) 229 put(awstats_conf, "/etc/awstats/awstats.#{self[:host]}.conf") 230 231 # create stats vhost 232 stats_vhost = render("config/stats.vhost.rhtml", :host => self[:host] ) 233 put(stats_vhost, "#{apache2_vhost_root}/stats.#{self[:host]}") 234 run "test -e /etc/apache2/sites-enabled/stats.#{self[:host]} || a2ensite stats.#{self[:host]}" 235 236 # directory setup for stats 237 run "test -e #{zena_sites}/#{self[:host]}/log/awstats || mkdir #{zena_sites}/#{self[:host]}/log/awstats" 238 run "chown www-data:www-data #{zena_sites}/#{self[:host]}/log/awstats" 239 240 # setup cron task for awstats 241 run "cat /etc/cron.d/awstats | grep \"#{self[:host]}\" || echo \"0,10,20,30,40,50 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.#{self[:host]}.conf -a -r #{zena_sites}/#{self[:host]}/log/apache2.access.log ] && /usr/lib/cgi-bin/awstats.pl -config=#{self[:host]} -update >/dev/null\n\" >> /etc/cron.d/awstats" 242 243 # create .htpasswd file 244 run "test ! -e #{zena_sites}/#{self[:host]}/log/.awstatspw || rm #{zena_sites}/#{self[:host]}/log/.awstatspw" 245 run "htpasswd -c -b #{zena_sites}/#{self[:host]}/log/.awstatspw 'admin' '#{self[:pass]}'" 246 247 # reload apache 248 run "/etc/init.d/apache2 reload" 249 end 241 250 end 242 251 end … … 248 257 else 249 258 run "#{in_current} rake zena:rename_host OLD_HOST='#{self[:old_host]}' HOST='#{self[:host]}' RAILS_ENV='production'" 250 old_vhost_path = " /etc/apache2/sites-available/#{self[:old_host]}"259 old_vhost_path = "#{apache2_vhost_root}/#{self[:old_host]}" 251 260 run "a2dissite #{self[:old_host]}" 252 261 run "test -e #{old_vhost_path} && rm #{old_vhost_path}" trunk/test/unit/iformat_test.rb
r1219 r1235 34 34 def test_list 35 35 login(:lion) 36 assert_equal ["edit","full","low","med","mini","pv","side","square","std","tiny","top"], Iformat.list.map{|h| h[:name]}36 assert_equal %w{tiny mini pv square top low med side edit std full}, Iformat.list.map{|h| h[:name]} 37 37 38 38 login(:whale) 39 assert_equal ["edit","full","header", "low","med","mini","pv","side","square","std","tiny","top"], Iformat.list.map{|h| h[:name]}39 assert_equal %w{tiny mini pv square med top low side header edit std full}, Iformat.list.map{|h| h[:name]} 40 40 end 41 41
