I’d like to apologise for missing a week, its been busy around the office. We’re not complaining, we just wish we had a little more time to share some links with everyone.
RVM is best known as a tool to help developers upgrade their applications to newer versions of Ruby and Rails (3 specifically). That said, for ruby developers, it has many features which help to make their workflow far simpler. Whilst some have shown with effort and rigorous manual process you can achieve much of what RVM offers, the following is a look into some less often discussed areas of RVM that make it my most favoured tool when it comes to development.
Gemsets and the Gemset Hierarchy
Whilst Bundler solves most of the problems related to isolating gems for me personally, on most projects I develop for there are things that make rvm’s implementation of gemsets (especially when used along with bundler) invaluable to me as a ruby developer.
Isolating Gems
A major strength of RVM is the ability to isolate gems at the system level. This keeps them safely partitioned from any other gems unrelated to my project. The way bundler isolates gems is for the most part at run time – It changes the way rubygems works to solve it’s problem and either installs all gems to a user specified path or to your gem directory.
If you are using the usr specified path option, you must to remember that your custom rubygems bin directory is not contained in your PATH. This means that you must either manually add it to the PATH, or your need to manually prefix each command with bundle exec, or alternatively you can generate the binaries into your applications bin directory and each command with ./bin/
If you take the opposite approach and install your gems into your gem home, you then need to be aware of the fact that each next install will overwrite any previous binaries – the canonical example being Rails 2 and Rails 3. The way that rubygems generates binaries lets you run gem-binary-name _version_ something to call the binary loaded from a specified gem version. Unfortunately, in Rails 3, the rails binary was moved from the rails gem into the railties gem which just so happens to break this feature of rubygems. You can try this for yourself on a new rvm gemset, install rails 2.3.8 and rails 3.0.0 and then try rails _2.3.8_ -v. If you are using the simple solution of installing to gem home, even though you are using bundler it will still overwrite the binary.
One common suggestion is to just create a wrapper binary manually (e.g. rails2) or always prefix your commands with bundle exec. In contrast RVM’s isolation works by explicitly setting rubygems home and path to directories isolated under RVM. RVM takes this even further using gemsets (think subdirectories) to handle more fine grain isolation. For example, I personally use 1 gemset per application, thus avoiding the issues described above as for each application I will have only a single version of rails installed. Even better, switching is shell-local and only persists for a single shell instance. This means that I can have two different applications with two completely different versions of Rails running at the same time in different terminal sessions without issue.
As an added bonus, because RVM isolates at the rubygems system level (using environment variables), your application doesn’t actually need to know or care about conflicts from gems that the application does not use.
Combining RVM and Bundler yields a great deal of flexibility and consisency. This affords you the ‘best of both worlds’, system level isolation with the ability to install gems from git repositories, and in application gem loading based on application environment.
The second feature I use often is the global gemset. Each ruby interpreter installation comes with two gemsets out of the box – the default (blank) gemset (e.g. ree-1.8.7-2010.02) and the global gemset (e.g. ree-1.8.7-2010.02@global). When you use any gemset, rvm not only sets the gem home to a uniq directory for the given gemset (ensuring gems are installed in the correct place) but it also sets GEM_PATH.
Much like PATH, GEM_PATH is a colon separated list of directories that rubygems uses to look up gems when requiring them. By installing a gem to the global gemset for any ruby, e.g. ree-1.8.7-2010.02@global, it will automatically be made available (including it’s binaries) inside both the default gemset and any user-defined gemsets. E.g.,
ree-1.8.7-2010.02
ree-1.8.7-2010.02@bighelpmob
ree-1.8.7-2010.02@tedxperth
Will all have access to gems installed in ree-1.8.7-2010.02@global.
This comes in super handy for things like awesome_print, wirble, bundler, git-up, homesick – Namely, gems you want available in every environment.
Unfortunately, bundler currently does not support multiple items in BUNDLE_PATH. We have hope it will be added in the future but for now gems you want shared between apps using bundler, you’ll get some duplication.
Default Global Gemset Contents
As an added bonus along side the global gemsets, rvm provides a way to declare a file which tells it what gems to install initially. To do this, it uses a ruby string-based directory hierarchy (see the link below) to look for a global.gems file that rvm then imports – For example, my ~/.rvm/gemsets/global.gems (that is imported into the global gemset of all ruby interpreter installs) contains the following simple list:
If you are writing gems, one of the most important things you can do as a Ruby developer these days is to ensure they work on all of the major implementations. At the moment, for most gem developers you should generally be testing your code against:
REE / 1.8.7
1.9.2
Rubinius
Jruby
And optionally, MagLev and MacRuby. RVM provides tools making it simple to run code and commands against multiple rubies. This includes but is not limited to running Rake tasks and tests / specs. The idea being to make it as frictionless as possible to test your gem against all of the above interpreters. As an example, you can run:
rvm rake test
Which will run rake test against all of your installed ruby interpreters (using default gemset for each). You may need to do some manual setup (e.g. installing test gem dependencies) but rvm tries to make it all as simple as possible and more importantly, heavily integrated into your normal work flow whilst staying out of the way.
Along side rake, rvm also provides wrappers for many common binaries (e.g. ruby, spec and the like) plus the --json and --yaml flags which make it simple to get a summarised view of the program results. Using rvm exec, you can even perform set operations against any arbitrary command.
There is a whole lot more set operations can do and I suggest anyone using or considering using rvm read the set’s section on the rvm site. Go forth and have sets!
Tools for easing dependency-related pains
One of the most commonly encountered problems (since for most people, the ruby interpreter you’d normally use is distributed as a binary install) are related to external dependencies – Namely, things like readline, iconv and openssl.
In an attempt to make life easier (and in particular, work around common problems like a neutered libedit instead of readline on OSX), rvm provides the rvm package set of commands that make it easy to install sandboxed versions of these in the ~/.rvm/usr directory.
As an example, to work around the libedit vs. readline issue on OSX, you can build your ruby against readline 6.0 by running:
And, as an added bonus, to automatically patch older versions of ree and 1.8.7 to respond to Control-C immediately (for example, in irb) instead of when you press enter, you can replace the rvm install command above with:
Say, for example, a new version of 1.9.2 comes out in the next few weeks and you want to automatically update your rubies to match it correctly. As of approximately rvm 1.0.0, we added an rvm upgrade command that automatically handles doing the following:
Installing the new ruby
Moving across gemsets
Updating wrapper scripts and aliases
The only thing you typically have to update are references in your .rvmrc’s and your passenger configuration. But, with a little forethought (e.g. creating an alias using rvm alias create), it’s entirely possible to make it so the entire upgrade is automatic.
I have personally used this feature to move from the 1.9.2 release candidate to the final patchlevel 0 release – I used rvm upgrade to simplify the process of updating each time it was bumped.
This is currently undocumented on the rvm site but documentation will be added – for the moment, in your rvm install, run rvm help upgrade and/or rvm upgrade help.
Location Matters
One of the underlying decisions related to rvm’s architecture is where it installs your rubies – In most cases, rvm will install your rubies into ~/.rvm/rubies and gems into ~/.rvm/gems. This means that you should almost never have to use sudo for commands (there are a few exceptions, most notably passenger which relies on root permission in order to bind to port 80).
This approach is simple on the scale of things but also brings a lot of freedom – for one, it means you are free to experiment with a Ruby / RVM setup, wiping it away when you’re done with a simple rm -rf ~/.rvm && mv .rvm-original .rvm.
.rvmrc files
All of this is fine and dandy, but when you still have to manually switch ruby interpreters and rubies each time you do something, it can become mildly annoying rather fast. For this exact reason RVM offers project-specific .rvmrc files – If you haven’t encountered them before, project .rvmrc’s are files that are automatically sourced into the current shell when you change (cd) into a directory containing one. These files can contain anything that is valid shell script (and to prevent RVM automatically running code you don’t want, it defaults to asking you to trust it the first time it is run) making things like project bootstrapping and configuration simple and mostly automatic after a quick setup in the project root directory:
rvm --rvmrc --create <ruby>@<gemset>
In my own projects, I use these to automatically install the Ruby if not present, create and use a project-specific gemset and then do the minimum possible required to bootstrap the new environment – in most cases, this is simply a matter of installing a few gems (e.g. for me, I install bundler via rvm gemset import).
In some cases, I even automatically run bundle install (with 1.0, if you have the gems already installed, this is very fast) hence the first time I cd into a project it essentially bootstraps the entire environment for me automatically.
Ultimately, this approach means that the Ruby interpreter and gemset switching are completely transparent to me – No matter which project I’m using, ruby and irb are available and point to the correct executable for the current project I am in. When integrated with some code I wrote for ruby summer of code, it’s even possible to have passenger automatically use this .rvmrc file to automatically change your application’s gemset at run time.
I hope that you have found at least one new or useful thing about RVM. RVM has been invaluable to me as a developer on multiple open source projects over the last several months. It makes it simple for me to do things that are otherwise harder or less flexible and generally stays out of my way.
Hello and welcome to our inaugural ‘This Week On The Web’. The series that brings you some interesting links that we’ve come across. We like to consider it as a good source of material for that lunchtime break or bedtime reading.
Now I’m going to have to come clean here, this is actually a couple of weeks worth of links. The weeks have been going so fast that I didn’t get a chance to share last weeks collection. Now, with that confession out of the way, on with some links.
This question has been asked for nearly as long as web design companies have been in existence. If you spend 5 minutes doing some research on Google, you will find the answer lies somewhere in the vicinity of FREE to upwards of $100,000.
I’m not sure this helps with making an educated decision as a consumer.
Having met over 200 small business owners in the past few weeks as part of the Achieve More Online workshops, I’ve seen first-hand some extremely bizarre website pricing and fielded many a question about what an appropriate cost might be.
The extreme
Unfortunately, I came across a business (single operator, home-based) who had shelled out over $7,000 for a basic templated web site with 4 pages (Home, About, Photo Gallery, Contact) by a Perth web design company who shall remain nameless. They had also paid for a content management system (CMS) which they had not received. The site would have taken less than a day to put together.
On the contrary, there seems to be an expectation from the SME sector that a high quality website should be somewhere in the vicinity of $2,000 or less.
The price is right?
While I don’t think there’s an easy general answer to the title of this post, here at The Frontier Group we have our own reasons on why our websites are priced the way they are.
The breakdown of a typical small business website:
Research – This is the first stage in the project, where requirements and the purpose of the website are determined. A website needs a real business reason to exist, and we need to know what that is.
The website needs to pass the what, why, how, what if? test. ie what/who the business is, why they should deal with you as opposed to a competitor, how you work, what the benefits are of using your product/service or alternatively, the downside of not using your product/service.
Content – This component is often overlooked or left until last. How can your website be effective in communicating to your customers without content? Just what content you want your website to have will determine how the site will be designed and structured. Knowing and planning for this upfront is key.
Think about the problem/s you’re actually trying to solve with a website and how that might potentially need to look, do some research on competitors who have successfully achieved a similar outcome in your industry.
Accessibility – Now we’re moving towards the design phase, so it’s time to start thinking about accessibility. We’re committed to complying with the Disability Discrimination Act 1992 when it comes to developing a website for all. This makes sure online information and services are accessible by people with disabilities. We adhere to the Web Content Accessibility Guidelines (WCAG) 2.0, which covers a wide range of recommendations for making Web content more accessible.
Most people designing their own website or using an online site builder will miss this step completely. On the other hand, there’s plenty of companies who will also leave it out, or fail to inform you about it due to price or ignorance.
Wireframing & Visual Design – At this stage in the project a designer may present wireframes of the concept ideas to develop an outline with the customer. Once a layout structure is agreed, they then develop the visual design of the website. At the completion of this stage images or “flats” are produced for each of the individual page types.
If you’re after a unique business look and feel, don’t succumb to the temptation of a templated site. While this may reduce barrier to entry, chances are, there’s a hundred other sites out there that look identical to yours.
Prototyping – We produce a prototype website for our customers allowing them to view it in a web browser. This allows them to “click around” the site and get a better representation of how different effects or transitions will appear. At this stage, cross-browser testing and necessary website code validation occurs.
Check that the site functions correctly and give it a thorough test. Select a handful of your best customers and give them the option to test it for you.
Deployment – The website is then deployed to a test server, so the customer can approve that the website has been produced to the required standard.
Hosting & CMS – Domain name, Email and Website hosting needs to be considered at this stage. Also licensing and setup of a CMS product for content management. For our customers a CMS is non-negotiable, as it enables the customer to make basic changes to their content on an on-going basis. This negates the need to contact us and pay for changes.
Watch out here for vendor lock-in. If you want to pick up your site and change hosting company or web designer, can you do so?
Other Considerations – You might think that the website is now complete, but a website needs constant revision and updating to remain relevant. Other options at this stage involve setup of specific analytical tools, search engine optimisation techniques, email marketing tools and maybe a complete online strategy.
The answer
Armed with all this information, how much would you now pay?
You should be able to make an informed decision as a consumer that you are indeed getting what you paid for. If you’ve got a specific budget in mind, you need to appreciate and understand what that will get you from a reputable company. The value of the website to your business is the single most important point to remember.
Finally, I’ve included a guide to fairly common pricing structures by companies who follow this similar process for small business websites:
$0-$3,000 – Simple templated design or inexperienced student or freelancer.
$7,000-$15,000 – Small business website with a unique business look. Reputable company/freelancer.
$20,000+ – Custom website with unique requirements. Usually requires a large amount of additional programming.
I’d love to hear about your experiences in the comments below, as a customer or web design company dealing in this area.
One of the bigger factors to consider when designing a website is whether or not to incorporate photographs into the design. You have the choice of no photography at all, utilising stock photography, or using a professional to capture photographs specifically for the website.
Certain industries and business niches really thrive with the inclusion of professional photography in a website design. Whether to convey to the customer or shareholder the true nature of the business, or to show professionalism, or perhaps to make something instantly recognisable to the website viewer.
We try to use professional photographs as much as possible where the client will allow it, as it can really bring a website to life.
An oldie but a goodie
This website for Caudo Group has been around for a few years now, but the inclusion of high quality photography (taken by one of our team members), really helps this design stand the test of time. We captured photographs of their brand new office at the time, and some of their equipment.
Supplied photography
These photographs really emphasize the nature of Helix Resources, and the industry they are involved in. These photographs were supplied by their team, but are still of a high enough quality to really bring the website to life. This website is about 18 months old now, but once again retains a fresh feel thanks to some high quality images.
When stock is best
Some websites and industries work better with stock photography. Either the service is disconnected from the place of business, or there might be no images to work with. For a professional feel that still reaches out to particular demographics, stock photography can be used to great effect. In the case of Ironmonger Financial it is used to connect with the website visitor to show them that the content they are reading is relevant to them.
As you can see, using high quality images in a design can really work wonders.
It’s certainly not the rule, however an attractive, professional website goes a long way to showing your customers the care and professionalism that you apply to the business. An integral part of how you represent yourself to clients, customers and the world at large!
A business missing out on this, or having a low quality website is positioning themselves behind the eight ball, giving their competitors an easy ride to market share.