commit 0ce2d9698088a0076479b04e1ee96d57c13cb82c Author: Tommy Parnell Date: Thu Jul 14 07:48:08 2016 -0400 init diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 0000000..72a5b38 --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,7 @@ +fixtures: + repositories: + stdlib: + repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git' + ref: '4.1.0' + symlinks: + rubydevkit: "#{source_dir}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0ec49ac --- /dev/null +++ b/.gitignore @@ -0,0 +1,17 @@ +## MAC OS +.DS_Store + +## TEXTMATE +*.tmproj +tmtags + +## EMACS +*~ +\#* +.\#* + +## VIM +*.swp +tags +.tmp/ +modules/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..7bd34cd --- /dev/null +++ b/Gemfile @@ -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' diff --git a/Puppetfile b/Puppetfile new file mode 100644 index 0000000..177adf1 --- /dev/null +++ b/Puppetfile @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +#^syntax detection + +forge "https://forgeapi.puppetlabs.com" + +# use dependencies defined in metadata.json +metadata diff --git a/Puppetfile.lock b/Puppetfile.lock new file mode 100644 index 0000000..4173284 --- /dev/null +++ b/Puppetfile.lock @@ -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) + diff --git a/README.md b/README.md new file mode 100644 index 0000000..abd1ac7 --- /dev/null +++ b/README.md @@ -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 diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..d1e11f7 --- /dev/null +++ b/Rakefile @@ -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 diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..ef6141f --- /dev/null +++ b/manifests/init.pp @@ -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 +# +# === 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' + } +} diff --git a/metadata.json b/metadata.json new file mode 100644 index 0000000..4dce887 --- /dev/null +++ b/metadata.json @@ -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" + } + ] +} + diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb new file mode 100644 index 0000000..3f20255 --- /dev/null +++ b/spec/classes/init_spec.rb @@ -0,0 +1,7 @@ +require 'spec_helper' +describe 'rubydevkit' do + + context 'with defaults for all parameters' do + it { should contain_class('rubydevkit') } + end +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..2c6f566 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1 @@ +require 'puppetlabs_spec_helper/module_spec_helper' diff --git a/templates/config.yml.erb b/templates/config.yml.erb new file mode 100644 index 0000000..ede8a86 --- /dev/null +++ b/templates/config.yml.erb @@ -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 %> diff --git a/tests/init.pp b/tests/init.pp new file mode 100644 index 0000000..d42acf2 --- /dev/null +++ b/tests/init.pp @@ -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