Posted by: rusteddev | October 9, 2010

How to – Install Community Engine

Hi there,

I’m testing RoR Social Web / Community frameworks and tools. I found plenty of them, to name a few :

Today I’ll explain how to install Community Engine on a basic RoR install.

There is an install doc here, but I’d like to add a few things. The automatic install script did not work for me.

Before we start : be sure to use Ruby 1.8.7 & Rails 2.4.7. For Rails required version is documented but nothing about ruby version. I spent a few hours trying to make it work with 1.9.2. I suppose it is also because of Rails 2.4.x only compatible with 1.9.1. If you have to change ruby version after gem import (meaning you didn’t listen to what I said above…), you might need to uninstall and reinstall. This was required for hpricot, sqlite3-ruby and rmagick.

Here is what I did :

  1. First create your rails app like this :
  2. rails comengtest
    
  3. Install required libraries for rMagick
  4. sudo apt-get install imagemagick
    sudo apt-get install libmagick9-dev
    
  5. Install required gems, do not use sudo (here is why). I don’t install s3 cause I don’t need this feature for my sample.
  6.  gem install desert hpricot htmlentities rmagick haml calendar_date_select ri_cal authlogic searchlogic icalendar
    
  7. Install community engine plug-in from source code using git. You should be in your app root directory :
  8. git clone --depth 1 git://github.com/bborn/communityengine.git vendor/plugins/community_engine
    

    this will download the source from github and put it in the plugin directory of your just created rails application.

    Then you can create a git submodule so that you include latest version:

    git init
    git submodule add git://github.com/bborn/communityengine.git vendor/plugins/community_engine
    git submodule init
    git submodule update
    
  9. Configure your app :
    • Remove public/index.html
    • Modify the/config/environment.rb, highlighted lines should be added   :
  10. RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION
     require File.join(File.dirname(__FILE__), 'boot')
    require 'desert'
    
     Rails::Initializer.run do |config|
       config.plugins = [:community_engine, :white_list, :all]
       config.plugin_paths += ["#{RAILS_ROOT}/vendor/plugins/community_engine/plugins"]
       config.gem 'calendar_date_select'
       config.gem 'icalendar'
       config.gem 'authlogic'
       config.gem 'searchlogic'
    config.action_controller.session = {
    :key    => '_your_app_session',
    :secret => 'secret'
    }
    # more stuff here...
    end
    # Include your application configuration below
    require "#{RAILS_ROOT}/vendor/plugins/community_engine/config/boot.rb"
    
  11. Add the following line to your config/environment.rb, test.rb, production.rb. Even if you are not planning to deploy into every environment it is important for tests. You can also put this line in environment.rb for convenience.
  12. APP_URL = "http://localhost:3000" #(or whatever your URL will be for that particular environment)
    
  13. Add the following line to your config/routes.rb :
  14. map.routes_from_plugin :community_engine
    
  15. Generate Database migration scripts like this :
  16. script/generate plugin_migration
    rake db:migrate
    
  17. Change application.rb file if you’re not using session cookies
  18. # Uncomment the :secret if you're not using the cookie session store
    protect_from_forgery # :secret => 'your_secret_string'
    
  19. Now it is time to test that everything is up and ready. Use this :
  20. rake test
    rake community_engine:test
    

    I experienced an error on test : test_should_get_ical(EventsControllerTest): NameError: Constant RiCal from ri_cal.rb not found You can correct this by adding require ‘ri_cal’ at the beginning of app/controllers/events_controller.rb More details here

  21. Start server
  22. ./script/server
    
  23. Go to http://localhost:3000, and  browse the site :

 

Your free & full featured social site up and running

 

Advertisements

Responses

  1. YAY ! well done mate ! 🙂

    I’ll have to follow this gorgeous tutorial this week, then.

    Congrats ! This was not an easy move.

  2. Hi,
    I am pretty new to Rails and I was trying to set it up and am getting the following when I type:
    rake db:migrate
    I get the following:
    (in /home/achilles/workspace/mytestapp)
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:4: warning: already initialized constant MAJOR
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:5: warning: already initialized constant MINOR
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:6: warning: already initialized constant BUILD
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:3: warning: already initialized constant NUMBERS
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/version.rb:9: warning: already initialized constant VERSION
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:26: warning: already initialized constant RAKEVERSION
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/early_time.rb:17: warning: already initialized constant EARLY
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/alt_system.rb:32: warning: already initialized constant WINDOWS
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/application.rb:28: warning: already initialized constant DEFAULT_RAKEFILES
    WARNING: Possible conflict with Rake extension: String#ext already exists
    WARNING: Possible conflict with Rake extension: String#pathmap already exists
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/task_arguments.rb:73: warning: already initialized constant EMPTY_TASK_ARGS
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/invocation_chain.rb:49: warning: already initialized constant EMPTY
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:10: warning: already initialized constant RUBY
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_utils.rb:84: warning: already initialized constant LN_SUPPORTED
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/dsl_definition.rb:143: warning: already initialized constant Commands
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:44: warning: already initialized constant ARRAY_METHODS
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:47: warning: already initialized constant MUST_DEFINE
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:51: warning: already initialized constant MUST_NOT_DEFINE
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:55: warning: already initialized constant SPECIAL_RETURN
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:61: warning: already initialized constant DELEGATING_METHODS
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:364: warning: already initialized constant DEFAULT_IGNORE_PATTERNS
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake/file_list.rb:370: warning: already initialized constant DEFAULT_IGNORE_PROCS
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:64: warning: already initialized constant FileList
    /home/achilles/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2/lib/rake.rb:65: warning: already initialized constant RakeFileUtils
    rake aborted!
    stack level too deep

    Is anybody familiar with this error?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: