Why would you want build Watir?
- You want to use the latest version of Watir under development and don't want to wait for the next release.
- You have made changes to Watir and want to distribute your own version as a gem.
Getting the Watir source code
Watir's use Git as its source code management tool, leveraging the power of Github. There are many good tutorials for Git on the web. Here are a few for Git on Windows using both a GUI and the command prompt:
- http://nathanj.github.com/gitguide/tour.html
- http://gitcasts.com/posts/git-on-windows
- http://www.slideshare.net/testrus/git-on-windows-plain-introduction
Once Git is installed, checkout the source:
- Create or go to a directory to checkout into (e.g. "C:/dev"). Git will create a 'watir' directory there.
- Open a cmd prompt and navigate to that directory and execute
git clone git://github.com/bret/watir.git
You should now see a watir directory, containing 5 directories: .git, commonwatir, doc, firewatir, and watir
Installing Development Tools
You will need to install several gems used to build Watir.
gem install hoe gem install rake gem install ci_reporter
On Windows, you will need to define your "HOME" environment variable. Go to My Computer > Properties > Advanced > Environment Variables. Under Sytem Variables, look for a variable called HOME. If you don't have one yet, created one with a value something like "C:\Documents and Settings\Administrator" (Substituting whatever Windows login you use for 'Administrator' if needed).
Building the Gems
As of Watir 1.6, Watir now consists of 3 gems: watir, commonwatir and firewatir. Users on Windows will need to build all three. Users on other platforms only need to build commonwatir and firewatir.
Inside the watir directory are five directories, including one for each of the three gems (commonwatir, firewatir, and watir). To build each gem: In your watir directory, execute
rake gems
This will create a watir/gems directory containing .gem files.
Installing the Gems
You should install them in the following order
- commonwatir
- firewatir
- watir
To install these gems, open the command shell into the watir/gems directory and execute
{{
gem install [gem-name]
}}
{{}}
See Development Builds for additional notes on installing local gems.
Listing the Gems
This command will list the gem versions on your local system, you should now have the latest development version listed.
gem list --local
You can also do a gem uninstall on previous versions if you'd like.
gem uninstall watir
and you'll get a list of versions to choose from.
Updating your Source
To keep in sync with the latest code you can now
git pull
...from your watir directory (e.g. C:\dev\watir) and then follow the gem install process again.