rspec-system-puppet 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ Gemfile.lock
2
+ *.gem
3
+ .*.swp
4
+ doc/
5
+ .yardoc
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.8.7-p371@rspec-system-puppet
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'mocha', :require => 'mocha/api'
7
+ end
8
+
9
+ group :development do
10
+ gem 'yard'
11
+ gem 'redcarpet'
12
+ end
data/LICENSE ADDED
@@ -0,0 +1,17 @@
1
+ rspec-system-puppet - Puppet rspec-system plugin
2
+
3
+ Copyright (C) 2013 Puppet Labs Inc
4
+
5
+ Puppet Labs can be contacted at: info@puppetlabs.com
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # rspec-system-puppet
2
+
3
+ `rspec-system-puppet` is a Puppet plugin for [rspec-system](https://rubygems.org/gems/ruby-system).
@@ -0,0 +1,54 @@
1
+ require 'rspec-system-puppet'
2
+
3
+ module RSpecSystemPuppet::Helpers
4
+ include RSpecSystem::Helpers
5
+ include RSpecSystem::Log
6
+
7
+ # Basic helper to install puppet
8
+ def system_puppet_install(options = {})
9
+ # Grab facts from node
10
+ facts = system_node.facts
11
+
12
+ # Remove annoying mesg n from profile, otherwise on Debian we get:
13
+ # stdin: is not a tty which messes with our tests later on.
14
+ if facts['osfamily'] == 'Debian'
15
+ log.info("Remove 'mesg n' from profile to stop noise")
16
+ system_run("sed -i 's/^mesg n/# mesg n/' /root/.profile")
17
+ end
18
+
19
+ # Grab PL repository and install PL copy of puppet
20
+ log.info "Starting installation of puppet from PL repos"
21
+ if facts['osfamily'] == 'RedHat'
22
+ system_run('rpm -ivh http://yum.puppetlabs.com/el/5/products/i386/puppetlabs-release-5-6.noarch.rpm')
23
+ system_run('yum install -y puppet')
24
+ elsif facts['osfamily'] == 'Debian'
25
+ system_run("wget http://apt.puppetlabs.com/puppetlabs-release-#{facts['lsbdistcodename']}.deb")
26
+ system_run("dpkg -i puppetlabs-release-#{facts['lsbdistcodename']}.deb")
27
+ system_run('apt-get update')
28
+ system_run('apt-get install -y puppet')
29
+ end
30
+
31
+ # Prep modules dir
32
+ log.info("Preparing modules dir")
33
+ system_run('mkdir -p /etc/puppet/modules')
34
+ end
35
+
36
+ # Helper to copy a module onto a node from source
37
+ def system_puppet_module_from_path(options)
38
+ # Defaults etc.
39
+ options = {
40
+ :node => rspec_system_node_set.default_node,
41
+ :module_path => "/etc/puppet/modules",
42
+ }.merge(options)
43
+
44
+ source = options[:source]
45
+ module_name = options[:module_name]
46
+ module_path = options[:module_path]
47
+ node = options[:node]
48
+
49
+ raise "Must provide :source and :module_name parameters" unless source && module_name
50
+
51
+ log.info("Now transferring module onto node")
52
+ system_rcp(:sp => source, :d => node, :dp => File.join(module_path, module_name))
53
+ end
54
+ end
@@ -0,0 +1,4 @@
1
+ require 'rspec-system'
2
+
3
+ # Root module namespace for +rspec-system-puppet+
4
+ module RSpecSystemPuppet; end
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ Gem::Specification.new do |s|
3
+ # Metadata
4
+ s.name = "rspec-system-puppet"
5
+ s.version = "0.1.0"
6
+ s.authors = ["Ken Barber"]
7
+ s.email = ["ken@bob.sh"]
8
+ s.homepage = "https://github.com/kbarber/rspec-system-puppet"
9
+ s.summary = "Puppet rspec-system plugin"
10
+
11
+ # Manifest
12
+ s.files = `git ls-files`.split("\n")
13
+ s.test_files = `git ls-files -- {test,spec,features}/*_spec.rb`.split("\n")
14
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ s.require_paths = ["lib", "resources"]
16
+
17
+ # Dependencies
18
+ s.required_ruby_version = '>= 1.8.7'
19
+ s.add_runtime_dependency "rspec-system", '~> 0.1.4'
20
+ end
@@ -0,0 +1,22 @@
1
+ dir = File.expand_path(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift File.join(dir, 'lib')
3
+
4
+ require 'rubygems'
5
+ require 'bundler/setup'
6
+
7
+ Bundler.require :default, :test
8
+
9
+ require 'pathname'
10
+ require 'tmpdir'
11
+
12
+ Pathname.glob("#{dir}/shared_behaviours/**/*.rb") do |behaviour|
13
+ require behaviour.relative_path_from(Pathname.new(dir))
14
+ end
15
+
16
+ def fixture_path
17
+ Pathname.new(File.expand_path(File.join(__FILE__, '..', 'fixtures')))
18
+ end
19
+
20
+ RSpec.configure do |config|
21
+ config.mock_with :mocha
22
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rspec-system-puppet
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Ken Barber
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2013-04-06 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec-system
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 19
29
+ segments:
30
+ - 0
31
+ - 1
32
+ - 4
33
+ version: 0.1.4
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description:
37
+ email:
38
+ - ken@bob.sh
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files: []
44
+
45
+ files:
46
+ - .gitignore
47
+ - .ruby-version
48
+ - Gemfile
49
+ - LICENSE
50
+ - README.md
51
+ - lib/rspec-system-puppet.rb
52
+ - lib/rspec-system-puppet/helpers.rb
53
+ - rspec-system-puppet.gemspec
54
+ - spec/spec_helper.rb
55
+ homepage: https://github.com/kbarber/rspec-system-puppet
56
+ licenses: []
57
+
58
+ post_install_message:
59
+ rdoc_options: []
60
+
61
+ require_paths:
62
+ - lib
63
+ - resources
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ hash: 57
70
+ segments:
71
+ - 1
72
+ - 8
73
+ - 7
74
+ version: 1.8.7
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ hash: 3
81
+ segments:
82
+ - 0
83
+ version: "0"
84
+ requirements: []
85
+
86
+ rubyforge_project:
87
+ rubygems_version: 1.8.24
88
+ signing_key:
89
+ specification_version: 3
90
+ summary: Puppet rspec-system plugin
91
+ test_files: []
92
+
93
+ has_rdoc: