diff --git a/attributes/ruby.rb b/attributes/ruby.rb index 57a4581..3ae9da7 100644 --- a/attributes/ruby.rb +++ b/attributes/ruby.rb @@ -3,6 +3,7 @@ default[:pkg_build][:ruby][:version] = '1.9.3' default[:pkg_build][:ruby][:patchlevel] = 'p392' default[:pkg_build][:ruby][:install_prefix] = '/usr/local' +default[:pkg_build][:ruby][:rubygems][:version] = 'latest' # or set to rubygems version default[:pkg_build][:ruby][:suffix_version] = false default[:pkg_build][:ruby][:package_dependencies] = %w( openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev diff --git a/recipes/ruby.rb b/recipes/ruby.rb index 3d00de4..a3a76f9 100644 --- a/recipes/ruby.rb +++ b/recipes/ruby.rb @@ -56,15 +56,21 @@ end.last ruby_build = PkgBuild::Ruby.ruby_build(node, install_version.first.version, install_version.last) ruby_dpkg = File.join(node[:fpm_tng][:package_dir], "#{ruby_build}.deb") + + commands = ["dpkg -i #{ruby_dpkg}; apt-get -f -q -y install", "gem install --no-ri --no-rdoc rubygems-update"] + if (node[:pkg_build][:ruby][:rubygems][:version] == 'latest') + commands << "gem update --system" + else + commands << "gem update --system #{node[:pkg_build][:ruby][:rubygems][:version]}" + end + commands << "gem install --no-ri --no-rdoc fpm" + node[:pkg_build][:isolated_containers].each do |name, opts| lxc_container "#{name}-ruby#{version.version}" do action :create clone name default_fstab false - initialize_commands [ - "dpkg -i #{ruby_dpkg}; apt-get -f -q -y install", - 'gem install --no-ri --no-rdoc fpm' - ] + initialize_commands commands end end end