Skip to content

Re-add ruby switch #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# master
# 1.2.2
* Ruby switch is back! It has been added to the BrightBox repo (https://github.com/brightbox/deb-ruby2.1/issues/9#issuecomment-69098657)

# 1.2.1
* Fix character encoding issues in documentation (https://github.com/mojolingo/brightbox-ruby-cookbook/pull/3)
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ For more documentation on these builds, please see [the official brightbox docum
* `node['brightbox-ruby']['install_dev_package']` - Install the dev package, which provides headers for gem native extensions. Available options: `true`, `false`. Defaults to `true`.
* `node['brightbox-ruby']['gems']` - Gems to be installed by default. Defaults to `["bundler", "rake", "rubygems-bundler"]`.
* `node['brightbox-ruby']['rubygems_version']` - The version of rubygems to enforce, or nil to use the default packaged version. Defaults to `nil`.
* `node['brightbox-ruby']['install_ruby_switch']` - Wether of not to install ruby_switch. Defaults to false on recent versions of Ubuntu (>= 14.x) since ruby_switch has been deprecated. Defaults to `false`.

# Recipes

Expand Down
1 change: 0 additions & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
default['brightbox-ruby']['install_dev_package'] = true
default['brightbox-ruby']['rubygems_version'] = nil
default['brightbox-ruby']['gems'] = ["bundler", "rake", "rubygems-bundler"]
default['brightbox-ruby']['install_ruby_switch'] = node['platform_version'].to_i < 14
8 changes: 0 additions & 8 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@
recipes: ['brightbox-ruby'],
default: nil

attribute 'brightbox-ruby/install_ruby_switch',
display_name: 'Wether of not to install ruby_switch',
description: 'Wether of not to install ruby_switch. Defaults to false on recent versions of Ubuntu (>= 14.x) since ruby_switch has been deprecated.',
type: 'boolean',
required: 'optional',
recipes: ['brightbox-ruby'],
default: false

supports 'ubuntu'

depends 'apt'
9 changes: 3 additions & 6 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,16 @@
notifies :run, "execute[apt-get update]", :immediately
end

packages = ["build-essential", "ruby#{node['brightbox-ruby']['version']}"]
packages = ["build-essential", "ruby#{node['brightbox-ruby']['version']}", "ruby-switch"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [89/80]

packages << "ruby#{node['brightbox-ruby']['version']}-dev" if node['brightbox-ruby']['install_dev_package']
packages << "ruby-switch" if node['brightbox-ruby']['install_ruby_switch']
packages.each do |name|
apt_package name do
action node['brightbox-ruby']['default_action']
end
end

if node['brightbox-ruby']['install_ruby_switch']
execute "ruby-switch --set ruby#{node['brightbox-ruby']['version']}" do
not_if "ruby-switch --check | grep -q 'ruby#{node['brightbox-ruby']['version']}'"
end
execute "ruby-switch --set ruby#{node['brightbox-ruby']['version']}" do
not_if "ruby-switch --check | grep -q 'ruby#{node['brightbox-ruby']['version']}'"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]

end

cookbook_file "/etc/gemrc" do
Expand Down