Bereits zum zweiten Mal bin ich auf Probleme mit curl und Zertifiakten gestoßen: Das erste Mal trat das Problem bei rvm, dem Ruby Version Manager auf, als ich via rvm Ruby installieren wollte. rvm lädt dabei via curl den Quellcode. Dies versucht er per https. Dabei trat dann ein Fehler der Art

curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html

auf. Die Ursache ist hierfür, dass das Zertifikat der Gegenstelle nicht geprüft werden kann. Um das Problem zu lösen, muss man auf dem eigenen Rechner eine aktuelle Version der vertrauenswürdigen Zertifizierungstellen in Form der Datei curl-ca-bundle.crt hinterlegen. Wie dies zu machen ist, ist unter http://curl.haxx.se/docs/sslcerts.html beschrieben.

So lässt sich via

curl-config --ca
ermitteln, wo die Zertifikatsdatei liegt und damit aktualisiert werden muss.

Das zweite Mal stieß ich auf das Problem, als ich unter Windows die R-Erweiterung RCurl benutzen wollte, um Daten von Google Analytics zu laden. Diesmal war die Lösung nicht ganz so einfach. Auf der obigen Seite stehen zwar die verschiedenen Stellen, an die man die Datei legen kann. Es war aber nie von Erfolg gekrönt. Erst als ich die Variante mit der Umgebungsvariablen CURL_CA_BUNDLE wählte, hat curl die richtige Zertifikatsdatei benutzt.

 

Beim Anlegen eines neuen Rails Projekts muss man doch einige Schritte durchführen, die man (vor allem zu Beginn) doch noch manuell durchführt. Als kleine Gedächtnisstütze habe ich mir das selbst mal zusammengeschrieben. Als Vorlage diente das sehr gute Rails-Tutorial von Micheal Hartl.

Dieser Artikel soll mit der Zeit wachsen und meinen Bedürfnissen und Erfahrungen angepasst werden.

RVM updaten

rvm get head
rvm reload

aktuelle Ruby-Version installieren…

rvm install 1.9.2

Zur Zeit wird dann die Version 1.9.2-p180 installiert.

… und als default setzen

rvm use 1.9.2-p180 --default

gemset anlegen und als default setzen

rvm --create use 1.9.2-p180@meinprojekt
rvm use 1.9.2-p180@meinprojekt --default

aktuelle Rails Version installieren

gem install bundler rails

Rails Projekt anlegen

rails new meinprojekt -d mysql -T

-d setzt die zu verwendende Datenbank, -T schreibt keine Test::Unit Dateien. Wir wollen rspec einsetzen.

Git initialisieren

git init
git add .
git commit -a -m'initial commit'

Rspec installieren

In der Datei Gemfile folgendes ergänzen:

group :development do
 gem 'rspec-rails'
end

group :test do
 gem 'rspec'
 gem 'webrat'
end

Und dann per

bundle install

installieren.
Danach wird per

rails generate rspec:install

rspec im Projekt initialisiert.

Nun ggf. das Repository per

git add .
git commit -a -m'rspec installiert'

aktualisieren.

Autotest installieren

Im Gemfile im Bereich development

 gem 'autotest'
 gem 'autotest-rails-pure'
 gem 'autotest-fsevent'
 gem 'autotest-growl'

ergänzen und installieren. Die beiden letzten Zeilen sind nur auf Mac OS X Systemen mit installiertem Growl sinvoll.

Nun kann man in der Datei .autotest folgendes einfügen:

require 'autotest/growl'
require 'autotest/fsevent'

It seems to me that I did something yesterday that disrupted my ctrl-h function on TextMate once again. I tried several things to reestablish the correct behaviour but I had no luck.

But I learned much about TextMate and rvm/ruby.

First of all I upgraded all my bundles of TextMate. I moved the directory/Library/Application Support/TextMate/Bundles to Bundles.old and got the whole directory from subversion:

svn co http://svn.textmate.org/trunk/Bundles

Then I saw that there is no more a Ruby-Bundle. So I installed it in my user’s directory

~/Library/Application Support/TextMate/Bundles/

from github.

I even cloned the repository to fix a bug. My repro is here http://github.com/JerryWho/ruby-tmbundle

The next lesson I learned is that ctrl-h runs Support/bin/linked_ri.rb which itself runs ri. But not the version I told textmate to use. It used the default rvm-ruby-ri version. So I set the TextMate environment variable TM_RUBY_RI to ~/.rvm/bin/textmate_ri

Now the correct version of ri is run.

The cause for the main problem is that ri doesn’t support the parameter plain to the option -f anymore. So I changed it html and removed the escaping of any tags (see commit)

Once again I started coding some ruby code using TextMate. But now I installed Ruby 1.9.2 using rvm. As I did some month ago I wanted to use TextMate’s ctrl-h to show the ri info for a method or so.

So I installed the latest version of rdoc and rdoc-data. I generated the textmate wrapper as shown here. But this won’t work because running

rdoc-data –install

results in an error message:

~/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/fileutils.rb:121:in `chdir’: No such file or directory – ~/.rvm/gems/ruby-1.9.2-p0@test/gems/rdoc-data-2.5.3/data/1.9.2 (Errno::ENOENT)

And that’s correct because rdoc-data does not yet support ruby 1.9.2 as you can read here.

So I copied ~/.rvm/gems/ruby-1.9.2-p0@test/gems/rdoc-data-2.5.3/data/1.9.1 to ~/.rvm/gems/ruby-1.9.2-p0@test/gems/rdoc-data-2.5.3/data/1.9.2 hoping that the differences between 1.9.1 and 1.9.2 won’t matter.

Updating the textmate wrapper

rvm wrapper 1.9.2@mygemset textmate

and everything’s just fine.

Even after installing the current version of rdoc in a different gemset everything works just fine. Very strange because I thought the latest version of rdoc was the problem …

Using the Ruby-Bundle of TextMate let you ask the ruby built-in documentation of a command by hitting ctrl-h.

But I ran into some troubles when using rvm. I did’t get the manual for the method I asked for.

The problem seems to be the current version of rdoc as I found here. So I had to downgrade my rdoc gem from version 2.5.9 downto 2.4.3. But that sounds easier than it was for me. Every time I ran gem uninstall rdoc it wasn’t uninstalled. It stayed there. Even if I installed the older version and uninstalled version 2.5.9 rdoc –version brought up 2.5.9.

So I uninstalled my ruby using rvm uninstall 1.8.7 and removed also manually all gems connected with this ruby version in the following directories:

  • ~/.rvm/gemsets/ruby/1.8.7/
  • ~/.rvm/gems

Then I remove rdoc from the files

  • ~/.rvm/gemsets/global.gems
  • ~/.rvm/gemsets/default.gems

Installing ruby 1.8.7 again in rvm with the command rvm install 1.8.7 brought back the ruby version but without the latest rdoc. This one I could reinstall with gem install rdoc –version 2.4.3.

Now TextMate shows the correct help file.

Please see also the update.

© 2012 JerryWho Suffusion theme by Sayontan Sinha