Posts

Showing posts from March, 2012

Error libxml2 is missing while Installing Nokogiri

Error
gem install nokogiri Installing nokogiri (1.5.0) with native extensions Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /home/user/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb checking for libxml/parser.h... no ----- libxml2 is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies. ----- *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=/home/user/.rvm/rubies/ruby-1.9.2-p290/bin/ruby --with-zlib-dir --without-zlib-dir --with-zlib-include --without-zlib-include=${zlib-dir}/include --with-zl…

Error : xcode-debugopt while installing ruby version with RVM

rvm install 1.9.3-p125Installing Ruby from source to: /home/user/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)... ruby-1.9.3-p125 - #fetching ruby-1.9.3-p125 - #extracted to /home/user/.rvm/src/ruby-1.9.3-p125 (already extracted) Applying patch 'xcode-debugopt-fix-r34840' (located at /home/user/.rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-r34840.diff) Error running 'patch -F 25 -p1 -N -f <"/home/user/.rvm/patches/ruby/1.9.3/p125/xcode-debugopt-fix-r34840.diff"', please read /home/user/.rvm/log/ruby-1.9.3-p125/patch.apply.xcode-debugopt-fix-r34840.log rvm requires autoreconf to install the selected ruby interpreter however autoreconf was not found in the PATH. 
Solution

sudo apt-get install automake

Gemfile Options

You can do any of the following in the Gemfile:
gem "name", "version": version may be a strict version or a version requirement like &gt;= 1.0.6. The version is optional.
gem "name", "version", :require_as =&gt; "file": the require_as allows you to specify which file should be required when the require_env is called. By default, it is the gem’s name
gem "name", "version", :only =&gt; :testing: The environment name can be anything. It is used later in your require_env call. You may specify either :only, or :except constraints
gem "name", "version", :git =&gt; "git://github.com/wycats/thor": Specify a git repository to be used to satisfy the dependency. You must use a hard dependency (“1.0.6″) rather than a soft dependency (“>= 1.0.6″). If a .gemspec is found in the repository, it is used for further dependency lookup. If the repository has multiple .gemspecs, each dir…

Error Installing Mysql Gem on Mac Snow Leopard

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/abc/.rvm/rubies/ruby-1.9.2-p318/bin/ruby extconf.rb checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lz... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lsocket... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lnsl... no checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... no checking for mysql_query() in -lmysqlclient... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --…

Everything you need to know about Migrations

Methods: create_table(name, options) drop_table(name) rename_table(old_name, new_name) add_column(table_name, column_name, type, options) rename_column(table_name, column_name, new_column_name) change_column(table_name, column_name, type, options) remove_column(table_name, column_name) add_index(table_name, column_name, index_type) remove_index(table_name, column_name) change_table(table_name) {|Table.new(table_name, self)| ...} change_column_default(table_name, column_name, default) change_column_null(table_name, column_name, null, default = nil) Available Column Types (mappings are below): * integer * float * datetime * date * timestamp * time * text * string * binary * boolean * decimal :precision, :scale Valid Column Options: * limit * null (i.e. ":null => false" implies NOT NULL) * default (to specify default values) * :decimal, :precision => 8, :…

Install Ruby on Rails on Ubuntu

First we need to make sure that the system which we are using is up to date , so for that run the command below
sudo apt-get update

We'll be installing some software that needs to be built so we'll need to get packages required for compiling. With Ubuntu, you can type this single command and get everything you need:

sudo apt-get install build-essentialOnce you've got the tools, it's time to install MySQL and Ruby

sudo apt-get install ruby ri rdoc mysql-server libmysql-ruby ruby1.8-dev irb1.8 libmysql-ruby1.8 libreadline-ruby1.8 libruby1.8 mysql-client-5.1 mysql-common mysql-server-5.1 rdoc1.8 ri1.8 ruby1.8 irb libopenssl-ruby libopenssl-ruby1.8 mysql-server-core-5.1 libmysqlclient16 libreadline5 psmisc
If you hadn't previously installed MySQL you'll be asked to set a root password. You don't have to, of course (it will bug you no fewer than 3 times if you opt not to) but I strongly recommend it. You'll need this password when you populate your rails conf…