The original lightbox script, finally on github. http://lokeshdhakar.com/projects/lightbox2/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.1KB

  1. ## -- Rsync Deploy config -- ##
  2. ssh_user = "lokesh@lokesh.webfactional.com"
  3. ssh_port = "22"
  4. document_root = "~/webapps/lokeshdhakar/projects/lightbox2/"
  5. rsync_delete = true
  6. deploy_default = "rsync"
  7. ## -- Misc Configs -- ##
  8. sass_dir = "sass" # sass file directory
  9. css_dir = "css" # compiled css directory
  10. coffeescript_dir = "coffee" # coffeescript file directory
  11. js_dir = "js" # compiled js directory
  12. desc "Watches for SASS and Coffeescript file changes to compile."
  13. task :watch do
  14. puts "Starting to watch source with Compass and Coffeescript."
  15. compassPid = Process.spawn("compass watch --sass-dir #{sass_dir} --css-dir #{css_dir}")
  16. coffeePid = Process.spawn("coffee -o #{js_dir}/ -cw #{coffeescript_dir}/")
  17. trap("INT") {
  18. [compassPid, coffeePid].each { |pid| Process.kill(9, pid) rescue Errno::ESRCH }
  19. exit 0
  20. }
  21. [compassPid, coffeePid].each { |pid| Process.wait(pid) }
  22. end
  23. desc "Create zip of latest code."
  24. task :zip, :version do |t, args|
  25. if args.version.nil?
  26. puts "You need to specify a version number."
  27. puts "Example: rake zip[2.5]"
  28. puts "Will create lightboxv2.5.zip"
  29. else
  30. puts "Zip-a-dee-doo-dah"
  31. puts "Version: #{args.version}"
  32. system "rm -rf lightbox"
  33. system "mkdir lightbox"
  34. system "cp index.html lightbox"
  35. system "cp README.markdown lightbox"
  36. system "cp -r css lightbox"
  37. system "cp -r js lightbox"
  38. system "cp -r images lightbox"
  39. system "zip -r lightbox#{args.version}.zip lightbox"
  40. system "mv lightbox#{args.version}.zip releases"
  41. system "rm -rf lightbox"
  42. puts "My, oh my what a wonderful day!"
  43. end
  44. end
  45. desc "Pushes code to production."
  46. task :deploy do
  47. puts "Rsyncing files to production server."
  48. exclude = ""
  49. if File.exists?('./rsync-exclude')
  50. exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
  51. end
  52. puts "## Deploying website via Rsync"
  53. ok_failed system("rsync -avze 'ssh -p #{ssh_port}' #{exclude} #{"--delete" unless rsync_delete == false} . #{ssh_user}:#{document_root}")
  54. end
  55. def ok_failed(condition)
  56. if (condition)
  57. puts "OK"
  58. else
  59. puts "FAILED"
  60. end
  61. end