Permalink
Browse files

Added ruby and bundler installation to setup phase

Resolves #5, resolves #6.
  • Loading branch information...
ajgon committed Apr 12, 2016
1 parent bbb79cc commit 0182e70264e8dc757f9a8fa9b5a7198c046dc59b
Showing with 59 additions and 1 deletion.
  1. +5 −1 attributes/default.rb
  2. +1 −0 metadata.rb
  3. +3 −0 recipes/setup.rb
  4. +3 −0 spec/fixtures/node.rb
  5. +47 −0 spec/unit/recipes/setup_spec.rb
View
@@ -1,5 +1,9 @@
# frozen_string_literal: true
# ruby
default['build-essential']['compile_time'] = true
default['ruby-ng']['ruby_version'] = node['ruby'].try(:[], 'version') || '2.3'
# appserver
## common
View
@@ -8,6 +8,7 @@
version '0.1.0'
depends 'deployer'
depends 'ruby-ng'
depends 'application_ruby'
source_url 'https://github.com/ajgon/opsworks_ruby'
View
@@ -5,6 +5,9 @@
#
include_recipe 'deployer'
include_recipe 'ruby-ng::dev'
gem_package 'bundler'
every_enabled_application do |application|
scm = Drivers::Scm::Factory.build(application, node)
View
@@ -2,6 +2,9 @@
# rubocop:disable Metrics/MethodLength
def node(override = {})
item = {
lsb: {
codename: 'trusty'
},
deploy: {
dummy_project: {
database: {
@@ -11,6 +11,7 @@
let(:chef_run) do
ChefSpec::SoloRunner.new do |solo_node|
solo_node.set['deploy'] = node['deploy']
solo_node.set['lsb'] = node['lsb']
end.converge(described_recipe)
end
@@ -24,6 +25,52 @@
expect(chef_run).to include_recipe('deployer')
end
context 'Rubies' do
it 'installs ruby 2.0' do
chef_run = ChefSpec::SoloRunner.new do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.0' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)
expect(chef_run).to install_package('ruby2.0')
expect(chef_run).to install_package('ruby2.0-dev')
end
it 'installs ruby 2.1' do
chef_run = ChefSpec::SoloRunner.new do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.1' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)
expect(chef_run).to install_package('ruby2.1')
expect(chef_run).to install_package('ruby2.1-dev')
end
it 'installs ruby 2.2' do
chef_run = ChefSpec::SoloRunner.new do |solo_node|
solo_node.set['ruby'] = { 'version' => '2.2' }
solo_node.set['lsb'] = node['lsb']
solo_node.set['deploy'] = node['deploy']
end.converge(described_recipe)
expect(chef_run).to install_package('ruby2.2')
expect(chef_run).to install_package('ruby2.2-dev')
end
it 'installs ruby 2.3' do
expect(chef_run).to install_package('ruby2.3')
expect(chef_run).to install_package('ruby2.3-dev')
end
end
context 'Gems' do
it 'bundler' do
expect(chef_run).to install_gem_package(:bundler)
end
end
context 'Postgresql + git' do
it 'installs required packages' do
expect(chef_run).to install_package('git')

0 comments on commit 0182e70

Please sign in to comment.