Intertwingly on Rails
Views: index, post, comments, archives
This clearly is just modest beginnings. A snapshot of existing data. Read-only views at this point. No caching.
Technology is Rails 2.0.2 on SQLite3 using Phusion Passenger on Dreamhost.
Installation would have been a simple scp except for two issues: despite what it says in this list, the sqlite3-ruby gem does not appear to be installed. And the current date on the machine appears to be Feb 15, 3155.
For the model part, I can’t quite bear to break with the idea of flat files yet, so the model consists of two tables: posts and comments, and each contain dates and file name parts only. The remainder of the model is populated using an after_find hook from the flat files.
With my current Intertwingly, I had three views that had diverged over time, as well as a “partial” which contained the navigation bar. The front page (and comments page) are clean XHTML5, individual posts are XHTML1, and the archives are based a layout that I used back when I was on Radio Userland. In the Rails implementation, I have four views and a layout (index and comments becoming separate views). Having a common layout encourages consistency, and you can see the difference in the archive view already. More work needs to be done on the individual posts view.
The controller methods are positively pedestrian at this point. They simply obtain the necessary information from the model, and then proceed to render the associated view.
This is but a modest beginning... allowing people to enter new comments, openid, implementing spam avoidance measures, automated extraction of excerpts, ... the list goes on and on. But first, I plan to put this code under version control (probably git), and implement a test suite.
The date/time issue appears to be resolved.
A more accurate list of gems would appear to be:
actionmailer-1.3.6 activerecord-2.0.2 rails-1.2.6 actionmailer-2.0.2 activeresource-2.0.2 rails-2.0.2 actionpack-1.13.6 activesupport-1.4.4 rake-0.8.1 actionpack-2.0.2 activesupport-2.0.2 rmagick-1.15.14 actionwebservice-1.2.3 fastthread-1.0.1 rspec-1.1.3 actionwebservice-1.2.6 mysql-2.6 activerecord-1.15.6 mysql-2.7
However, it is straightforward to create your own gem directory, by putting the following into .bash_profile:
export GEM_HOME="$HOME/.gems" export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8" export PATH="$HOME/.gems/bin:$PATH"
And the following in your application’s config/environment.rb:
config.load_paths += Dir["#{ENV['HOME']}/.gems/gems/*/lib"]
Posted by Sam Ruby
at
Any interest in putting the code in git, on say... github? I’d be curious to see the inner workings.
Posted by Bob Aman at
Any interest in putting the code in git
I take it that you didn’t read my post down to the bottom. :-P
Posted by Sam Ruby atReading a blog sometimes is like archeology, trying to piece together intentions from artifacts left behind. Just curious what (if anything) prompted your recent surge of interest in all things Ruby (other than the book of course), and where do you see it going? Are you working toward something?
Posted by Justin Watt at
other than the book of course
Isn’t that kinda like “Apart from that Mrs Lincoln, how did you enjoy the play?” :-)
I continue to be interested in a wide range of topics, more so than there are hours in the day. A book deal is an excellent tie breaker in such situations. :-)
That being said, there is something about Ruby that I don’t see blogged about much that very much impresses me: namely rubyspec. In times when the JCP and ECMA are beleaguered, to see a very tangibe and concrete realization of “cooperate on standards, compete on implementations” and “write once, run everywhere” emerge, complete with the full cooperation of Microsoft and Sun and efforts like MagLev and Rubinious and MRI... that tells me that Ruby has legs.
Posted by Sam Ruby atI take it that you didn’t read my post down to the bottom. :-P
Oh, but I did. Hence the ellipsis to indicate that I was hoping you might consider an additional push location.
It’s as simple as adding an additional remote!
git remote add github git@github.com:sruby/intertwingly.git git push github
Or maybe even consider having github as the primary, in which case, s/github/origin/.
Posted by Bob Aman atOk, rereading what I wrote before, that wasn’t even remotely clear. But yes, I did actually RTFA.
Posted by Bob Aman at
ADWR depot app w/Passenger? posted by Sam Ruby @ Sun, 29 Jun 2008 00:34:26 -0000
I installed the sqlite3-ruby-1.2.2 gem and added it to my environment...Excerpt from Recent Posts in 'ADWR depot app w/Passenger?' | Pragmatic Forums at
Note: *.dreamhosters.com sites are created by customers. It’s the Dreamhost way to get on the internet without registering a domain. So I’m not sure I’d take a “rails.dreamhosters.com” site too seriously.
I’m a DH customer myself. Some nosing around with ssh revealed the following:
$ apt-cache search sqlite | grep ruby | grep gem
libsqlite3-ruby-rubygem - <insert up to 60 chars description>
$ dpkg-query -s libsqlite3-ruby-rubygem
Package: libsqlite3-ruby-rubygem
Status: install ok installed
Priority: optional
Section: unknown
Installed-Size: 3708
Maintainer: Terri Irving <terri@hightower.dreamhost.com>
Architecture: i386
Version: 1.0-2
Replaces: ndn-rubygems (<= 1.16-1)
Depends: libc6 (>= 2.3.2.ds1-21), libruby1.8 (>= 1.8.5), libsqlite3-0 (>= 3.2.1)
Description: <insert up to 60 chars description>
<insert long description, indented with spaces>
Looks like DH has packaged their own “libsqlite3-ruby-rubygem.” Not sure what it does or where it goes...
Posted by Julius Davies at