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

First spike at jruby #14

Closed
wants to merge 2 commits into from
Closed
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
/spec/fixtures/vendor/
/spec/fixtures/modules/boxen/
/spec/fixtures/modules/homebrew/
/spec/fixtures/modules/java/
/spec/fixtures/modules/stdlib/
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Requires the following boxen modules:

* `boxen`
* `java` (only if using JRuby)
* `stdlib`

## Usage

Expand Down
6 changes: 1 addition & 5 deletions manifests/1_8_7.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
require ruby
require ruby::1_8_7_p358

file { "${ruby::root}/versions/1.8.7":
ensure => symlink,
force => true,
target => "${ruby::root}/versions/1.8.7-p358"
}
ruby::alias { '1.8.7': target => '1.8.7-p358' }
}
6 changes: 1 addition & 5 deletions manifests/1_9_2.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
require ruby
require ruby::1_9_2_p320

file { "${ruby::root}/versions/1.9.2":
ensure => symlink,
force => true,
target => "${ruby::root}/versions/1.9.2-p320"
}
ruby::alias { '1.9.2': target => '1.9.2-p320' }
}
6 changes: 1 addition & 5 deletions manifests/1_9_3.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,5 @@
require ruby
require ruby::1_9_3_p392

file { "${ruby::root}/versions/1.9.3":
ensure => symlink,
force => true,
target => "${ruby::root}/versions/1.9.3-p392"
}
ruby::alias { '1.9.3': target => '1.9.3-p392' }
}
7 changes: 1 addition & 6 deletions manifests/2_0_0.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,5 @@
require ruby
require ruby::2_0_0_p0

file { "${ruby::root}/versions/2.0.0":
ensure => symlink,
force => true,
target => "${ruby::root}/versions/2.0.0-p0"
}
ruby::alias { '2.0.0': target => '2.0.0-p0' }
}

15 changes: 15 additions & 0 deletions manifests/alias.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Public: Sets up an alias for $name to the rbenv version for $target.
#
# Usage:
#
# ruby::alias { '1.9.3': target => '1.9.3-p392' }

define ruby::alias($target) {
require ruby

file { "${ruby::root}/versions/${name}":
ensure => symlink,
force => true,
target => "${ruby::root}/versions/${target}"
}
}
13 changes: 13 additions & 0 deletions manifests/jruby.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Public: Installs our blessed version of jruby and symlinks it in rbenv
# to "jruby"
#
# Usage:
#
# include ruby::jruby

class ruby::jruby {
require ruby
require ruby::jruby_1_7_3

ruby::alias { 'jruby': target => 'jruby-1.7.3' }
}
17 changes: 17 additions & 0 deletions manifests/jruby_1_7_3.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Public: Installs JRuby 1.7.3 from rbenv
#
# Usage:
#
# include ruby::jruby_1_7_3


class ruby::jruby_1_7_3 {
include ruby
include java

ruby::version { 'jruby-1.7.3': }

Ruby::Version <| title == 'jruby-1.7.3' |> {
require +> Class['java']
}
}
19 changes: 19 additions & 0 deletions spec/classes/jruby_1_7_3_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

describe 'ruby::jruby_1_7_3' do
let(:facts) do
{
:boxen_home => '/test/boxen',
:boxen_user => 'testuser',
:macosx_productversion_major => '10.8'
}
end

it do
should include_class('java')
should include_class('ruby')

should contain_ruby__version('jruby-1.7.3')#.
#with_require('[Class[java], Class[ruby]]')
end
end
18 changes: 18 additions & 0 deletions spec/classes/jruby_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'spec_helper'

describe 'ruby::jruby' do
let(:facts) do
{
:boxen_home => '/test/boxen',
:boxen_user => 'testuser',
:macosx_productversion_major => '10.8'
}
end

it do
should include_class('ruby')
should include_class('ruby::jruby_1_7_3')

should contain_ruby__alias('jruby').with_target('jruby-1.7.3')
end
end
26 changes: 26 additions & 0 deletions spec/defines/ruby_alias_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
require 'spec_helper'

describe 'ruby::alias' do
let(:facts) do
{
:boxen_home => '/test/boxen',
:boxen_user => 'testuser',
:macosx_productversion_major => '10.8'
}
end

let(:title) { "2.1.0" }
let(:params) do
{
:target => '2.1.0-dev'
}
end

it do
should contain_file('/test/boxen/rbenv/versions/2.1.0').with({
:ensure => 'symlink',
:force => true,
:target => '/test/boxen/rbenv/versions/2.1.0-dev'
})
end
end
14 changes: 11 additions & 3 deletions spec/fixtures/Puppetfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
mod "boxen", "0.1.8", :github_tarball => "boxen/puppet-boxen"
mod "homebrew", "0.0.17", :github_tarball => "boxen/puppet-homebrew"
mod "stdlib", "3.0.0", :github_tarball => "puppetlabs/puppetlabs-stdlib"
def github(name, version, options = nil)
options ||= {}
options[:repo] ||= "boxen/puppet-#{name}"
mod name, version, :github_tarball => options[:repo]
end


github "boxen", "1.2.0"
github "homebrew", "1.1.0"
github "java", "1.0.6"
github "stdlib", "3.0.0", :repo => "puppetlabs/puppetlabs-stdlib"