-
Notifications
You must be signed in to change notification settings - Fork 85
Addition of Ruby 2.2 and 2.3 #69
base: master
Are you sure you want to change the base?
Changes from 14 commits
225057c
fa31540
bdbf453
e1bb6b5
bb2a1c1
23aea09
c8f0cd1
b04369e
f6be370
e06bf79
22f7a09
9b5b579
0535c64
28bf578
fcb43e8
c05f04a
dd3999f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,27 +119,39 @@ | |
} | ||
default:{ | ||
case $version { | ||
/^1\.8.*$/:{ | ||
/^1\.8(\..*)*$/:{ | ||
$real_ruby_package = "${ruby::params::ruby_package}1.8" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '14.04') >= 0 { | ||
warning('Packages for Ruby 1.8 are not available from default repositories.') | ||
} | ||
} | ||
/^1\.9.*$/:{ | ||
/^1\.9(\..*)*$/:{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I'd be more inclined to change the other files to match what's currently in my PR - dev.pp is the only other place this happens. |
||
$real_ruby_package = "${ruby::params::ruby_package}1.9.1" | ||
} | ||
/^2\.0.*$/:{ | ||
/^2\.0(\..*)*$/:{ | ||
$real_ruby_package = "${ruby::params::ruby_package}2.0" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '13.10') < 0 { | ||
warning('Packages for Ruby 2.0 are not available from default repositories.') | ||
} | ||
} | ||
/^2\.1.*$/:{ | ||
/^2\.1(\..*)*$/:{ | ||
$real_ruby_package = "${ruby::params::ruby_package}2.1" | ||
if ! $suppress_warnings { | ||
warning('Packages for Ruby 2.1 are not available from default repositories.') | ||
} | ||
} | ||
/^2\.2(\..*)*$/:{ | ||
$real_ruby_package = "${ruby::params::ruby_package}2.2" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '14.10') < 0 { | ||
warning('Packages for Ruby 2.2 are not available from default repositories.') | ||
} | ||
} | ||
/^2\.3(\..*)*$/:{ | ||
$real_ruby_package = "${ruby::params::ruby_package}2.3" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '16.04') < 0 { | ||
warning('Packages for Ruby 2.3 are not available from default repositories.') | ||
} | ||
} | ||
default: { | ||
$real_ruby_package = $ruby_package | ||
} | ||
|
@@ -201,27 +213,39 @@ | |
$real_default_bin = $system_default_bin | ||
} else { | ||
case $version { | ||
/^1\.8.*$/:{ | ||
/^1\.8(\..*)*$/:{ | ||
$real_default_bin = "${ruby::params::ruby_bin_base}1.8" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '14.04') >= 0 { | ||
warning('No binary for Ruby 1.8.x available from default repositories') | ||
} | ||
} | ||
/^1\.9.*$/:{ | ||
/^1\.9(\..*)*$/:{ | ||
$real_default_bin = "${ruby::params::ruby_bin_base}1.9.1" | ||
} | ||
/^2\.0.*$/:{ | ||
/^2\.0(\..*)*$/:{ | ||
$real_default_bin = "${ruby::params::ruby_bin_base}2.0" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '13.10') < 0 { | ||
warning('No binary for Ruby 2.0.x available from default repositories') | ||
} | ||
} | ||
/^2\.1.*$/:{ | ||
/^2\.1(\..*)*$/:{ | ||
$real_default_bin = "${ruby::params::ruby_bin_base}2.1" | ||
if ! $suppress_warnings { | ||
warning('No binary for Ruby 2.1.x available from default repositories') | ||
} | ||
} | ||
/^2\.2(\..*)*$/:{ | ||
$real_default_bin = "${ruby::params::ruby_bin_base}2.2" | ||
if ! $suppress_warnings { | ||
warning('No binary for Ruby 2.2.x available from default repositories') | ||
} | ||
} | ||
/^2\.3(\..*)*$/:{ | ||
$real_default_bin = "${ruby::params::ruby_bin_base}2.3" | ||
if ! $suppress_warnings { | ||
warning('No binary for Ruby 2.3.x available from default repositories') | ||
} | ||
} | ||
default: { | ||
fail('Unable to resolve default ruby binary') | ||
} | ||
|
@@ -231,27 +255,39 @@ | |
$real_default_gem = $system_default_gem | ||
} else { | ||
case $version { | ||
/^1\.8.*$/:{ | ||
/^1\.8(\..*)*$/:{ | ||
$real_default_gem = "${ruby::params::ruby_gem_base}1.8" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '14.04') >= 0 { | ||
warning('No binary package for Ruby 1.8.x available from default repositories') | ||
} | ||
} | ||
/^1\.9.*$/:{ | ||
/^1\.9(\..*)*$/:{ | ||
$real_default_gem = "${ruby::params::ruby_gem_base}1.9.1" | ||
} | ||
/^2\.0.*$/:{ | ||
/^2\.0(\..*)*$/:{ | ||
$real_default_gem = "${ruby::params::ruby_gem_base}2.0" | ||
if ! $suppress_warnings and versioncmp($::operatingsystemrelease, '13.10') < 0 { | ||
warning('No binary package for Ruby 2.0.x available from default repositories') | ||
} | ||
} | ||
/^2\.1.*$/:{ | ||
/^2\.1(\..*)*$/:{ | ||
$real_default_gem = "${ruby::params::ruby_gem_base}2.1" | ||
if ! $suppress_warnings { | ||
warning('No binary package for Ruby 2.1.x available from default repositories') | ||
} | ||
} | ||
/^2\.2(\..*)*$/:{ | ||
$real_default_gem = "${ruby::params::ruby_gem_base}2.2" | ||
if ! $suppress_warnings { | ||
warning('No binary package for Ruby 2.2.x available from default repositories') | ||
} | ||
} | ||
/^2\.3(\..*)*$/:{ | ||
$real_default_gem = "${ruby::params::ruby_gem_base}2.3" | ||
if ! $suppress_warnings { | ||
warning('No binary package for Ruby 2.3.x available from default repositories') | ||
} | ||
} | ||
default: { | ||
fail('Unable to resolve default gem binary') | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -654,6 +654,68 @@ | |
} | ||
end | ||
|
||
describe 'with ruby 2.2 with switch' do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. spec tests are missing Ubuntu testing which is referenced in the manifest. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems Travis fails quite catastrophically on Puppet 4.x and Rubies 2.2 and 2.3. Not sure where to go from here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically you won't need to spec test against ruby 2.2 or 2.3 on Puppet 4 yet because it still uses 2.1 internally I believe. |
||
let :params do | ||
{ | ||
:version => '2.2', | ||
:switch => true | ||
} | ||
end | ||
it { | ||
should contain_package('ruby').with({ | ||
'ensure' => 'installed', | ||
'name' => 'ruby2.2' | ||
}) | ||
} | ||
it { | ||
should contain_file('ruby_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/ruby', | ||
'target' => '/usr/bin/ruby2.2', | ||
'require' => 'Package[ruby]' | ||
} ) | ||
} | ||
it { | ||
should contain_file('gem_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/gem', | ||
'target' => '/usr/bin/gem2.2', | ||
'require' => 'Package[rubygems]' | ||
} ) | ||
} | ||
end | ||
|
||
describe 'with ruby 2.3 with switch' do | ||
let :params do | ||
{ | ||
:version => '2.3', | ||
:switch => true | ||
} | ||
end | ||
it { | ||
should contain_package('ruby').with({ | ||
'ensure' => 'installed', | ||
'name' => 'ruby2.3' | ||
}) | ||
} | ||
it { | ||
should contain_file('ruby_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/ruby', | ||
'target' => '/usr/bin/ruby2.3', | ||
'require' => 'Package[ruby]' | ||
} ) | ||
} | ||
it { | ||
should contain_file('gem_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/gem', | ||
'target' => '/usr/bin/gem2.3', | ||
'require' => 'Package[rubygems]' | ||
} ) | ||
} | ||
end | ||
|
||
describe 'with ruby 1.8 with set_system_default' do | ||
let :params do | ||
{ | ||
|
@@ -1418,7 +1480,7 @@ | |
|
||
end | ||
|
||
context 'On Ubuntu 14.04LTS (Trusty Tahr' do | ||
context 'On Ubuntu 14.04LTS (Trusty Tahr)' do | ||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
|
@@ -1737,6 +1799,139 @@ | |
|
||
end | ||
|
||
context 'On Ubuntu 16.04LTS (Xenial Xerus)' do | ||
let :facts do | ||
{ | ||
:osfamily => 'Debian', | ||
:operatingsystem => 'Ubuntu', | ||
:operatingsystemrelease => '16.04' | ||
} | ||
end | ||
it { should contain_class('ruby::params') } | ||
it { | ||
should contain_package('ruby').with({ | ||
'ensure' => 'installed', | ||
'name' => 'ruby', | ||
}) | ||
} | ||
it { | ||
should contain_package('rubygems').with({ | ||
'ensure' => 'installed', | ||
'name' => 'rubygems', | ||
'require' => 'Package[ruby]', | ||
}) | ||
} | ||
it { should_not contain_package('rubygems-update') } | ||
it { should_not contain_exec('ruby::update_rubygems') } | ||
it { should_not contain_package('ruby-switch') } | ||
it { should_not contain_exec('switch_ruby') } | ||
it { should_not contain_file('ruby_bin') } | ||
it { should_not contain_file('gem_bin') } | ||
|
||
describe 'with a custom ruby package' do | ||
let :params do | ||
{ | ||
:ruby_package => 'sparkly-ruby' | ||
} | ||
end | ||
it { | ||
should contain_package('ruby').with({ | ||
'ensure' => 'installed', | ||
'name' => 'sparkly-ruby' | ||
}) | ||
} | ||
end | ||
|
||
describe 'with a custom rubygems package' do | ||
let :params do | ||
{ | ||
:rubygems_package => 'sparkly-rubygems' | ||
} | ||
end | ||
it { | ||
should contain_package('rubygems').with({ | ||
'name' => 'sparkly-rubygems', | ||
}) | ||
} | ||
end | ||
|
||
describe 'when using the latest release' do | ||
let :params do | ||
{ | ||
:latest_release => true | ||
} | ||
end | ||
it { | ||
should contain_package('ruby').with({ | ||
'ensure' => 'latest' | ||
}) | ||
} | ||
end | ||
|
||
describe 'with ruby 2.3 with switch' do | ||
let :params do | ||
{ | ||
:version => '2.3', | ||
:switch => true | ||
} | ||
end | ||
it { | ||
should contain_package('ruby').with({ | ||
'ensure' => 'installed', | ||
'name' => 'ruby2.3' | ||
}) | ||
} | ||
it { | ||
should contain_file('ruby_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/ruby', | ||
'target' => '/usr/bin/ruby2.3', | ||
'require' => 'Package[ruby]' | ||
} ) | ||
} | ||
it { | ||
should contain_file('gem_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/gem', | ||
'target' => '/usr/bin/gem2.3', | ||
'require' => 'Package[rubygems]' | ||
} ) | ||
} | ||
end | ||
|
||
describe 'with ruby 2.3 with set_system_default' do | ||
let :params do | ||
{ | ||
:version => '2.3', | ||
:set_system_default => true | ||
} | ||
end | ||
it { | ||
should contain_package('ruby').with({ | ||
'ensure' => 'installed', | ||
'name' => 'ruby2.3' | ||
}) | ||
} | ||
it { | ||
should contain_file('ruby_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/ruby', | ||
'target' => '/usr/bin/ruby2.3', | ||
'require' => 'Package[ruby]' | ||
} ) | ||
} | ||
it { | ||
should contain_file('gem_bin').with({ | ||
'ensure' => 'link', | ||
'path' => '/usr/bin/gem', | ||
'target' => '/usr/bin/gem2.3', | ||
'require' => 'Package[rubygems]' | ||
} ) | ||
} | ||
end | ||
|
||
end | ||
|
||
context 'With an Unkown operating system' do | ||
let :facts do | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class { '::ruby': | ||
version => '2.2', | ||
set_system_default => true, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class { '::ruby': | ||
version => '2.3', | ||
set_system_default => true, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we don't use those match groups somewhere else we could simply leave them out
suggested:
/^1\.8\..*$/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That implies that there will always be a '.' after the minor version. That's not always been the case afaik?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I know ruby devs are following semantic versioning which I think will always result in a version of the format $major.$minor.$patch.
But I just realized debian package names either contain two or three digits (e.g. ruby1.9.1, ruby2.1). Therefore your solution might be more logical for most users.