Setup Commands
gem install compass nvm install 0.10.33 nvm use 0.10.33 npm install npm install -g grunt-cli npm install -g bower bower install
Test Commands
grunt test
gem install compass nvm install 0.10.33 nvm use 0.10.33 npm install npm install -g grunt-cli npm install -g bower bower install
grunt test
Notes around creating a Rails 4.1.8 application on JRuby 1.7.16.1.
Using RVM to manage my rubies.
rvm use jruby-1.7.16.1 gem install rails rails new .
Add the following to the Gemfile.
gem 'activerecord-jdbcpostgresql-adapter'
ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.16.1'
My Gemfile as it currently stands:
source 'https://rubygems.org' ruby '1.9.3', :engine => 'jruby', :engine_version => '1.7.16.1' gem 'rails', '4.1.8' gem 'activerecord-jdbcpostgresql-adapter' gem 'sass-rails', '~> 4.0.3' gem 'uglifier', '>= 1.3.0' gem 'coffee-rails', '~> 4.0.0' gem 'therubyrhino' gem 'jquery-rails' gem 'turbolinks' gem 'jbuilder', '~> 2.0' gem 'sdoc', '~> 0.4.0', group: :doc gem 'puma'
Set up your databases environments, similar to what I have here:
default: &default adapter: jdbcpostgresql encoding: unicode development: <<: *default host: localhost database: foobar_development username: postgres password: postgres test: <<: *default host: localhost database: foobar_test username: postgres password: postgres production: <<: *default host: localhost database: foobar_production username: postgres password: postgres
config.vm.network "forwarded_port", guest: 5432, host: 15432
. I'm using Vagrant 1.6.3 here. Start/restart your Vagrant image.
host all all 127.0.0.1/32 trustto
host all all 0.0.0.0/0 trust
sudo service postgresql restart
plugins: [ 'karma-jasmine', 'karma-coverage', 'karma-junit-reporter', 'karma-phantomjs-launcher', 'karma-chrome-launcher', 'karma-safari-launcher', 'karma-firefox-launcher', 'karma-ie-launcher' ],I also needed to install these node packages and save the configuration to the package.json file:
npm install karma-jasmine --save-dev npm install karma-coverage --save-dev npm install karma-junit-reporter --save-dev npm install karma-phantomjs-launcher --save-dev npm install karma-safari-launcher --save-dev npm install karma-firefox-launcher --save-dev
brew install redis
redis-server /usr/local/etc/redis.conf
redis-cli monitor
Now that we have Redis up and running, get websocket-rails integrated into your application. I won't belabor how to do that--the documentation does a good job of detailing how. I use a channel to communicate from the client-side and the server-side. Another thing to note is that for anything I do on the client that I want an event for coming from the server, I use a correlation ID from the client-side that I can keep track of on the client-side, so when an event from the server-side is received, I can determine whether I'm interested in it because it contains the original correlation ID. Read more here about the correlation ID design pattern.
heroku certs:remove
, then remove SSL support through the Dashboard.heroku labs:enable websockets
if ENV["RAILS_ENV"] == 'production' config.redis_options = { username: 'rediscloud', password: 'UHDDBHD&*#$DFkkdfha', host: 'pub-redis-88885.us-east-1-3.3.ec2.redisdomecity.com', port: '15204' } else config.redis_options = { host: 'localhost', port: '6379' } endThis will invariably change so I can differentiate between staging and production, but you get the point.