Friday, November 15, 2013

Useful Diaspora Links

Errors and solutions encountered during diapora setup.(https://joindiaspora.com/)

Ref:http://rubydoc.info/gems/mysql2/0.3.13/frames
Error :
gem install mysql2 -v '0.3.13'

Solution :
tried below sequence

gem install  libmysqlclient-dev

gem install mysql2 -v '0.3.13'


Ref :http://stackoverflow.com/questions/16376010/ubuntu-cannot-install-rmagick

Error : Ubuntu - cannot install RMagick 

gem install rmagick -v '2.13.2'

Solution : 

tried below sequence

gem install apt-get install libmagickwand-dev

and then

gem install rmagick -v '2.13.2'


=======

http://railsvoice.wordpress.com/2010/11/01/rails-3-0-mysql-problem-in-dbcreate-and-dbmigrate/

I had installed Rails 3.0 on my Ruby 1.9.2 system and was trying out a new app. I had the mysql gem already installed into my system and hence since we know by default rails creates sqlite based database.yml. Hence forth while creating the file, I had to do the following changes
$rails new testmysqlapp -d mysql
This creates a mysql based app. however by default when you open the database.yml, you will see the adapter as mysql2 instead of mysql. I just changed from mysql2 to mysql
development:
adapter: mysql (changed from mysql)
encoding: utf8
database: testmysqlapp_development
pool: 5
username: root
password: 
host: localhost
Also if you look at the GEMFILE you will see gem ‘mysql’ already available.
Now the first thing you do is run bundle installer
$cd testmysqlapp
$bundle install
This will install all the gems that you want to use.  Next step is to create the database. Lets use the standard rake method
$rake db:create (sometimes this will give errors especially i have found it in rails 3.0.1).
So alternatively i have used
$rake -r mysql db:create
Everything works fine and the database is created. this generally creates the Test and Development databases. Alternatively you can also mention the environment as
$rake -r mysql db:create ENV=development
Similarly when you want to do the migration you can call the similar code
$rake -r mysql db:migrate ENV=development

 

=======

Thursday, November 14, 2013

Setup git and rails successfully in ubuntu 13

I successfully installed all components required for github and ruby on rails  from following site
http://gorails.com/setup/ubuntu/13.10


We will be setting up a Ruby on Rails development environment on Ubuntu 13.10 Saucy Salamander.
The reason we're going to be using Ubuntu is because the majority of code you write will run on a Linux server. Ubuntu is one of the easiest Linux distributions to use with lots of documentation so it's a great one to start with.
You'll want to download the latest Desktop version here: http://releases.ubuntu.com/saucy/
Some of you may choose to develop on Ubuntu Server so that your development environment matches your production server. You can find it on the same download link above.
The first step is to install some dependencies for Ruby.
Keep in mind that we want to write code as a regular user and you should make sure to follow the rest of steps as that user and not root.
You can add a new user and then add him to the admin group like so:
sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev
Next we're going to be installing Ruby using one of three methods. Each have their own benefits, most people prefer using rbenv these days, but if you're familiar with rvm you can follow those steps as well. I've included instructions for installing from source as well, but in general, you'll want to choose either rbenv or rvm.
Choose one method. Some of these conflict with each other, so choose the one that sounds the most interesting to you, or go with my suggestion, rbenv.
The installation for rvm is pretty simple:
sudo apt-get install libgdbm-dev libncurses5-dev automake libtool bison libffi-dev
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
echo "source ~/.rvm/scripts/rvm" >> ~/.bashrc
rvm install 2.0.0-p247
rvm use 2.0.0-p247 --default
ruby -v
The last step is to tell Rubygems not to install the documentation for each package locally
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
We'll be using Git for our version control system so we're going to set it up to match our Github account. If you don't already have a Github account, make sure to register. It will come in handy for the future.
Replace my name and email address in the following steps with the ones you used for your Github account.
git config --global color.ui true
git config --global user.name "Chris Oliver"
git config --global user.email "chris@efeqdev.com"
ssh-keygen -t rsa -C "chris@efeqdev.com"
The next step is to take the newly generated SSH key and add it to your Github account. You want to copy and paste the output of the following command and paste it here.
cat ~/.ssh/id_rsa.pub
Once you've done this, you can check and see if it worked:
ssh -T git@github.com
You should get a message like this:
Hi excid3! You've successfully authenticated, but GitHub does not provide shell access.


Since Rails ships with so many dependencies these days, we're going to need to install a Javascript runtime like NodeJS. This lets you use Coffeescript and the Asset Pipeline in Rails which combines and minifies your javascript to provide a faster production environment.
To install NodeJS, we're going to add it using a PPA repository:
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
And now, without further adieu:
gem install rails
If you're using rbenv, you'll need to run the following command to make the rails executable available:
rbenv rehash
Now that you've installed Rails, you can run the rails -v command to make sure you have everything installed correctly:
rails -v
# Rails 4.0.0