Railsgrammer

Author Archive

Rails 3 Finally

by Matt on Jul.08, 2010, under Ruby on Rails

To setup a new rails 3 app with cucumber, no prototype and mysql database using ruby 1.9.2

This guide assumes you have ruby 1.9.2, rubygems and bundler gem installed

[msimpson@dakota ~] $ mkdir rails3
[msimpson@dakota ~] $ cd rails3
[msimpson@dakota rails3] $ git clone git://github.com/rails/rails.git rails3 .
[msimpson@dakota rails3] (master) $ ruby bin/rails new /path/to/my/new/app --dev -d mysql -J
[msimpson@dakota rails3] $ cd /path/to/my/new/app

Open and edit Gemfile so that it looks like this:

source 'http://rubygems.org'

gem 'rails', :path => '/Users/mattsimpson/Projects/_resources/Code/Rails3'
gem 'arel',  :git => 'git://github.com/rails/arel.git'
gem 'mysql'

group :cucumber do
  gem 'cucumber-rails'
  gem 'cucumber'
  gem 'factory_girl'
  gem 'webrat'
  gem 'ruby-debug19'
end

Install your gems

[msimpson@dakota rails3] $ bundle install

Install Cucumber with webrat and test unit

[msimpson@dakota rails3] $ rails generate cucumber:install --webrat --testunit

Open and edit config/database.yml and create your database by running the following:

[msimpson@dakota app] $ rake db:create:all

You are good to go!

Originally I was having troubles with rake test and rake cucumber, but after recreating my rails app this way it all worked great. Hope it works for you.

3 Comments :, , , , more...

Rails 3 Updates

by Matt on Jul.07, 2010, under Ruby on Rails

In this I will explore and solve issues I had in upgrading rails 3 to the latest rails 3 version.

Following the rails 3 update saga continues.  After taking a break to make some leaps in the design process on an application, I came back to programming the app.  After writing some cucumber tests I received a series of deprecated messages.  One thing I would like to note is that rails 3 is very good at letting you know what is going on and what you need to do.  Let’s get started:

My gemfile for cucumber looks like this:

group :cucumber do
  gem 'capybara'
  gem 'database_cleaner'
  gem 'cucumber-rails'
  gem 'cucumber'
  gem 'spork'
  gem 'launchy'    # So you can do Then show me the page
  gem 'factory_girl'
  gem 'webrat'
end

