Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

Commit

Permalink
feat(ruby): Added support for ruby 2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ajgon committed Feb 26, 2018
1 parent 4505890 commit 2fd887a
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 7 deletions.
2 changes: 1 addition & 1 deletion attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ruby

default['build-essential']['compile_time'] = true
default['ruby-ng']['ruby_version'] = node['ruby'].try(:[], 'version') || '2.4'
default['ruby-ng']['ruby_version'] = node['ruby'].try(:[], 'version') || '2.5'
default['nginx']['source']['modules'] = %w[
nginx::http_ssl_module nginx::http_realip_module nginx::http_gzip_static_module nginx::headers_more_module
nginx::http_stub_status_module
Expand Down
2 changes: 1 addition & 1 deletion docs/source/attributes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ convention).
- ``node['ruby-ng']['ruby_version']``

- **Type:** string
- **Default:** ``2.4``
- **Default:** ``2.5``
- Sets the Ruby version used through the system. See `ruby-ng cookbook documentation`_
for more details

Expand Down
23 changes: 23 additions & 0 deletions spec/unit/recipes/setup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,20 @@
end

it 'installs ruby 2.4' do
chef_run = ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '14.04') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.4' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run).to install_package('ruby2.4')
expect(chef_run).to install_package('ruby2.4-dev')
end

it 'installs ruby 2.5' do
expect(chef_run).to install_package('ruby2.5')
expect(chef_run).to install_package('ruby2.5-dev')
end
end

context 'rhel' do
Expand Down Expand Up @@ -140,10 +151,22 @@
end

it 'installs ruby 2.4' do
chef_run_rhel = ChefSpec::SoloRunner.new(platform: 'amazon', version: '2015.03') do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.4' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)

expect(chef_run_rhel).to install_package('ruby24')
expect(chef_run_rhel).to install_package('ruby24-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.4')
end

it 'installs ruby 2.5' do
expect(chef_run_rhel).to install_package('ruby25')
expect(chef_run_rhel).to install_package('ruby25-devel')
expect(chef_run_rhel).to run_execute('/usr/sbin/alternatives --set ruby /usr/bin/ruby2.5')
end
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.4') do
describe package('ruby2.5') do
it { should be_installed }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/default/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.4') do
describe package('ruby2.5') do
it { should be_installed }
end

Expand Down
2 changes: 1 addition & 1 deletion test/integration/nullified/serverspec/nullified_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.4') do
describe package('ruby2.5') do
it { should be_installed }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.4') do
describe package('ruby2.5') do
it { should be_installed }
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'spec_helper'

describe 'opsworks_ruby::setup' do
describe package('ruby2.4') do
describe package('ruby2.5') do
it { should be_installed }
end

Expand Down

0 comments on commit 2fd887a

Please sign in to comment.