chruby
Switching from rbenv (and ruby-build) to chruby (and ruby-install). There isn’t a huge reason for the change other than I like their simplicity and want to try out something new!
Switching from rbenv (and ruby-build) to chruby (and ruby-install). There isn’t a huge reason for the change other than I like their simplicity and want to try out something new!
Despite some issues I do like god as a monitoring solution for my vps. I understand the config files and feel comfortable with it’s commands and logging. I don’t currently like my rvm solution for running it so this morning I converted over to using rbenv.
Today I’m giving a tiny informal talk to co-workers about ruby. You can find the source for my slides on github.
My current project involved an auth gem (internal) that provides user management into every app that it’s included into. I want this engine to be able to define some cancan rules since it determines the current_user and should allow some users to edit more than others when it comes to users, their roles, and the services they can access.
So this morning I realized how annoying it is that I need to run 3 different rails apps for work (probably will be more in the future) and have about 3 freelance projects going at any given time. I hate having to start each rails server constantly. I’ve actually written a bunch of bash code in order to make this process easier. Sick of it.
Deploying on Heroku is such a breeze! I love the way they take care of my database.yml file so I can just keep a clean version in my open source repo!
http://blog.nathanhumbert.com/2010/02/rails-3-loading-rake-tasks-from-gem.html
I think I want to create a gem that helps with minifying js and css. This link will prove useful!
Good command to help fix gem problems:
gem pristine --all
Thanks to raggi in #eventmachine on freenode!
Being unsatisfied with most erb solutions in Emacs I’ve been using nxml-mode for editing erb and just dealing with it complaining about erb sections. I love nxml-mode for xml/html in general and don’t like doing any editing without it.
I’ve tried using MMM or MoMaMu or whatever it’s called that’s included with nxhtml mode and it just doesn’t do it for me. YA-Snippet with Nxml mode is plenty for me.
Recently I found a blog post that makes sense to try out: More Valid Than You
Since I compiled Emacs custom for Mac OS X (If I haven’t blogged about that I need to!) it was easy to apply that patch to my source tree and compile it.
This at least makes Nxml-mode not hi-light every erb section as invalid. It still chokes sometimes but it’s much better. If I move to anything else I’ll blog about it :)
I finally got around to creating a ruby app template. Of course my recent ruby work is not centered around creating new apps but I’m still glad I did it. Will save my some time!
You can read more about app templates or what a great screencast about them at other places. I don’t want to just repeat what others have already said but basically I created one so far and put it up on my github account.
The one question I have is about running this on a server without the haml gem already installed. I don’t really want it to try and install the gem in my home directory so we’ll see how that works out next time I have to do it. For now on my current linode it sets up a new rails project pretty nicely for my needs.
The one other interesting aspect of my template is my config system that I just wrote. It’s only two lines and it’s heavily stealing from other blogs. I never really had a good app config system and I don’t really want to use a plugin so I quickly wrote my own. It basically supports one config file (config/config.yml) and lets you setup default settings and then override / add to the defaults with per environment settings as well. For my wow raiding site this is working pretty well.
Here is the initializer file (config/initializers/config.rb):
CONFIG = YAML.load_file("#{RAILS_ROOT}/config/config.yml") || {} CONFIG = (CONFIG['default'] || {}).symbolize_keys.merge((CONFIG[RAILS_ENV] || {}).symbolize_keys)
And my config.yml file from my raid site. This site uses a development environment (all defaults) and then two different production environments since I run the site for two different guilds. You can see how the “dota” environment inherits the auth setting while the “cod” environment adds a forum setting that I use when using phpbb authentication.
default: guild: Your Guild auth: login cod: guild: Cake or Death forum: http://forum.cakeordeath-guild.com auth: phpbb dota: guild: Daughters of the Alliance
Pretty simple and now I don’t even have to do anything to new rails projects to use it!