questions regarding Pik Config and defaults

142 views
Skip to first unread message

Chuck van der Linden

unread,
Oct 12, 2011, 11:55:16 AM10/12/11
to pik help and suggestions
Is there a way to set what version of ruby will be the 'default' for
when a CMD session is opened? I see a command to return to defaults,
but nothing to set them

I'm trying to setup a base image for some virtual machines that would
be cloned and used by multiple people, so I don't want the ruby
versions installed under my user directory, but rather someplace more
accessible to any user of the resulting vm's. I'm starting with the
XP systems first and am an administrator on the system (win7 will come
next, but it's easier to develop my process on XP )

I created a directory c:\RubyVersions as a base location for Pik to
install into, but when I try to set this I get an error. It looks
like this

C:\>md RubyInstalls

C:\>pik config installs C:\RubyInstalls

There was an error.
Error: can't dup NilClass

in: pathname.rb:205:in `dup'
in: pathname.rb:205:in `initialize'
in: pik/commands/config_command.rb:28:in `new'
in: pik/commands/config_command.rb:28:in `execute'
in: pik_runner:33

Any idea where I'm going wrong here?

Luis Lavena

unread,
Oct 12, 2011, 6:22:22 PM10/12/11
to discu...@googlegroups.com
On Wed, Oct 12, 2011 at 5:55 PM, Chuck van der Linden <sqa...@gmail.com> wrote:
> Is there a way to set what version of ruby will be the 'default' for
> when a CMD session is opened?  I see a command to return to defaults,
> but nothing to set them
>

You could do that using Command Processor AutoRun registry keys,
however, I advice against it since it could interfere with gem
installation or child process spawning:

https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-gems_fails_comspec_autorun

The other approach is that you add that version of Ruby to the
system/user path and also manage it through Pik.

So when you start a new cmd.exe, that version is available in the path
and when you do pik x.y.z it changes.

> I'm trying to setup a base image for some virtual machines that would
> be cloned and used by multiple people, so I don't want the ruby
> versions installed under my user directory, but rather someplace more
> accessible to any user of the resulting vm's.  I'm starting with the
> XP systems first and am an administrator on the system (win7 will come
> next, but it's easier to develop my process on XP )
>
> I created a directory c:\RubyVersions  as a base location for Pik to
> install into, but when I try to set this I get an error.  It looks
> like this
>
> C:\>md RubyInstalls
>
> C:\>pik config installs C:\RubyInstalls
>
> There was an error.
>  Error: can't dup NilClass
>
>  in: pathname.rb:205:in `dup'
>  in: pathname.rb:205:in `initialize'
>  in: pik/commands/config_command.rb:28:in `new'
>  in: pik/commands/config_command.rb:28:in `execute'
>  in: pik_runner:33
>
> Any idea where I'm going wrong here?
>

Problem is that is failing to read a configuration file.

Since you mention is Windows XP, "Document and Settings" folder might
be causing the issue, see other threads in this group for hints.

I recommend setting PIK_HOME environment variable to your desired directory.

Cheers,
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry

Chuck van der Linden

unread,
Oct 13, 2011, 3:41:59 PM10/13/11
to pik help and suggestions
Scrubbed things, created a PIK_HOME environment variable that points
to C:\Rubies

started up a fresh cmd session,
verified the env variable was there,
installed ruby 187 via it's installer to c:\Rubies\Ruby187
updated the gem system
installed the pik gem, did pik_install to c:\bin
restated the cmd window to pick up the new path
used PIK LIST to find the existing ruby
Did PIK INSTALL RUBY 1.9.2 and it went under my user directory in
programs&settings

Any other ideas? Am about to consider installing the ruby version
manually and seeing if PIK will just find it when I do pik list.

On Oct 12, 3:22 pm, Luis Lavena <luislav...@gmail.com> wrote:
> On Wed, Oct 12, 2011 at 5:55 PM, Chuck van der Linden <sqa...@gmail.com> wrote:
>
> > Is there a way to set what version of ruby will be the 'default' for
> > when a CMD session is opened?  I see a command to return to defaults,
> > but nothing to set them
>
> You could do that using Command Processor AutoRun registry keys,
> however, I advice against it since it could interfere with gem
> installation or child process spawning:
>
> https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#wiki-g...

Luis Lavena

unread,
Oct 13, 2011, 4:49:55 PM10/13/11
to discu...@googlegroups.com
On Thu, Oct 13, 2011 at 9:41 PM, Chuck van der Linden <sqa...@gmail.com> wrote:
> Scrubbed things, created a PIK_HOME environment variable that points
> to C:\Rubies
>
> [...]

>
> Did PIK INSTALL RUBY 1.9.2   and it went under my user directory in
> programs&settings
>
> Any other ideas?  Am about to consider installing the ruby version
> manually and seeing if PIK will just find it when I do pik list.
>

Are you using pik 0.3.0 version? You can download from GitHub:

Have you tried setting also HOME to where you told Pik is PIK_HOME?

Have you tried *not* using Pik to download the binaries but instead
download them manually and extract them in the correct directory so
later you can "pik add C:\path\to\ruby\bin" ?

Chuck van der Linden

unread,
Oct 14, 2011, 11:29:51 AM10/14/11
to pik help and suggestions
On Oct 13, 1:49 pm, Luis Lavena <luislav...@gmail.com> wrote:
> On Thu, Oct 13, 2011 at 9:41 PM, Chuck van der Linden <sqa...@gmail.com> wrote:
>
> > Scrubbed things, created a PIK_HOME environment variable that points
> > to C:\Rubies
>
> > [...]
>
> > Did PIK INSTALL RUBY 1.9.2   and it went under my user directory in
> > programs&settings
>
> > Any other ideas?  Am about to consider installing the ruby version
> > manually and seeing if PIK will just find it when I do pik list.
>
> Are you using pik 0.3.0 version? You can download from GitHub:

I'm using 0.2.8 (according to PIK --v) it's what installed when I
used "gem install pik"

is this a problem that 3.0 tries to address?

>
> Have you tried setting also HOME to where you told Pik is PIK_HOME?

No have not tried that, HOME isn't normally set as an env variable in
XP, so I guess I could add it, it is however a rather generic name, so
I wonder what other things could potentially be looking for that and
what trouble it would cause.

>
> Have you tried *not* using Pik to download the binaries but instead
> download them manually and extract them in the correct directory so
> later you can "pik add C:\path\to\ruby\bin" ?

That is in fact exactly where I'm at, and it seems to work. tiny bit
more hassle, it would be nicer if I could just use PIK to manage this
via its own install command, but this does at least provide a
workaround.

I know XP is a bit old, but it makes for smaller images, and more
importantly it's a bit easier to automate against since some of the
way some of the security stuff in vista/Win7 interacts with the newer
versions of IE (I could go into the details, but suffice to say what
makes for good security for the users, and blocks a lot of cross site
attacks, makes life difficult for the tester trying to do browser
automation). I think a lot of us are going to be using XP for stuff
for far longer than most users should.

Thanks again for your assistance with this.
Reply all
Reply to author
Forward
0 new messages