Rails: Working around Tiger (OS X 10.4) ruby mysql problem
I was not happy when I found myself stuck try to run scaffolding for the first time, discovering that my previous attempt to fix preinstalled Tiger ruby and that after installing Xcode 2.2 I don’t have ruby.h where fixrubyconfig expects (as per the most famous fix Complete Fix for Ruby on Mac OS X 10.4 Tiger which is also mentioned in Agile Web Development with Rails
I was partly heart broken and partly frustrated and hoped that some mac and ruby ‘guru’ at the upcoming Seattle.rb Hack Night can help.
But then I had a thought and it worked.
I installed the latest stable version of ruby (1.8.3):
Download from: ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.3.tar.gz
shell> tar -zxvf ruby-1.8.3.tar.gzshell> cd ruby-1.8.3shell> ./configureshell> make -j5shell> sudo make install
This installs the new version of ruby in the /usr/local/bin directory on your powerbook
Now I added the new ruby path to my $PATH using
export PATH=/usr/local/bin:$PATH
this would mean that any time a issue a command it would look in /usr/local/bin before /usr/bin where the old (tiger default version is installed). I have also modified my .profile to have a similar PATH in future.
then I downloaded and installed rubygem again:
Download from: http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz
shell> tar -zxvf rubygems-0.8.11.tgzshell> cd rubygems-0.8.11shell> sudo ruby setup.rb
Next I installed rails gem
shell> sudo gem install rails --include-dependencies
Next I installed mysql gem
shell> sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql/
it worked for the first time now giving me a successfully installed message.
Finally I was able to do my scaffolding task as suggested by the book:
from your rails app directory do the following for the existing product table
shell> ruby script/generate scaffold Product Admin
It seems that the on Mac OS X you require a username in your database.yml file (you can’t leave it blank otherwise it would default to root) so I had to modify my configuration on last time before seeing the magical command work.
Ruby: I am stuck with OS X Tiger (10.4) Ruby problem and can’t install mysql gem
I have followed the step from http://tech.rufy.com/entry/46 but I get the following error:
mv /usr/local/lib/libreadline.a /usr/local/lib/libreadline.old/usr/bin/install -c -m 644 libreadline.a /usr/local/lib/libreadline.atest -n “ranlib” && ranlib /usr/local/lib/libreadline.amv /usr/local/lib/libhistory.a /usr/local/lib/libhistory.old/usr/bin/install -c -m 644 libhistory.a /usr/local/lib/libhistory.atest -n “ranlib” && ranlib /usr/local/lib/libhistory.atest -d shlib || mkdir shlib( cd shlib ; make all )make[1]: Nothing to be done for `all’.( cd shlib ; make DESTDIR= install )/bin/sh ../support/mkdirs /usr/local/lib/bin/sh ../support/shlib-install -O darwin8.3.0 -d /usr/local/lib -i “/usr/bin/install -c -m 644″ libhistory.5.0.dylib/bin/sh ../support/shlib-install -O darwin8.3.0 -d /usr/local/lib -i “/usr/bin/install -c -m 644″ libreadline.5.0.dylibinstall: you may need to run ldconfig % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 3542k 100 3542k 0 0 193k 0 0:00:18 0:00:18 –:–:– 233kcan’t find header files for ruby.make: *** No targets specified and no makefile found. Stop.
I don’t know what do to make MySQL working with Rails
Somebody help me. May be I will take this problem to hack night
MySQL: Display permissions on different databases
mysql> select Host, DB, User, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Alter_priv from db;
+-----------+-------------------+-------+-------------+-------------+-------------+-------------+-------------+-----------+------------+| Host | DB | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Alter_priv |+-----------+-------------------+-------+-------------+-------------+-------------+-------------+-------------+-----------+------------+| % | test | | Y | Y | Y | Y | Y | Y | Y || % | test\_% | | Y | Y | Y | Y | Y | Y | Y || localhost | depot_development | rizvi | Y | Y | Y | Y | Y | Y | Y || localhost | depot_production | rizvi | Y | Y | Y | Y | Y | Y | Y || localhost | depot_test | rizvi | Y | Y | Y | Y | Y | Y | Y || localhost | depot_production | prod | Y | Y | Y | Y | Y | Y | Y |+-----------+-------------------+-------+-------------+-------------+-------------+-------------+-------------+-----------+------------+
Vim: ERb syntax file for rails view development
Yesterday I made rhtml (embedded ruby) files kind of working by using the html filetype and I was digging the xml/html tag completion plugin. Today after only one search I ended up on the following useful page:
http://wiki.rubyonrails.com/rails/pages/HowtoUseVimWithRails
Apart from other seemingly useful tips I found the link to the eruby syntax script:
http://www.vim.org/scripts/script.php?script_id=403
I followed the directions and placed the eruby.vim file in my ~/.vim/syntax/ directory and modified the autocmd line from yesterday in my ~/.vimrc to this:
autocmd BufRead *.rhtml set filetype=eruby
Some how the xml/html plugin to complete tags as you type them still work.
I don’t see the tags breaking the html syntax highlighting and they eruby tags are now highlighted (not necessary a preference of mine but I can live with it).
Vim: xml and html auto tag completion
Downloaded the ftplugin from here:
http://tritarget.com/cgi-bin/viewcvs.cgi/xmledit/ftplugin/xml.vim (pointed to by here: http://www.vim.org/scripts/script.php?script_id=301)
copied the file to ~/.vim/ftplugin/xml.vim
at this point XML completion works (.xml files) but html does not.
once the plugin was triggered and installed witha deleteme.xml file, I followed the instruction at did this:
:help xml-plugin-html
I copy pasted the html.vim file in the help to a new file:
~/.vim/ftplugin/html.vim
and then loaded my rhtml (or any html file that autocmds to filetype html) and the plugin started working
Vim: Adding file extension to a filetype of syntax highlighting
“Add this line to syntax highlight any rhtml (rails view, ERb) to be displayed with HTML syntax highlighting
autocmd BufRead *.rhtml set filetype=html
Now I have to figure out how to load the matchit plugin that enables auto-complete for HTML tags