<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>andthennothing.net: Tag typo</title>
    <link>http://andthennothing.net/tags/typo?tag=typo</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>&amp;ldquo;first there was a three-legged monkey...&amp;rdquo;</description>
    <item>
      <title>Tag cloud</title>
      <description>&lt;p&gt;Today I finally made the first feature addition to this blog since its launch. I&amp;#8217;ve been having some instabilities with &lt;a href="http://www.eclipse.org"&gt;Eclipse&lt;/a&gt; / &lt;a href="http://rubyeclipse.sourceforge.net/"&gt;RDT&lt;/a&gt; and my &lt;a href="http://andthennothing.net/archives/2005/10/22/relocating-svk-mirrors"&gt;Subversion repository&lt;/a&gt;, and &lt;a href="http://andthennothing.net/archives/2005/10/22/rake-migrate"&gt;updated my Typo installation&lt;/a&gt; so I haven&amp;#8217;t been able to work for a while. The feature is nothing spectacular but just a &lt;a href="http://andthennothing.net/tags"&gt;tag cloud&lt;/a&gt; which I&amp;#8217;ve been wanting for a while.&lt;/p&gt;</description>
      <pubDate>Mon, 24 Oct 2005 20:54:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:94ba4f73-df91-4b3d-88e5-2d3a17d14d05</guid>
      <author>jonas.b@home.se (Jonas Bengtsson)</author>
      <link>http://andthennothing.net/archives/2005/10/24/tag-cloud</link>
      <category>metablog</category>
      <category>typo</category>
      <category>rails</category>
      <trackback:ping>http://andthennothing.net/articles/trackback/381</trackback:ping>
    </item>
    <item>
      <title>rake migrate</title>
      <description>&lt;p&gt;This is the first time I&amp;#8217;m updating my &lt;a href="http://typo.leetsoft.com/"&gt;Typo&lt;/a&gt; installation, and the update contains changes to the database schema as well to make things a little bit more interesting.&lt;/p&gt;


I start by backing up my MySQL database:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;$ mysqldump -C -u username -p --opt --lock-tables=false --skip-add-locks --skip-extended-insert database &amp;gt; dump.sql&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I fetch the dump to my laptop and bring it into my local MySQL server (using &lt;a href="http://www.sqlyog.com/"&gt;SQLyog&lt;/a&gt;, but could just as well have used MySQL directly). Updating to latest version of Typo.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk sync --all
svk update andthennothing-dev
svk smerge //typo/mirror andthennothing-dev
svk commit andthennothing-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;When I try to run Typo now it doesn&amp;#8217;t work since the database schema has changed. This is where &lt;a href="http://wiki.rubyonrails.com/rails/pages/ActiveRecordMigration"&gt;Active Record&amp;#8217;s Migrations&lt;/a&gt; come in. It should be as easy as &lt;code&gt;rake migrate&lt;/code&gt;, but it wasn&amp;#8217;t for me. Not this time. First I try it out on my laptop and since the Typo user doesn&amp;#8217;t have all permissions needed some of the migration steps don&amp;#8217;t succeed (that&amp;#8217;s at least what I think went wrong). However, after changing the permissions of the user, changing &lt;code&gt;schema_info.version&lt;/code&gt; to 18 (the version it was before I tried to migrate) and re-restoring the dumped database it works as expected.&lt;/p&gt;


	&lt;p&gt;Since I don&amp;#8217;t want the same problem on my production server I create a test database and checkout the new Typo version in a temporary directory on the server. But it failed in another way:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;$ rake migrate RAILS_ENV=test
rake aborted!
WARNING:  You have a nil object when you probably didn't expect it!  Odds are you want an instance of Array instead.

