<?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>BoxCycle Blog &#187; git</title>
	<atom:link href="http://blog.boxcycle.com/tag/git/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.boxcycle.com</link>
	<description>Make the World Better - Be Part of the Cycle!</description>
	<lastBuildDate>Wed, 01 Feb 2012 16:00:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Keep Last Modified Dates with Capistrano Deploy and SVN/Git</title>
		<link>http://blog.boxcycle.com/2011/05/keep-last-modified-dates-with-capistrano-deploy-and-svn-git/</link>
		<comments>http://blog.boxcycle.com/2011/05/keep-last-modified-dates-with-capistrano-deploy-and-svn-git/#comments</comments>
		<pubDate>Tue, 24 May 2011 00:05:36 +0000</pubDate>
		<dc:creator>BoxCycle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[svn]]></category>

		<guid isPermaLink="false">http://boxcycle.cheapcardboardboxes.biz/?p=369</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.boxcycle.com/2011/05/keep-last-modified-dates-with-capistrano-deploy-and-svn-git/' addthis:title='Keep Last Modified Dates with Capistrano Deploy and SVN/Git '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>BoxCycle is a Rails application that just switched to Git from SVN for version control and uses Capistrano to help automate deployment. Problem: Deploy Updates Last Modified Dates on All Files As shocking as it may seem, when you deploy a new version of your app, there is a good chance that Last Modified dates [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://blog.boxcycle.com/2011/05/keep-last-modified-dates-with-capistrano-deploy-and-svn-git/' addthis:title='Keep Last Modified Dates with Capistrano Deploy and SVN/Git '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.boxcycle.com/2011/05/keep-last-modified-dates-with-capistrano-deploy-and-svn-git/' addthis:title='Keep Last Modified Dates with Capistrano Deploy and SVN/Git '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>BoxCycle is a Rails application that just switched to Git from SVN for version control and uses Capistrano to help automate deployment.</p>
