Re: How can I programmatically (in the Vagrantfile) ensure that dependent gems are installed? - Was: Chef Solo + URL to Cheffile

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: How can I programmatically (in the Vagrantfile) ensure that dependent gems are installed? - Was: Chef Solo + URL to Cheffile

Anentropic
I get:

Message: deadlock; recursive locking

...when I try to do this under Vagrant 1.2
Did anyone get this working?

it's this line that seems to cause it:
env = Vagrant::Environment.new

The code is a bit different to the old `vagrant gem` command
https://github.com/mitchellh/vagrant/blob/v1.0.7/lib/vagrant/command/gem.rb



On Saturday, 26 May 2012 06:30:29 UTC+1, lukewpatterson wrote:
On Friday, May 25, 2012 7:13:08 PM UTC-5, lukewpatterson wrote:
Considering the Vagrantfile approach first - In the beginning portion of the Vagrantfile, how can I programmatically install gems that later portions of the file will 'require'?  Does anyone have any examples of this?  I've tried a few hacks but it seems like things might be complicated by the private Ruby configuration that Vagrant uses.

for installing librarian gem in the Vagrantfile, for later use in the Vagrantfile, got this hack to work:

librarian_name = 'librarian'
librarian_version = '0.0.23'
begin
  Gem::Specification.find_by_name(librarian_name, librarian_version)
rescue Gem::LoadError
  begin
    require 'vagrant/environment'
    env = Vagrant::Environment.new
    env.cli('gem', 'install', librarian_name, '--version', librarian_version)
  rescue SystemExit
  end
end

not sure how advisable it is, I guess I'll find out

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: How can I programmatically (in the Vagrantfile) ensure that dependent gems are installed? - Was: Chef Solo + URL to Cheffile

Anentropic
plugin to re-instate the `vagrant gem` command from v1.0.7
https://github.com/anentropic/vagrant-gem

On Tuesday, 23 April 2013 19:49:18 UTC+1, Anentropic wrote:
I get:

Message: deadlock; recursive locking

...when I try to do this under Vagrant 1.2
Did anyone get this working?

it's this line that seems to cause it:
env = Vagrant::Environment.new

The code is a bit different to the old `vagrant gem` command



On Saturday, 26 May 2012 06:30:29 UTC+1, lukewpatterson wrote:
On Friday, May 25, 2012 7:13:08 PM UTC-5, lukewpatterson wrote:
Considering the Vagrantfile approach first - In the beginning portion of the Vagrantfile, how can I programmatically install gems that later portions of the file will 'require'?  Does anyone have any examples of this?  I've tried a few hacks but it seems like things might be complicated by the private Ruby configuration that Vagrant uses.

for installing librarian gem in the Vagrantfile, for later use in the Vagrantfile, got this hack to work:

librarian_name = 'librarian'
librarian_version = '0.0.23'
begin
  Gem::Specification.find_by_name(librarian_name, librarian_version)
rescue Gem::LoadError
  begin
    require 'vagrant/environment'
    env = Vagrant::Environment.new
    env.cli('gem', 'install', librarian_name, '--version', librarian_version)
  rescue SystemExit
  end
end

not sure how advisable it is, I guess I'll find out

--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.