Getting Catarse to Build and Run

I’m working on a crowd-funding website for a client out in Colorado, and we’re basing our work on Catarse, an open source Ruby on Rails crowd-funding website.  Getting a build of Catarse to actually run has not been easy, so I’m documenting the steps I’ve taken so far – there are still a couple kinks to work out, but it does come up.

Because I’m working on a Windows platform, I run Ubuntu in a VM, which does offer me the luxury of starting from a completely clean install – I was not able to get Catarse running with my other Ubuntu VM’s which already have other Ruby on Rails projects loaded in them, nor have I gotten Catarse to run natively in Windows, which is something I would very much like to succeed in doing.

Therefore, I started with a clean Unbuntu VM (see here).

Pre-Configuration

“dev” Components

sudo apt-get install git-core
sudo apt-get install curl
sudo apt-get install zlib1g-dev
sudo apt-get install libyaml-dev
sudo apt-get install libsqlite3-dev
sudo apt-get install nodejs
sudo apt-get install build-essential
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libmagickwand-dev
sudo apt-get install postgresql
sudo apt-get install libpq-dev

RVM

curl -L get.rvm.io | bash -s stable
source /home/ubuntu/.rvm/scripts/rvm

Download Catarse

git clone https://github.com/catarse/catarse
cd catarse

Configure database.yml

cd config
cp database.sample.yml database.yml
[edit the username and password]
cd ..

Download Ruby & Rails

rvm install ruby-1.9.3-p448
gem install rails -v 3.2.12

Bundle

bundle install

Install PostgreSql

sudo apt-get install pgadmin3

Create Database

sudo -u postgres psql
\password
[enter password twice]
\q

pgadmin3 -> connect -> create the database catarse_development and catarse_test

Install PostgreSql-Contrib

from: https://groups.google.com/forum/#!msg/catarse-dev/V_kly5WT4i0/kzxqwpTdgAMJ
sudo apt-get install postgresql-contrib

(the database should restart automatically,
otherwise: sudo /etc/init.d/postgresql-8.4 restart)

Catarse DB Initialization and Additional Configuration

Migration and Seeding

rake db:migrate
rake db:seed

Change the Locale

In initializers\locale.rb, change:

I18n.default_locale = :pt

to:

I18n.default_locale = :en

Other Useful Things

I use RubyMine as my development IDE, which requires a JDK.

JDK RubyMine

sudo apt-get-install openjdk-7-jre

or download from here:
http://www.oracle.com/technetwork/java/javase/downloads/index.html

and follow instructions here:
http://stackoverflow.com/questions/9862143/error-cannot-start-rubymine-no-jdk-found-jdk-version-desktop-link

Catarse Issues

Route error

https://github.com/catarse/catarse/issues/179

This is in app/views/devise/sessions/new.html.slim:

.login_with_social
.content_form
h1=t(‘.with_facebook’)
-> h3=t(‘.with_facebook_subtitle’)
-> = link_to t(‘layouts.login.login_with_facebook’), user_omniauth_authorize_path(provider: ‘facebook’, locale: nil), :class => ‘facebook_start’
h1=t(‘.google_warning_html’)
h3=t(‘.google_step_1’, link: (link_to t(‘devise.links.forgot_password’), new_password_path(resource_name))).html_safe
h3=t(‘.google_step_2’)
.clearfix

FIX:

Removed the indicated lines.

Strange tags at the top of the page:

https://github.com/catarse/catarse/issues/182

Getting some strange tags at the top of each page:

Description” name=”description” />Keywords” name=”keywords” />

I removed these lines (23 & 24) from app/views/layouts/application.html.slim:

meta name=”description” content=t(‘site.description’)
meta name=”keywords” content=t(‘site.keywords’)

uservoice_sso issue:

https://github.com/catarse/catarse/issues/183

undefined method `+’ for nil:NilClass

NoMethodError – undefined method `+’ for nil:NilClass:
ezcrypto (0.7.2) lib/ezcrypto.rb:550:in `get_key’
ezcrypto (0.7.2) lib/ezcrypto.rb:84:in `with_password’
lib/uservoice_sso.rb:13:in `generate’
app/controllers/application_controller.rb:45:in `display_uservoice_sso’

FIX (to be done):

Create a uservoice account, and see this example:

https://github.com/uservoice/uservoice-sso/blob/master/ruby.rb

and read more here:

https://www.uservoice.com/

Alternatively, do as “ianfleeton” suggested (see issue ticket):

Configuration.create(name: 'uservoice_subdomain', value: 'xyzzyexample')
Configuration.create(name: 'uservoice_sso_key', value: 'xyzzyexample')

nil in User.has_facebook_authentication?

FIX:

Add check for oauth == nil:

def has_facebook_authentication?
oauth = OauthProvider.find_by_name ‘facebook’
return false if oauth.nil? # <— added this line
authorizations.where(oauth_provider_id: oauth.id).present?
end

Alternatively, get the facebook dev ID stuff set up?

ActionController::RoutingError – No route matches {:controller=>”omniauth_callbacks”, :action=>”passthru”, :provider=>”facebook”}:

In app/views/users/_current_user_fields.html.slim line 23:

= link_to t(‘layouts.login.login_with_facebook’), user_omniauth_authorize_path(provider: ‘facebook’, locale: nil), class: ‘facebook_start’
#

FIX (sort of):

Changed above (see “nil in User.has_facebook_authentication?) to return true!!!!

Finally, Launching the Server

at the terminal:

/bin/bash –login (I have to do this, you may not need to)
rails s

The website should now come up!

— Marc