When I tried to run my cucumber test I got this message:  ”undefined method `config’ for nil:NilClass (NoMethodError)”

So I updated my gems via bundle:

[msimpson@dakota Code] $ bundle install

and I got the message:

No compatible versions could be found for required dependencies:
Conflict on: "bundler":
* bundler (0.9.25) activated by bundler (= 0.9.25, runtime)
* bundler (>= 1.0.0.beta.2, runtime) required by rails (>= 0, runtime)
All possible versions of origin requirements conflict.

so I installed the new bundler

[msimpson@dakota Code] $ sudo gem install bundler -v 1.0.0.beta.2

reran the cucumbers and got this:

    Rails 3 doesn't officially support Ruby 1.9.1 since recent stable
    releases have segfaulted the test suite. Please upgrade to Ruby 1.9.2
    before Rails 3 is released!
    You're running
      ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.3.0]

so I noticed I needed to install the new ruby 1.9.2 release candidate.  Since I use rvm I had to update rvm, remove my old ruby 1.9.2, re-install it and reinstall bundler:

[msimpson@dakota Code] $rvm update
[msimpson@dakota Code] $rvm reload
[msimpson@dakota Code] $rvm remove 1.9.2
[msimpson@dakota Code] $rvm install 1.9.2
[msimpson@dakota Code] $rvm use 1.9.2
[msimpson@dakota Code] $sudo gem install bundler -v 1.0.0.beta.2
[msimpson@dakota Code] $ bundle install

I didn't get all the way through but I'm pretty sure I got closer ;) , currently I'm working on getting cucumber to install and run. Hope this helps, if anyone gets any further let me know.

Leave a Comment :, , , , , , , more...

Rails 3 update

by Matt on May.25, 2010, under Ruby on Rails

Took me a few tweeks to get rails 3 working on my mac.  Recently I’ve made some posts to get your setup ready for Rails 3 but have just recently, with the tweeks I’m going to share here, now got rails 3 working with mysql.

I’ve had to revert from ruby 1.9.2-preview to ruby 1.9.1 p378.

[msimpson@dakota Code] (master) $ rvm install 1.9.1
[msimpson@dakota Code] (master) $ rvm use 1.9.1
Install rails 3 with the new ruby install
[msimpson@dakota Code] (master) $ sudo gem install rails --prerelease

Create a new rails app using mysql

[msimpson@dakota Code] (master) $ rails myapp --edge -d mysql

Now you will be able to create your db and start your app

[msimpson@dakota Code] (master) $ rake db:create:all
[msimpson@dakota Code] (master) $ rails server

Yay!!  Rails 3, here we go!
Leave a Comment :, , , , , , more...

Starting Rails 3 with Ruby 1.9.2

by Matt on May.22, 2010, under Ruby on Rails

First things first, if you are going to run rails 3 you may as well us ruby 1.9.x.  The problem however is that rails 3 currently does not work well with ruby 1.9.1 so you must first install and use ruby 1.9.2.
I’m installing ruby 1.9.2 using RVM, ruby version manager.  You can read up on how to use this from me earlier blog post
[msimpson@dakota Code] (master) $ rvm install 1.9.2
[msimpson@dakota Code] (master) $ rvm use 1.9.2
now if you go into irb you will see that you are using ruby 1.9.2 and you can use the new cool methods.
[msimpson@dakota Code] (master) $ irb
> RUBY_VERSION
=> "1.9.2"
> hash = { :first => "the first value", :second => "the second value" }
=> {:second=>"the second value", :first=>"the first value"}
> hash.each_with_index.collect{|array, index| "key: #{array[0]} | value: #{array[1]} | index: #{index}"}
=> ["key: second | value: the second value | index: 0", "key: first | value: the first value | index: 1"]
Install Rails 3
[msimpson@dakota Code] (master) $ sudo gem install rails --prerelease
Create a new rails 3 app strait from the rails 3 git repository so that you can always pull new updates as bugs get fixed
[msimpson@dakota Code] (master) $ rails . --edge
Obviously, you can specify the rails app name, but I was already in the directory I wanted to be in so I used .
Now you are good to go!  Have fun and report any bugs you find with Rails 3, or fork it and fix it so you can contribute.
3 Comments :, , , , more...

Linux Media Server – The Groundwork

by Matt on Apr.26, 2010, under Media

What I’m Looking For

Use

I want to have speakers and monitors / tv’s throughout my house with access control points throughout it to play all varieties of media for that particular area.  These control points will be cost effective computers with small displays to control playback for the use of that area.  These control devices could be a desktop, laptop, iPhone, iPod, iPad, tablet, etc.  My most treasured audio and video software for my clients is iTunes and for photo is iphoto.

Management

I would like to be able to easily add and retrieve files to the central media server, which would include all types of video, photo and audio files.

Accessibility

I want to access the files for their particular use on all platforms, Windows, Mac OSX, Linux, iPhone, iPad, etc.

Growth

As technology advances and as the devices I acquire grow with the advancement I want the software to support new technologies.

Firefly

Features

  • Unix or Linux, Windows (Beta), and soon to support Mac OSX
  • OGG, FLAC, Apple Lossless, WMA (Beta) and streaming radio stations
  • Configurable for web access
  • Smart playlists (Beta), iTunes Playlists
  • iTunes
  • Active community
  • Open Source, it’s free!

Accommodation

This seems to be a great fit for serving audio files to the clients and it supports iTunes.  Beta version supports all thick client platforms, I do not see support for iPhone, iPod or iPad.

Draw backs / Things to consider

From glancing at the documentation and wiki Firefly seems to be strictly command line configured.  Which would be fine because I happen to be savvy in command line but would like a gui interface to manage the configuration more easily.  However there is a web based configuration interface, once it’s installed and configured via command line.
Remnants of dropping windows support is in the forums.

Above and Beyond

Firefly can be configured to stream over the web.

MediaTomb

Features

  • Uses UPnP
  • mp3, ogg, flac, jpeg, etc. files.
  • Meta extraction
  • Thumbnail support
  • Both audio and video support
  • Automatic directory rescans
  • Plugin support
  • Web UI
  • Supports external URL’s for internet sources
  • Custom scripting capabilities
  • Support for Linux, FreeBSD, Mac OS X

Accommodation

Serves audio and video files, allows plugin support for adding new file types as technology progresses, thumbnail support would be nice, automatic directory scans would make it easy to update and manage the files, custom scripting is a nice feature (since I’m a geek).

Draw backs / Things to consider

No support for Windows, which is fine since that was a minor requirement of mine.  Has a lot of dependencies.

Above and Beyond

Custom scripting would be very useful, you can create a script to present your files as Music, Audio, Podcast, Movies, Other Videos, Photos, non-playable files such as documents or pdf’s.  You can even make a script to import a DVD.

I am looking forward to trying the two out, if you have any recommendations please throw them in the comments, I’ve decided to try these 2 out and if they do not satisfy I will look in to more options.

26 Comments :, , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Blogroll

A few highly recommended websites...