|
The problem:
Today I went to rubyat.com/blog and got an error message claiming
/etc/wordpress/config-xxxx.com.php could not be found. The file is either not readable by this process or does not exist. Please check if /etc/wordpress/config-xxxx.com.php exists and contains the right password/username.
Something changed so that /etc/wordpress/wp-config.php is no longer viewed as the default. The fix is to find the correct file name for the default and create a symbolic link to that default.
The solution:
cd /etc/wordpress
ls
sudo ln -s wp-config.php config-default.php
All versions of Rails prior to 3.2.11 have a serious security bug. Time to upgrade. Note that this machine has MySQL version 5, so step 7 is necessary for me. If you have MySQL version 6, copy libmysql.dll from there if it isn’t already on the path.
1. Install the latest version of Ruby (currently 1.9.3-p362)
a. Follow the instructions on rubyinstaller.org
b. I am installing to C:\ruby\193-p362. This way I don’t step on any previous version of Ruby – important to not break running programs/web sites.
c. I didn’t check any of the three boxes (Tcl/Tk support, Add Ruby executables to your PATH, or Associate .rb and .rbw files) with this Ruby installation.
d. I already have the latest version of DevKit installed to C:\ruby\DevKit-32-4.5.2. I suggest that you install DevKit on a path that does not include a specific version of Ruby.
1. cd c:\ruby\DevKit-32-4.5.2
2. ruby dk.rb init
3. edit config.yml to add or remove other Rubies
4. ruby dk.rb install
2. install or update pik (to install pik, see my February 18, 2012 entry Upgrading to Ruby 1.9.3 and Rails 3.2 on Windows)
a. pik update –no-ri –no-rdoc
3. Add this ruby to pik
a. pik add C:\ruby\193-p362\bin
4. Use this version of ruby
a. pik use ruby 1.9.3p362 (Note: The is no dash between the version and the p)
I put this in a batch file, rather than have it load automatically with cmd.
5. gem install rails –no-ri –no-rdoc
6. gem install mysql2 –no-ri –no-rdoc
7. copy version 6 of libmysql.dll to C:\ruby\193-p362\bin (same directory as this version of ruby.exe)
a. download it from the site shown on the gem install mysql2 or
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
8. rails new yourproject -d mysql
9. cd yourproject
Next, prepare to test:
1. Create your MySQL database if you haven’t already
2. Edit config/database.yaml so that database, username, and password match
3. rails s
4. http://localhost:3000
5. Click on About your application’s environment
Developing a new web site MarkMyBook.com. This web site will encourage young kids 4-13 to read, and to write about what they read. Two co-founders – Nikki Myers and Jennifer Deafenbaugh – and me, so far. Linux, Apache, Ruby/Rails, PostgreSQL. Currently hosted on Linode.
Expect to see technical issue and solutions in the weeks to come.
Pry is an alternative to irb that offers much more functionality. Pry can be invoked in the middle of a running program. This means you can use it for debugging, making developer consoles, and applying hot patches.
My Windows machine had ruby 1.9.2 and Rails 3.1. Now that ruby 1.9.3 and rails 3.2 are out, it was time to upgrade. This method isn’t the easiest, but it worked just fine for me. Note that this machine has MySQL version 5, so step 7 is necessary for me. If you have MySQL version 6, copy libmysql.dll from there if it isn’t already on the path.
1. Install the latest version of ruby (currently 1.9.3-p125)
a. Follow the instructions on rubyinstaller.org
b. I recommend you use the defaults (install to C:\ruby193)
c. make sure to also install DevKit (install to C:\ruby193\DevKit)
2. install pik
a. gem install pik
b. pik_install C:\bin (or other directory that is always on your path)
3. Add this ruby to pik
a. pik add C:\ruby193\bin
4. Use this version of ruby
a. pik use ruby 1.9.3p125 (note: there is no dash between the version and the p)
I put this in a batch file, rather than have it load automatically with cmd
5. gem install rails
6. gem install mysql2
7. copy version 6 of libmysql.dll to C:\ruby193\bin (same directory as this version of ruby.exe)
a. download it from the site shown on the gem install mysql2
8. rails new yourproject -d mysql
9. cd yourproject
10. edit database.yaml so adapter is mysql2
11. bundle install
Upgrading to ruby-1.9.2-p290 on my development machines (Windows and Linux) was a breeze. There were some extra steps needed to upgrade on the server:
1. rvm get head
2. rvm reload
After that, just:
3. rvm install ruby-1.9.2-p290
4. rvm –default 1.9.2-p290
5. rvm gemset create 3.1.1
6. rvm gemset use 3.1.1 –default
7. gem install rails –no-rdoc –no-ri
and ready to roll.
I just upgraded my Windows XP computer to use Ruby on Rails 3.1.1 with MySQL 5.1. Here’s how I did it:
0. pik is already installed via gem
1. Download rubyinstaller-1.9.2-p290.exe
2. Install ruby at c:\ruby\1.9.2-p290
3. pik add c:\ruby\1.9.2-p290\bin
4. Download DevKit-tdm-32-4.5.2-20110712-1620-sfx.exe
5. Install DevKit at c:\ruby\1.9.2-p290\DevKit
6. PATH=C:\ruby\1.9.2-p290\DevKit;%PATH%
7. pik use ruby 1.9.2p290
8. gem install json –platform=ruby
9. gem install mysql2 — ‘–with-mysql-lib=”c:\Program Files\MySQL\MySQL Server 5.1\lib\opt” –with-mysql-include=”c:\Program Files\MySQL\MySQL Server 5.1\include”‘
and now create a new rails app as usual:
rails new -d mysql
bundle install
and everything works!
My first non-trivial Rails 3.1.0 app is working less than one hour after installing the rails 3.1.0 gem. Here is what I needed to do, including the rails install:
1. rvm gemset create 3.1.0
2. rvm gemset use 3.1.0
3. gem install rails
4. cd
4. rails new
5. cd rails_app
6. edit config/database.yml (user, password and database)
7. edit config/application.rb (added one directory to path)
8. edit Gemfile (added two gems ‘execjs’ and ‘therubyracer’)
9. bundle install
10. copied over two models, one helper and one app file under /lib
11. changed program debug variable to 0
12. ran the app
Note: So far, this app has no views. It does have multiple models and a 49 year-old database that started as flat files..
Using Ruby 1.9.2, Rails 3.0.9, and rake 0.9.2
This happened to me when doing a heroku rake db:migrate. The solution:
In my Rakefile, add require ‘rake/dsl_definition’ before require ‘rake’
Hat tip to http://stackoverflow.com/questions/6181312/how-to-fix-the-uninitialized-constant-rakedsl-problem-on-heroku and Kale!
I recently received this message while running my first cucumber application on my XP development machine:
ruby.exe – Unable To Locate Component
This application has failed to start because msvcrt-ruby18.dll was not found. Re-installing the application may fix the problem.
The solution turns out to be easy. Update old gems that still use ruby 1.8. In my case:
1. gem update –system
2. gem uninstall json
3. gem install json
In my case, this updated rubygems to 1.6.2, and json from 1.4.6 to 1.5.1.
|
|