Look in the callstack to see where you're working with an object that could be nil.
Investigate your methods and make sure the object is what you expect!
./rakefile:218&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;The reason was that the &lt;code&gt;schema_info&lt;/code&gt; table somehow was empty, don&amp;#8217;t know how it happened. But adding a record with &lt;code&gt;version&lt;/code&gt; = 18, the migration works.&lt;/p&gt;


	&lt;p&gt;After some testing locally of the new version I&amp;#8217;m ready to push the new version to the production server. Merge dev to trunk locally:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk update andthennothing-trunk
svk smerge //andthennothing/branches/dev andthennothing-trunk
svk commit andthennothing-trunk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

On the server (I still have the database dump if anything should go wrong):
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;$ killall lighttpd # I think I'll manage some downtime
$ svn update
$ rake migrate RAILS_ENV=production
Trying to add whiteboard to: articles... comments... pages... done.
Renaming Articles table
Copying article data
Adding a type column
Extending Content table
Converting comments
Extending Content table
Converting trackbacks
Extending content table
Converting pages
Updating all articles
$ #restart lighttpd&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Everything seems to work just fine! The update took something like one or two minutes I think, which is quite an acceptable downtime on a personal web site. I will look into how to update without any downtime some other time since I think it&amp;#8217;s possible with &lt;a href="http://www.rubyonrails.org"&gt;Rails&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;It was a quite painless experience once I figured out how to get around the problems, and I&amp;#8217;m glad I tried it out locally first. Rails Migrations rocks! The only objection I have is why it didn&amp;#8217;t perform the migration in a transation so when it failed the first time it wouldn&amp;#8217;t have screwed up my database?&lt;/p&gt;


	&lt;p&gt;&lt;ins&gt;Update:&lt;/ins&gt; The transaction problem is &lt;a href="http://typo.leetsoft.com/trac/changeset/690"&gt;fixed by scott&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sat, 22 Oct 2005 14:19:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d91c76f6-0ca9-4519-b3c1-c1d9d5ff1f8c</guid>
      <author>jonas.b@home.se (Jonas Bengtsson)</author>
      <link>http://andthennothing.net/archives/2005/10/22/rake-migrate</link>
      <category>mysql</category>
      <category>rails</category>
      <category>typo</category>
      <category>writeup</category>
      <trackback:ping>http://andthennothing.net/articles/trackback/380</trackback:ping>
    </item>
    <item>
      <title>Routes - URLs on Rails</title>
      <description>&lt;p&gt;As I was getting ready to get this blog out the door I wanted to change the permalinks for the entries. Normally on a &lt;a href="http://typo.leetsoft.com/trac/wiki/TypoPowered"&gt;Typo powered&lt;/a&gt; blog the entries are places under &lt;tt&gt;/articles/YYYY/MM/DD/name/&lt;/tt&gt;, but I wanted to change from &lt;tt&gt;articles&lt;/tt&gt; to &lt;tt&gt;archives&lt;/tt&gt;. So I started updating &lt;tt&gt;config/routes.rb&lt;/tt&gt; and all the places where links were created (which is quite a few). I actually got a little angry that they didn&amp;#8217;t use custom helpers to generate all links, since it would be much easier to make the change in on place (putting them together with the routes would be even better, I thought, to honor &lt;acronym title="Don&amp;#8217;t Repeat Yourself"&gt;DRY&lt;/acronym&gt;).&lt;/p&gt;


	&lt;p&gt;But somehow I realised that Rails was cleverer than that. Actually, routing works both ways &amp;#8211; both for incoming requests and for &lt;span class="caps"&gt;URL&lt;/span&gt; generation. &lt;a href="http://api.rubyonrails.com/classes/ActionController/Base.html#M000170"&gt;url_for&lt;/a&gt; (which is used to create URLs for links etc.) uses the routing to create the correct URLs. So to change from &lt;tt&gt;articles&lt;/tt&gt; to &lt;tt&gt;archives&lt;/tt&gt; all that was needed was to change &lt;tt&gt;config/routes.rb&lt;/tt&gt; and everything worked. I think it&amp;#8217;s neat with separation between &lt;span class="caps"&gt;URL&lt;/span&gt; design and controller names!&lt;/p&gt;


	&lt;p&gt;Rails&amp;#8217; &amp;#8220;convention over configuration&amp;#8221; hides some of its neatness so you&amp;#8217;ll have to do some digging.&lt;/p&gt;</description>
      <pubDate>Fri, 07 Oct 2005 17:18:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:03c9481f-970f-4acd-96b2-01d2a12a4e17</guid>
      <author>jonas.b@home.se (Jonas Bengtsson)</author>
      <link>http://andthennothing.net/archives/2005/10/07/routes-urls-on-rails</link>
      <category>typo</category>
      <category>rails</category>
      <category>customization</category>
      <trackback:ping>http://andthennothing.net/articles/trackback/284</trackback:ping>
    </item>
    <item>
      <title>Handling multiple repositories with svn and svk</title>
      <description>&lt;p&gt;On a day-to-day basis I&amp;#8217;m using &lt;a href="http://www.perforce.com/"&gt;Perforce&lt;/a&gt; at work for my &lt;acronym title="Software Configuration Management"&gt;SCM&lt;/acronym&gt; needs. I&amp;#8217;ve used &lt;a href="http://www.cvshome.org"&gt;CVS&lt;/a&gt; a few times back in the days but I&amp;#8217;ve tried to forget about it :-). But as I&amp;#8217;m migrating to my new web host I have to learn how to use Subversion (svn). The main issue I saw was how to manage multiple branches and repositories.&lt;/p&gt;


	&lt;p&gt;I asked at the &lt;a href="http://typo.leetsoft.com/"&gt;Typo&lt;/a&gt; mailing list, and a similar thread appeared on the &lt;a href="http://www.rubyonrails.org/"&gt;Rails&lt;/a&gt; mailing list, and the general recommendation was to use &lt;a href="http://svk.elixus.org/"&gt;svk&lt;/a&gt; (especially &lt;a href="http://article.gmane.org/gmane.comp.lang.ruby.rails/23701"&gt;this mail&lt;/a&gt; won me over). Other reference material I used was &lt;a href="http://scottstuff.net/blog/articles/2005/07/07/distributed-development-with-svk"&gt;this&lt;/a&gt;, &lt;a href="http://svk.elixus.org/"&gt;that&lt;/a&gt;, and &lt;a href="http://svnbook.red-bean.com/"&gt;the other&lt;/a&gt;. This is a writeup of how I went about &lt;em&gt;(it might not be that easy to understand and a little more explanations are probably needed for this to be helpful, but just ask me if there is something that you don&amp;#8217;t understand)&lt;/em&gt;:&lt;/p&gt;


	&lt;p&gt;Installing svk from &lt;a href="http://svk.elixus.org/?SVKWin32"&gt;here&lt;/a&gt;.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk depotmap --init
svk mkdir //typo
svk mirror svn://leetsoft.com/typo/trunk //typo/mirror
svk sync //typo/mirror
svk co //typo/mirror typo-mirror&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Seems to work.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m a little bit worried at this stage. I&amp;#8217;d like to use the &lt;a href="http://www.eclipse.org/"&gt;Eclipse&lt;/a&gt; plugin &lt;a href="http://subclipse.tigris.org"&gt;subclipse&lt;/a&gt; when developing. Perhaps I should only use svk when migrating between different trees. Yes, I think I&amp;#8217;ll go for that, and to make it smooth I&amp;#8217;ll keep all svk checkouts (&lt;code&gt;svk co --list&lt;/code&gt;) in one directory called &lt;code&gt;svk&lt;/code&gt;. So let&amp;#8217;s relocate:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk co --relocate typo-mirror svk\typo-mirror&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I might change my mind further down the line and want to use svk exclusively, but I don&amp;#8217;t expect that to be a problem since svk appears to be quite flexible.&lt;/p&gt;


	&lt;p&gt;Time to move into svn land. I need to create a trunk and a development tree on my Textdrive repository.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svn mkdir http://urltorepository/trunk
svn mkdir http://urltorepository/branches
svn mkdir http://urltorepository/branches/dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

Time to chechout the svn branches:
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svn co http://urltorepository/trunk site-trunk
svn co http://urltorepository/branches/trunk site-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Back in svk land.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk mirror http://urltorepository //site
svk sync //site
svk co //site/branches/dev site-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Time to do a baseless merge from Typo to the dev branch:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk smerge --baseless //typo/mirror site-dev&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Since the dev branch was empty before it&amp;#8217;s safe to commit the changes without reviewing: &lt;code&gt;svk commit&lt;/code&gt;.&lt;/p&gt;


	&lt;p&gt;Time to update Typo with the changes I&amp;#8217;ve done previously. &lt;code&gt;svn update&lt;/code&gt; in my site-dev checkout. Firing up a favourite open source utility of mine: &lt;a href="http://winmerge.org/"&gt;WinMerge&lt;/a&gt;. Takes a while to merge all the files, but now I&amp;#8217;m done, just have to try out if it works alright. It seems to work fine. &lt;code&gt;svn status&lt;/code&gt;. Hmm, most of my customizations of Typo is in the views, and looking at this &lt;a href="http://typo.leetsoft.com/trac/ticket/354"&gt;ticket&lt;/a&gt; Typo is apparently supporting themed views, have to try it out&amp;#8230; Yes it works, neato! &lt;code&gt;svn add&lt;/code&gt; on all the new files and &lt;code&gt;svn commit&lt;/code&gt;.&lt;/p&gt;


Back to svk to integrate to the trunk. 
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk sync //site
svk co //site/trunk andthennothing-trunk&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

Migrating from the dev branch to trunk: 
&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;svk smerge --baseless //site/branches/dev site-trunk
svk commit&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;I think that&amp;#8217;s it and hope it will be quite easy to manage in the future. There are two main cycles I&amp;#8217;ll be performing. One is getting updates from the Typo repository, and then migrate the changes to the dev branch to the trunk. The other one is migrating changes I&amp;#8217;m doing to the dev branch to the trunk. Both of those should be quite easy to manage in svk. I think that the dev branch might be unnecessary, but I&amp;#8217;m used to working with a lot of different branches (release, import, team, personal etc.) so that&amp;#8217;s how I&amp;#8217;m feeling comfortable at the moment. But it will probably be quite easy to remove the dev branch if deemed unnecessary.&lt;/p&gt;


	&lt;p&gt;Both svn and svk are new and welcomed acquaintances. Working in the command prompt with &lt;span class="caps"&gt;SCM&lt;/span&gt; tools were nicer than I thought and remembered. Hopefully I will have the same opinion in a couple of weeks when I have a little more experience with merging and resolving conflicts (I&amp;#8217;m somewhat worried that it will be cumbersome). svn&amp;#8217;s poor support for branches and merging is my main pet peeve, but svk handled that nicely. I would go for a svk only (on the client side) if there were a Eclipse plug-in.&lt;/p&gt;


	&lt;p&gt;Nice learning experience!&lt;/p&gt;</description>
      <pubDate>Sat, 01 Oct 2005 19:46:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:3067c42b-7001-4a39-b07d-b5a8d0441256</guid>
      <author>jonas.b@home.se (Jonas Bengtsson)</author>
      <link>http://andthennothing.net/archives/2005/10/01/handling-multiple-repositories-with-svn-and-svk</link>
      <category>svn</category>
      <category>svk</category>
      <category>scm</category>
      <category>typo</category>
      <category>writeup</category>
      <trackback:ping>http://andthennothing.net/articles/trackback/2</trackback:ping>
    </item>
  </channel>
</rss>

