set :application, "your-application-flex" set :deploy_to, "/home/ernest/apps/#{application}" set :user, "ernest" set :flex_output, "bin" # the relative folder in which the compiled sources are found role :web, "your.host.com" # get the standard Rails recipe load 'deploy' # override update_code, restart namespace :deploy do desc "Update compiled Flex code by uploading them from local machine" task :update_code, :except => { :no_release => true } do on_rollback { run "rm -rf #{release_path}; true" } run "mkdir #{release_path}" # collect files without the debug versions and exclude this script filenames = [] Dir.new(flex_output).each {|f| if test(?d,f) filenames << f unless f =~ /^\./ else filenames << f unless f =~ /.*debug|Capfile/ end } # prepare command line argument sources = filenames.collect{ |e| "#{flex_output}/" + e }.join(' ') # if *nix use scp, if Windows use pscp # you can download pscp from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html scp_prog = (RUBY_PLATFORM =~ /(win|w)32$/) ? 'pscp': 'scp' cmd = "#{scp_prog} -r #{sources} #{user}@#{roles[:web]}:#{release_path}" puts "--- local executing:#{cmd}" system cmd end desc "Overridde from standard recipe to skip it" task :restart do puts "--- restart: skip it, nothing to restart" end end #namespace