<h2>Problem: Deploy Updates Last Modified Dates on All Files</h2>
<p>As shocking as it may seem, when you deploy a new version of your app, there is a good chance that Last Modified dates of <b>all</b> files will be updated to the date of deployment even though most of those files did not change.</p>
<h2>Why Are Last Modified Dates Important?</h2>
<p>In a word, <strong>caching</strong>.</p>
<p>Last Modified dates are used for Last-Modified and Etag headers which are used by the server to tell the browser if it can use the file already stored in the cache or needs to download the file again.  They are also used by Rails for generating cache-busters &#8211; the query parameter it adds to images, javascript, and css.  Cache-busters allow you to set Expires headers far in the future for files that don&#8217;t change often without worrying that you won&#8217;t be able to to update them should they change.</p>
<p>Expires headers are crucial since they allow the browser to use files in the cache without even asking the server if the files are still current (like it does with Last-Modified or ETag headers).  Their importance is clear with Rails enabling cache-busters by default even though Expires headers require server configuration and won&#8217;t be enabled by many users.  Rails cache-busters carry a decent performance hit since they must access the file system to get the modified date, but are still enabled by default since making setting Expires headers easier is deemed worth it.</p>
<p>But many default deployment processes will result in Last Modified dates being updated for unchanged files which means that users&#8217; browser have to reload all static assets after every deploy significantly reducing the benefit of Expires headers as well as Last-Modified and Etag headers</p>
<h2>Cause: Commands like cp, checkout, and clone Modify Dates</h2>
<p>Odds are that your deployment process copies files or uses <code>git clone</code> or <code>svn checkout</code>.  If it does, modified dates of all files will be updated.</p>
<p><code>cp</code> offers options to retain modified dates.  From everything I could find, SVN does not store modified dates in the repository and so there is no simple way of maintaining dates after you commit.  Git seems to retain modified dates and this was the reason we switched to it, hoping this would solve this problem.  While it may retain the dates, it did not solve the problem, since git clone sets new file dates.  There may be a way to configure git clone to not overwrite the modified dates, but I didn&#8217;t find it before finding another solution.</p>
<h2>Solution: Use :deploy_via, :remote_cache and set :normalize_asset_timestamps, false</h2>
<p>In Capistrano we originally used <code>:deploy_via, :checkout</code>.  With <code>:remote_cache</code>, Capistrano loads the latest version into a shared/cached-copy directory and fetches only the updates which allows the dates of unmodified files to remain on subsequent deploys.  <code>:remote_cache</code> definitely works with Git and will probably work with SVN.</p>
<p>You may still have a problem since Capistrano may set all the dates for you.  To make sure this doesn&#8217;t happen <code>set :normalize_asset_timestamps, false</code> in your deploy file.</p>
<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://blog.boxcycle.com/2011/05/keep-last-modified-dates-with-capistrano-deploy-and-svn-git/' addthis:title='Keep Last Modified Dates with Capistrano Deploy and SVN/Git '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://blog.boxcycle.com/2011/05/keep-last-modified-dates-with-capistrano-deploy-and-svn-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails Plugin Updates, SVN, and Piston 2.0.2 on Windows</title>
		<link>http://blog.boxcycle.com/2009/05/plugin-updates-svn-piston-windows-git/</link>
		<comments>http://blog.boxcycle.com/2009/05/plugin-updates-svn-piston-windows-git/#comments</comments>
		<pubDate>Sun, 10 May 2009 03:37:06 +0000</pubDate>
		<dc:creator>BoxCycle</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[piston]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.boxcycle.com/?p=89</guid>
		<description><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.boxcycle.com/2009/05/plugin-updates-svn-piston-windows-git/' addthis:title='Rails Plugin Updates, SVN, and Piston 2.0.2 on Windows '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div>I haven&#8217;t done a programming related blog entry until this one.  Why?  First, I want to keep this blog focused on BoxCycle and environmental issues.  Second, I haven&#8217;t had much time, as is evident from lack of posts on environmental issues.  Finally, I haven&#8217;t run into much that I couldn&#8217;t find an answer to with a few searches and [...]<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://blog.boxcycle.com/2009/05/plugin-updates-svn-piston-windows-git/' addthis:title='Rails Plugin Updates, SVN, and Piston 2.0.2 on Windows '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></description>
			<content:encoded><![CDATA[<div class="addthis_toolbox addthis_default_style " addthis:url='http://blog.boxcycle.com/2009/05/plugin-updates-svn-piston-windows-git/' addthis:title='Rails Plugin Updates, SVN, and Piston 2.0.2 on Windows '  ><a class="addthis_button_facebook_like" fb:like:layout="button_count"></a><a class="addthis_button_tweet"></a><a class="addthis_counter addthis_pill_style"></a></div><p>I haven&#8217;t done a programming related blog entry until this one.  Why?  First, I want to keep this blog focused on <a href="http://www.boxcycle.com">BoxCycle </a>and environmental issues.  Second, I haven&#8217;t had much time, as is evident from lack of posts on environmental issues.  Finally, I haven&#8217;t run into much that I couldn&#8217;t find an answer to with a few searches and I am not fond of duplicating effort just to get a post up.  This time I think I have something to contribute to the Ruby on Rails community.</p>
<p>The issue is updating plugins.  Initially, I simply did &#8216;plugin install&#8217; and checked them into my svn repository not thinking much of it.  My guess is, this is what most beginners to Subversion do.  In passing I saw things about svn:externals, but figured it was advanced stuff and I&#8217;d sort it out later.</p>
<p>When it came time to update some of the plugins I did &#8216;plugin install&#8217; again, and didn&#8217;t think much of it, again.  That is, until I went to checkin the project.  Subversion refused.  It took me a while to figure out what&#8217;s going on and a lot of trial and error to be able to check in the project at all.  I now know exactly how to do it:</p>
<ol>
<li>Delete the directory containing the plugin</li>
<li>Checkin changes</li>
<li>Install the new plugin</li>
<li>Checkin changes</li>
</ol>
<p>Quite annoying.  Even worse if you made changes to the plugin code.  Why is this necessary?</p>
<p>Subversion keeps state in hidden .svn directories in your local copy.  It can&#8217;t checkin directories that are missing .svn folders because it can&#8217;t figure out their state.  &#8216;plugin install&#8217; removes the directory tree when it reinstalls the plugin.  The only thing you can do is first checkin a version without the directory and then add the directory back in the next commit.  Some good links on the topic: <a href="http://railsforum.com/viewtopic.php?id=24882">http://railsforum.com/viewtopic.php?id=24882</a> and <a href="http://stackoverflow.com/questions/119006/what-should-i-do-with-the-vendor-directory-with-respect-to-subversion">http://stackoverflow.com/questions/119006/what-should-i-do-with-the-vendor-directory-with-respect-to-subversion</a> .</p>
<p>Once I figured out the issue, I understood svn:externals and found tools like Piston to make management easier.  However, by then, most of the Rails community has moved to Git version control which doesn&#8217;t work well with svn:externals or Piston.  Piston has been promising to make a Git compatible version, but for much of BoxCycle&#8217;s existence it hasn&#8217;t occurred.  Plugin updates have been a huge thorn in my side.</p>
<p>With large changes to <a href="http://guides.rubyonrails.org/2_3_release_notes.html">Rails 2.3.2</a>, most plugins needed to be updated.  I was very excited to see that <a href="http://piston.rubyforge.org/index.html">Piston 2.0.2</a> has finally been released and &#8216;gem install piston&#8217; actually installed the right version, which has not been the case for me with 1.9.x releases.  However, I did run into installation issues on Windows which took me a while to resolve.  Sharing the solution is my primary motivation for this post.</p>
<p>So keep the following in mind when you install Piston 2.0.2 on a Windows XP machine (I presume Vista is similar):</p>
<ul>
<li>After &#8216;gem install piston&#8217; type in the &#8216;piston&#8217; command.  If you get errors, read them carefully.  Dependencies don&#8217;t seem to be well defined for the Piston gem and I had to install a number of gems separately before the &#8216;piston&#8217; command displayed the usage help screen.</li>
<li>You need to have Git installed for Piston to work with Git repositories.  I installed  <a href="http://code.google.com/p/msysgit/">MSysGit</a> . </li>
<li>With Windows you are likely using <a href="http://instantrails.rubyforge.org/wiki/wiki.pl">InstantRails </a>which runs in it&#8217;s own isolated environment.  This means that Piston will not be aware that MSysGit is installed.  You need to update the InstantRails PATH to include Git.  Edit c:InstantRailsuse_ruby.cmd to have the PATH line include c:Program FilesGitcmd (or whatever your path to Git is).   Also update the use_ruby.cmd template in conf_files directory.</li>
</ul>
<p>Once I got Piston working I deleted existing plugins, hopefully for the last time, and did a checkin.  Then I used &#8216;piston import&#8217; to install new versions under Piston&#8217;s management.  I am quite relieved to not have to dread updating plugins again!</p>
<div><a class="addthis_button" href="//addthis.com/bookmark.php?v=250" addthis:url='http://blog.boxcycle.com/2009/05/plugin-updates-svn-piston-windows-git/' addthis:title='Rails Plugin Updates, SVN, and Piston 2.0.2 on Windows '><img src="//cache.addthis.com/cachefly/static/btn/v2/lg-share-en.gif" width="125" height="16" alt="Bookmark and Share" style="border:0"/></a></div>]]></content:encoded>
			<wfw:commentRss>http://blog.boxcycle.com/2009/05/plugin-updates-svn-piston-windows-git/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  blog.boxcycle.com/tag/git/feed/ ) in 0.27347 seconds, on Feb 5th, 2012 at 1:48 pm UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 8th, 2012 at 1:48 pm UTC -->
