Skip to content

Commit

Permalink
Merge pull request #398 from sous-chefs/ruby
Browse files Browse the repository at this point in the history
Small improvements to the ruby recipe
  • Loading branch information
tas50 committed Jan 3, 2017
2 parents 4d5ea74 + 82ecb2e commit 357b0f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 33 deletions.
12 changes: 4 additions & 8 deletions .kitchen.yml
Expand Up @@ -29,7 +29,7 @@ suites:
- name: apt-pgdg-client
run_list:
- recipe[test::apt-pgdg-client]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.2", "opensuse-leap-42.1", "fedora-24" ]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.2", "opensuse-leap-42.1", "fedora-25" ]

- name: yum-pgdg-client
run_list:
Expand All @@ -42,7 +42,6 @@ suites:

- name: server
run_list:
- recipe[apt]
- recipe[postgresql::ruby]
- recipe[postgresql::server]
attributes:
Expand All @@ -52,10 +51,9 @@ suites:

- name: apt-pgdg-server
run_list:
- recipe[apt]
- recipe[postgresql::ruby]
- recipe[postgresql::server]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.2", "opensuse-leap-42.1", "fedora-23", "fedora-24" ]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.2", "opensuse-leap-42.1", "fedora-23", "fedora-25" ]
attributes:
postgresql:
enable_pgdg_apt: true
Expand Down Expand Up @@ -92,10 +90,9 @@ suites:

- name: apt-pgdg-client-ruby
run_list:
- recipe[apt]
- recipe[postgresql]
- recipe[postgresql::ruby]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.2", "opensuse-leap-42.1", "fedora-23", "fedora-24" ]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.2", "opensuse-leap-42.1", "fedora-23", "fedora-25" ]
attributes:
postgresql:
enable_pgdg_apt: true
Expand All @@ -117,10 +114,9 @@ suites:

- name: apt-pgdg-server-pg_stat_statements
run_list:
- recipe[apt]
- recipe[postgresql::ruby]
- recipe[postgresql::contrib]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.1", "opensuse-13.2", "fedora-23", "fedora-24" ]
excludes: [ "centos-6.8", "centos-7.2", "opensuse-13.1", "opensuse-13.2", "fedora-23", "fedora-25" ]
attributes:
postgresql:
enable_pgdg_apt: true
Expand Down
38 changes: 13 additions & 25 deletions recipes/ruby.rb
Expand Up @@ -21,60 +21,48 @@
begin
require 'pg'
rescue LoadError

if platform_family?('ubuntu', 'debian')
e = execute 'apt-get update' do
if platform_family?('debian')
e = apt_update 'update' do
action :nothing
end
e.run_action(:run) unless ::File.exist?('/var/lib/apt/periodic/update-success-stamp')
e.run_action(:update)
end

node.override['build-essential']['compile_time'] = true
include_recipe 'build-essential'

if node['postgresql']['enable_pgdg_yum'] && platform_family?('rhel')
package 'ca-certificates' do
action :nothing
end.run_action(:upgrade)

include_recipe 'postgresql::yum_pgdg_postgresql'

rpm_platform = node['platform']
rpm_platform_version = node['platform_version'].to_f.to_i.to_s
rpm_platform_version = node['platform_version'].to_i.to_s
arch = node['kernel']['machine']

resources("remote_file[#{Chef::Config[:file_cache_path]}/#{node['postgresql']['pgdg']['repo_rpm_url'][node['postgresql']['version']][rpm_platform][rpm_platform_version][arch]['package']}]").run_action(:create)
resources("package[#{node['postgresql']['pgdg']['repo_rpm_url'][node['postgresql']['version']][rpm_platform][rpm_platform_version][arch]['package']}]").run_action(:install)

ENV['PATH'] = "/usr/pgsql-#{node['postgresql']['version']}/bin:#{ENV['PATH']}"

node['postgresql']['client']['packages'].each do |pkg|
package pkg do
action :nothing
end.run_action(:install)
end
package node['postgresql']['client']['packages'] do
action :nothing
end.run_action(:install)

end

if node['postgresql']['enable_pgdg_apt'] && platform_family?('debian')
include_recipe 'postgresql::apt_pgdg_postgresql'
resources('apt_repository[apt.postgresql.org]').run_action(:add)

node['postgresql']['client']['packages'].each do |pkg|
package pkg do
action :nothing
end.run_action(:install)
end

package node['postgresql']['client']['packages'] do
action :nothing
end.run_action(:install)
end

include_recipe 'postgresql::client'

node['postgresql']['client']['packages'].each do |pkg|
package pkg do
action :nothing
end.run_action(:install)
end
package node['postgresql']['client']['packages'] do
action :nothing
end.run_action(:install)

begin
chef_gem 'pg' do
Expand Down

0 comments on commit 357b0f3

Please sign in to comment.