<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SameShirtEveryDay.com &#187; Capistrano</title>
	<atom:link href="http://sameshirteveryday.com/category/capistrano/feed/" rel="self" type="application/rss+xml" />
	<link>http://sameshirteveryday.com</link>
	<description>Personal blog of the one called Alex Gorbatchev, from Toronto, Canada.</description>
	<lastBuildDate>Wed, 30 Dec 2009 20:00:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Staging with Capistrano</title>
		<link>http://sameshirteveryday.com/2007/06/10/staging-with-capistrano/</link>
		<comments>http://sameshirteveryday.com/2007/06/10/staging-with-capistrano/#comments</comments>
		<pubDate>Sun, 10 Jun 2007 19:48:11 +0000</pubDate>
		<dc:creator>Alex Gorbatchev</dc:creator>
				<category><![CDATA[Capistrano]]></category>

		<guid isPermaLink="false">http://www.sameshirteveryday.com/2007/06/10/playing-around-with-capistrano-safely/</guid>
		<description><![CDATA[To configure Capistrano for the most basic staging environment, I modified my deploy.rb like so:
ENV['STAGE'] &#124;&#124;= "staging"

paths = {
  :staging          =&#62; "stage01.mydomain.com",
  :production       =&#62; "mydomain.com"
}

set :application,   "mydomain.com"
set :dir,         [...]]]></description>
			<content:encoded><![CDATA[<p>To configure Capistrano for the most basic staging environment, I modified my deploy.rb like so:</p>
<pre name="code" class="ruby">ENV['STAGE'] ||= "staging"

paths = {
  :staging          =&gt; "stage01.mydomain.com",
  :production       =&gt; "mydomain.com"
}

set :application,   "mydomain.com"
set :dir,           paths[ENV['STAGE'].to_sym]
set :user,          "..."

role :web, application
role :app, application
role :db,  application, :primary =&gt; true

set :deploy_to, "/home/#{user}/#{dir}"
set :use_sudo, false</pre>
<p>As you can see, it defaults to &#8220;staging&#8221; so any calls like &#8220;cap deploy&#8221; or &#8220;cap update_code&#8221; will be performed in a safe sandbox. To go live, I have a &#8220;cap_production.bat&#8221; in the root folder:</p>
<pre name="code" class="ruby">SET STAGE=production
cap %1 %2 %3 %4 %5</pre>
]]></content:encoded>
			<wfw:commentRss>http://sameshirteveryday.com/2007/06/10/staging-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Upload big files with Capistrano</title>
		<link>http://sameshirteveryday.com/2007/06/10/upload-big-files-with-capistrano/</link>
		<comments>http://sameshirteveryday.com/2007/06/10/upload-big-files-with-capistrano/#comments</comments>
		<pubDate>Sun, 10 Jun 2007 19:41:58 +0000</pubDate>
		<dc:creator>Alex Gorbatchev</dc:creator>
				<category><![CDATA[Capistrano]]></category>

		<guid isPermaLink="false">http://www.sameshirteveryday.com/2007/06/10/upload-big-files-with-capistrano/</guid>
		<description><![CDATA[Guy Naor has a nice tip to help with large file uploading in Capistrano.
class Capistrano::Actor

  # A saner put replacement that doesn't read the whole file into memory...
  def put_file(path, remote_path, options = {})
    raise "put_file can only be used with SFTP" unless Capistrano::SFTP &#038;&#038; options.fetch(:sftp, true)

    [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://devblog.famundo.com/">Guy Naor</a> has a <a href="http://devblog.famundo.com/articles/2007/03/10/improving-capistranos-put-command">nice tip</a> to help with large file uploading in Capistrano.</p>
<pre name="code" class="ruby">class Capistrano::Actor

  # A saner put replacement that doesn't read the whole file into memory...
  def put_file(path, remote_path, options = {})
    raise "put_file can only be used with SFTP" unless Capistrano::SFTP &#038;&#038; options.fetch(:sftp, true)

    execute_on_servers(options) do |servers|
      servers.each do |server|
        logger.info "uploading #{File.basename(path)} to #{server}"
        sftp = sessions[server].sftp
        sftp.connect unless sftp.state == <img src='http://sameshirteveryday.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> pen
        sftp.put_file path, remote_path
        logger.debug "done uploading #{File.basename(path)} to #{server}"
      end
    end
  end

end</pre>
<p>and I had to update it for Capistrano 2.0:</p>
<pre name="code" class="ruby">module Capistrano
  class Configuration
    module Actions
      module FileTransfer

        # A saner put replacement that doesn't read the whole file into memory...
        def put_file(path, remote_path, options = {})
          execute_on_servers(options) do |servers|
            servers.each do |server|
              logger.info "uploading #{File.basename(path)} to #{server}"
              sftp = sessions[server].sftp
              sftp.connect unless sftp.state == <img src='http://sameshirteveryday.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> pen
              sftp.put_file path, remote_path
              logger.debug "done uploading #{File.basename(path)} to #{server}"
            end
          end
        end

      end
    end
  end
end</pre>
]]></content:encoded>
			<wfw:commentRss>http://sameshirteveryday.com/2007/06/10/upload-big-files-with-capistrano/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
