you know, you can just choose which gem version to activate within ruby.

require 'rubygems'
gem 'watir', '1.6.2'
require 'watir' # rubygems will only require v1.6.2.

then you can have as many versions of the watir gem installed simultaneously
as you want, and switch between them by changing, say, a yaml config file
(and doing: gem('watir', loaded_yaml_config_hash['version']). or something)

rvm's gemsets would work but are slight overkill, and rvm isn't an option on
windows. managing your entire ruby + gems in a git repo is way overkill.

On Mon, Apr 4, 2011 at 22:24, Darryl Brown <[email protected]> wrote:

> Hi,
>
> Thanks for your reply,  Yes, it is way overkill for managing gems. It
> works but it's slow when changing branches,  I'm planning to checkout
> RVM and Bundler as soon as I can.
>
> Darryl
>
> On Apr 4, 4:16 pm, Jarmo Pertman <[email protected]> wrote:
> > If you're versioning your ruby directory then it makes sense that it
> > works of course. It just seems like a pretty much overkill to do that.
> > I'd still recommend using other approaches :)
> >
> > Jarmo Pertman
> > -----
> > IT does really matter -http://www.itreallymatters.net
> >
> > On Apr 2, 5:40 pm, Darryl Brown <[email protected]> wrote:
> >
> > > Hi Jarmo,
> >
> > > Thanks for your reply.  I will simply say that it does work like that.
> > > I am using git to manage the entire ruby directory - so Ruby Gems
> > > directory is included.  I will explain it in very basic terms using
> > > three files in the example below.  Imagine that rooby = ruby.  Note
> > > that the branches are totally independent.  Also note that 'git merge'
> > > is never used.  The master branch contains readme.txt only.  The v162
> > > branch contains readme.txt and has a file - watir.txt with "I am 162"
> > > as its' contents.  The v170 branch contains readme.txt and has a file
> > > - watir.txt with "I am 170" as its' contents. Now if I checkout branch
> > > v162, there is no notion of  the latest version - "I am 170".  Please
> > > note that each "version" is installed on its' own branch.   If I had
> > > merged these branches back into master, then what you are saying would
> > > definitely be true.   So, in this manner, I never need to change my
> > > scripts to point to a specific version of Watir. I think that this
> > > behavior mimics managing gem sets with RVM.
> >
> > > C:\>mkdir rooby
> >
> > > C:\>cd rooby
> >
> > > C:\rooby>git init
> > > Initialized empty Git repository in C:/rooby/.git/
> >
> > > C:\rooby> echo This is rooby > readme.txt
> >
> > > C:\rooby>git add readme.txt
> >
> > > C:\rooby>git commit -m"add readme"
> > > [master (root-commit) 57f48df] add readme
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > >  create mode 100644 readme.txt
> >
> > > C:\rooby>git checkout -b v162
> > > Switched to a new branch 'v162'
> >
> > > C:\rooby>echo I am 162 > watir.txt
> >
> > > C:\rooby>git add watir.txt
> >
> > > C:\rooby>git commit -m"add watir 162"
> > > [v162 50fae75] add watir 162
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > >  create mode 100644 watir.txt
> >
> > > C:\rooby>git checkout master
> > > Switched to branch 'master'
> >
> > > C:\rooby>git checkout -b v170
> > > Switched to a new branch 'v170'
> >
> > > C:\rooby> echo I am 170 > watir.txt
> >
> > > C:\rooby>git add watir.txt
> >
> > > C:\rooby>git commit -m"add watir 170"
> > > [v170 e8ebd80] add watir 170
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > >  create mode 100644 watir.txt
> >
> > > C:\rooby>git checkout master
> > > Switched to branch 'master'
> >
> > > C:\rooby>git branch
> > > * master
> > >   v162
> > >   v170
> >
> > > C:\rooby>dir watir.txt
> > >  Volume in drive C has no label.
> > >  Volume Serial Number is C0EA-646B
> >
> > >  Directory of C:\rooby
> >
> > > File Not Found
> >
> > > C:\rooby>
> >
> > > C:\rooby>git checkout v162
> > > Switched to branch 'v162'
> >
> > > C:\rooby>type watir.txt
> > > I am 162
> >
> > > C:\rooby>git checkout v170
> > > Switched to branch 'v170'
> >
> > > C:\rooby>type watir.txt
> > > I am 170
> >
> > > C:\rooby>
> >
> > > Yes, I could specify the specific versions in the require statement as
> > > Dmitriy suggested and I have done it that way in the past. The end
> > > result here using git is the "appearance" of two Ruby complete
> > > installations - one with Watir V1.6.2 and one with Watir v1.7.0
> >
> > > Thanks again - I think that you did not realize that git is managing
> > > the entire ruby installation.  Please let me know if you understand
> > > now.
> >
> > > Regards,
> > > Darryl
> >
> > > On Apr 2, 7:34 am, Jarmo Pertman <[email protected]> wrote:
> >
> > > > Hi!
> >
> > > > I don't understand how your current solution works? It doesn't work
> > > > like that. As soon as you install newer version of Watir then it will
> > > > be used and it doesn't matter which branch you're with your git since
> > > > gem will be loaded from the Ruby gems directory and hasn't anything
> to
> > > > do with your git branch. So, even if you checkout older branch, then
> > > > you're still using newest Watir version.
> >
> > > > You could specify the exact version of Watir as Dmitriy already
> > > > suggested like this.
> >
> > > > Instead of:
> > > > require 'watir'
> >
> > > > use:
> > > > gem "watir", "1.6.2" # to use 1.6.2
> >
> > > > Now, if you commit that change into your branch, then you can be sure
> > > > that correct version is used.
> >
> > > > Or you could use Bundler to take care of the correct versions of your
> > > > gems:http://gembundler.com/
> >
> > > > Just don't forget to commit Gemfile and Gemfile.lock into your
> > > > repository :)
> >
> > > > Jarmo Pertman
> > > > -----
> > > > IT does really matter -http://www.itreallymatters.net
> >
> > > > On Mar 31, 5:16 am, Darryl Brown <[email protected]> wrote:
> >
> > > > > Thanks again for everyone's response but what I'm doing is
> sufficient
> > > > > for my needs.  I was curious to see how (or if) anyone else was
> doing
> > > > > this differently.  My needs are to be able to switch between Watir
> > > > > versions easily. Example: I test one of my scripts on v1.7.0 and it
> > > > > fails. I switch back to v1.6.2 and run it to see if it's still OK
> or
> > > > > if something else is going on.  I don't want to change my scripts
> > > > > (unless it is explicitly required  - i.e. different watir wait
> method,
> > > > > etc.).
> >
> > > > > Generally, this is how I set it up.
> >
> > > > > Install ruby
> > > > > git init (in c:\ruby)
> > > > > git add
> > > > > git commit
> > > > > git checkout -b v1.6.2
> > > > > gem install watir -v1.6.2
> > > > > git add
> > > > > git commit
> > > > > git checkout master
> > > > > git checkout -b v1.6.7
> > > > > gem install watir -v1.6.7
> > > > > git add
> > > > > git commit
> >
> > > > > run test.rb
> >
> > > > > Now - If test.rb fails on v1.6.7,  I can go back
> > > > > and verify that it still runs on v1.6.2 with:
> >
> > > > > git checkout v1.6.2
> >
> > > > > run test.rb
> >
> > > > > Maybe this methodology can help someone else.
> >
> > > > > This is only a temporary requirement until I get all of the scripts
> > > > > checked out on the latest stable (for my scripts) version of Watir.
> >
> > > > > --Darryl
> >
> > > > > On Mar 30, 3:02 pm, Adam Reed <[email protected]> wrote:
> >
> > > > > > I'll admit my reply was more of a response to the first comment
> than
> > > > > > the original issue, but I would agree with the explicit
> versioning
> > > > > > comment unless for some reason you wanted to uninstall your gem
> and
> > > > > > install a specific version for each test:
> >
> > > > > > gem uninstall watir
> > > > > > gem install watir -v 1.6.5
> > > > > > etc.
> >
> > > > > > On Mar 30, 1:58 pm, Dmitriy Korobskiy <[email protected]> wrote:
> >
> > > > > > > How about using Gem to specify explicit versioning, something
> along
> > > > > > > these lines:
> >
> > > > > > >http://docs.rubygems.org/read/chapter/4
> >
> > > > > > > Just a thought...
> >
> > > > > > > --
> > > > > > > DK
> > > > > > > AIM: DKroot1, Skype: DKroot
> >
> > > > > > > On 3/30/11 2:49 PM, Darryl Brown wrote:
> >
> > > > > > > > RVM is a Ruby version manager.  I'm trying to find out if
> there is a
> > > > > > > > better way to manage multiple versions of Watir. Using Git
> with a
> > > > > > > > branch for each version is working.  Are you guys suggesting
> that I
> > > > > > > > should manage multiple instances of Ruby with each one having
> a unique
> > > > > > > > version of Watir??  -or- am I missing something?
> >
> > > > > > > > Darryl
> >
> > > > > > > > On Mar 30, 2:32 pm, Adam Reed<[email protected]>  wrote:
> > > > > > > >> Also see pik for Windows (I believe it's linked from RVM's
> site as
> > > > > > > >> well):
> >
> > > > > > > >>https://github.com/vertiginous/pik/
> >
> > > > > > > >> Adam
> >
> > > > > > > >> On Mar 30, 1:23 pm, Tim Koopmans<[email protected]>
>  wrote:
> >
> > > > > > > >>> Rvm ?
> > > > > > > >>> Regards,
> > > > > > > >>> Tim
> > > > > > > >>> Sent from my mobile ...
> > > > > > > >>> On 31/03/2011, at 12:39 AM, Darryl Brown<
> [email protected]>  wrote:
> > > > > > > >>>> Hello All,
> > > > > > > >>>> We are currently using Git branches to manage multiple
> versions of
> > > > > > > >>>> Watir.  Our base scripts were all created with 1.6.2 and
> we're
> > > > > > > >>>> transitioning to the newer versions and testing along the
> way.  Start
> > > > > > > >>>> out with master branch that does that does not have Watir.
> Then from
> > > > > > > >>>> master, checkout -b   1.6.2;  then 1.6.7, 1.7.0  etc. and
> install the
> > > > > > > >>>> versions. Now we can easily switch versions. My question -
>  is there a
> > > > > > > >>>> different / better way to accomplish this?
> > > > > > > >>>> Thanks,
> > > > > > > >>>> Darryl
> > > > > > > >>>> --
> > > > > > > >>>> Before posting, please readhttp://watir.com/support. In
> short: search before you ask, be nice.
> > > > > > > >>>> [email protected]
> > > > > > > >>>>http://groups.google.com/group/watir-general
> > > > > > > >>>> [email protected]
>
> --
> Before posting, please read http://watir.com/support. In short: search
> before you ask, be nice.
>
> [email protected]
> http://groups.google.com/group/watir-general
> [email protected]
>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

[email protected]
http://groups.google.com/group/watir-general
[email protected]

Reply via email to