This commit is contained in:
Tommy Parnell
2016-07-14 07:48:08 -04:00
commit 0ce2d96980
13 changed files with 237 additions and 0 deletions

7
.fixtures.yml Normal file
View File

@@ -0,0 +1,7 @@
fixtures:
repositories:
stdlib:
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
ref: '4.1.0'
symlinks:
rubydevkit: "#{source_dir}"

17
.gitignore vendored Normal file
View File

@@ -0,0 +1,17 @@
## MAC OS
.DS_Store
## TEXTMATE
*.tmproj
tmtags
## EMACS
*~
\#*
.\#*
## VIM
*.swp
tags
.tmp/
modules/

7
Gemfile Normal file
View File

@@ -0,0 +1,7 @@
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 3.3']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'puppet-lint', '>= 0.3.2'
gem 'facter', '>= 1.7.0'

7
Puppetfile Normal file
View File

@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
#^syntax detection
forge "https://forgeapi.puppetlabs.com"
# use dependencies defined in metadata.json
metadata

15
Puppetfile.lock Normal file
View File

@@ -0,0 +1,15 @@
FORGE
remote: https://forgeapi.puppetlabs.com
specs:
badgerious-windows_env (2.2.2)
chocolatey-chocolatey (1.2.6)
badgerious-windows_env (< 3.0.0, >= 2.2.1)
puppetlabs-powershell (< 3.0.0, >= 1.0.1)
puppetlabs-stdlib (< 5.0.0, >= 4.6.0)
puppetlabs-powershell (2.0.2)
puppetlabs-stdlib (4.12.0)
DEPENDENCIES
chocolatey-chocolatey (>= 0)
puppetlabs-stdlib (>= 1.0.0)

30
README.md Normal file
View File

@@ -0,0 +1,30 @@
# rubydevkit
## Overview
This is a simple module to install the rubydevkit on windows.
## Requirements
Ruby installed to a directory, before calling this module.
## Usage
```
class {'rubydevkit':
rubyHomePath => 'c:/tools/ruby22'
}
```
## Optional Parameters:
#### devkitUrl
Url to download the devkit, default: `http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe`
you can change this to download the 32-bit devkit, instead of the 64

18
Rakefile Normal file
View File

@@ -0,0 +1,18 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
desc "Validate manifests, templates, and ruby files"
task :validate do
Dir['manifests/**/*.pp'].each do |manifest|
sh "puppet parser validate --noop #{manifest}"
end
Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
end
Dir['templates/**/*.erb'].each do |template|
sh "erb -P -x -T '-' #{template} | ruby -c"
end
end

77
manifests/init.pp Normal file
View File

@@ -0,0 +1,77 @@
# == Class: rubydevkit
#
# Full description of class rubydevkit here.
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*sample_variable*]
# Explanation of how this variable affects the funtion of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
#
# === Examples
#
# class { 'rubydevkit':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# === Authors
#
# Author Name <author@domain.com>
#
# === Copyright
#
# Copyright 2016 Your name here, unless otherwise noted.
#
class rubydevkit(
$rubyHomePath,
$devkitUrl => "http://dl.bintray.com/oneclick/rubyinstaller/DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe"
) {
package { '7zip':
ensure => installed,
provider => 'chocolatey',
}->
# make sure the tools directory exists
file { 'C:/tools/':
ensure => 'directory',
}->
file { 'C:/temp/':
ensure => 'directory',
}->
download_file { "Download ruby devkit" :
url => $devkitUrl,
destination_directory => 'c:\temp',
destination_file => "rubydk.exe"
}->
exec{'unzip devkit':
command => '"c:/Program Files/7-zip/7z.exe" x -oDevKit2 c:/temp/rubydk.exe -aoa', #use 7zip to extract c:/temp/rubydk.exe -0 == extract to DevKit2 -aoa == override files
cwd => 'c:/tools',
creates => 'c:/tools/DevKit2'
}->
file { 'C:/tools/DevKit2/config.yml':
ensure => file,
group => 'Users',
owner => 'Administrator',
content => template('rubydevkit/config.yml'),
mode => '0644'
}
exec{'install devkit':
refreshonly => true,
subscribe => File['C:/tools/DevKit2/config.yml'],
command => "${rubyHomePath}/bin/ruby.exe dk.rb install",
cwd => 'c:/tools/DevKit2'
}
}

24
metadata.json Normal file
View File

@@ -0,0 +1,24 @@
{
"name": "terribledev-rubydevkit",
"version": "0.1.0",
"author": "terribledev",
"summary": "installs rubydevkit into windows",
"license": "MIT",
"source": "https://github.com/TerribleDev/puppet-rubydevkit.git",
"project_page": "https://github.com/TerribleDev/puppet-rubydevkit",
"issues_url": "https://github.com/TerribleDev/puppet-rubydevkit/issues",
"dependencies": [
{
"name":"puppetlabs-stdlib","version_requirement":">= 1.0.0"
},
{
"name": "chocolatey-chocolatey"
}
],
"operatingsystem_support":[
{
"operatingsystem": "Windows"
}
]
}

View File

@@ -0,0 +1,7 @@
require 'spec_helper'
describe 'rubydevkit' do
context 'with defaults for all parameters' do
it { should contain_class('rubydevkit') }
end
end

1
spec/spec_helper.rb Normal file
View File

@@ -0,0 +1 @@
require 'puppetlabs_spec_helper/module_spec_helper'

15
templates/config.yml.erb Normal file
View File

@@ -0,0 +1,15 @@
# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
---
- <%= @rubyPath %>

12
tests/init.pp Normal file
View File

@@ -0,0 +1,12 @@
# The baseline for module testing used by Puppet Labs is that each manifest
# should have a corresponding test manifest that declares that class or defined
# type.
#
# Tests are then run by using puppet apply --noop (to check for compilation
# errors and view a log of events) or by fully applying the test in a virtual
# environment (to compare the resulting system state to the desired state).
#
# Learn more about module testing here:
# http://docs.puppetlabs.com/guides/tests_smoke.html
#
include rubydevkit