puppet_spec_facts 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feec5407015957d9922ec6050b357449cbc26d38
4
- data.tar.gz: ef37b8c0a263a516d4f0de9eac351b2a2ea910f8
3
+ metadata.gz: 913f0955401c3928fce555e37dc439051d80d152
4
+ data.tar.gz: 90e913645b52b8630bfc69de8e5dd9b5acdb0ad4
5
5
  SHA512:
6
- metadata.gz: 9283109b17594c632ea18be75e136f2002c6ccabdbad871e4b0e77f845feaa53fd66611ad490dff2336a254a3223e988aee705cef09187fdd0455cc415764ef5
7
- data.tar.gz: 51235ec697206c0513acc400a6483f8c924d6b64477e230c406e56146b79c2c4fb4f12ee61f962092b0c24448a56630c0ada5430bca0e96d6583c9fa10cbca2c
6
+ metadata.gz: 7709b857e8ec19996830c55c433b5411d97ea69259149c3fcc3d4e1eab9f89619e091cb645cf5ed51a1b785927e9c928f02147829ea01b77cb1ce10828e95c2e
7
+ data.tar.gz: 76d9e737b719ae264c78976322242b919781e55584fc014ef8680c8520b189f8cbcfd7adb55dbe4b192a1bf05c6d4270736127fe03fe12c4c4f7e9fba4c53ab1
data/.gitignore CHANGED
@@ -20,3 +20,5 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ .coveralls.yml
24
+ .vagrant
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ 0.1.0 Release
2
+ - Added concat_basedir fake fact
3
+ - Added path fake fact
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
- # In development, do not use
2
-
3
1
  # PuppetSpecFacts
4
- [![Build Status](https://travis-ci.org/danieldreier/puppet_spec_facts.svg?branch=master)](https://travis-ci.org/danieldreier/puppet_spec_facts) [![Code Climate](https://codeclimate.com/github/danieldreier/puppet_spec_facts/badges/gpa.svg)](https://codeclimate.com/github/danieldreier/puppet_spec_facts) [![Coverage Status](https://img.shields.io/coveralls/danieldreier/puppet_spec_facts.svg)](https://coveralls.io/r/danieldreier/puppet_spec_facts?branch=master) [![Dependency Status](https://gemnasium.com/danieldreier/puppet_spec_facts.svg)](https://gemnasium.com/danieldreier/puppet_spec_facts)
2
+ [![Build Status](https://travis-ci.org/danieldreier/puppet_spec_facts.svg?branch=master)](https://travis-ci.org/danieldreier/puppet_spec_facts) [![Code Climate](https://codeclimate.com/github/danieldreier/puppet_spec_facts/badges/gpa.svg)](https://codeclimate.com/github/danieldreier/puppet_spec_facts) [![Coverage Status](https://img.shields.io/coveralls/danieldreier/puppet_spec_facts.svg)](https://coveralls.io/r/danieldreier/puppet_spec_facts?branch=master) [![Dependency Status](https://gemnasium.com/danieldreier/puppet_spec_facts.svg)](https://gemnasium.com/danieldreier/puppet_spec_facts) [![Gem Version](https://badge.fury.io/rb/puppet_spec_facts.svg)](http://badge.fury.io/rb/puppet_spec_facts)
5
3
 
6
4
  This gem provides facts for rspec-puppet, much like
7
5
  [apenny/puppet_facts](https://github.com/apenney/puppet_facts) but targeted
8
6
  toward open source puppet whereas puppet_facts seems to be aimed at Puppet
9
7
  Enterprise.
10
8
 
9
+ This project is very (very) new. If you're successful in using it (or not) I'd really appreciate feedback.
10
+
11
11
  Puppet module developers (should) use rspec-puppet to validate conditional logic. One of the most common forms
12
12
  of conditional logic is to change behavior based on operating system or linux distribution. Unfortunately, most
13
13
  rspec-puppet tests only include a handful of relevant facts from one or two popular Linux distributions.
@@ -26,10 +26,11 @@ Add this line to your puppet module's Gemfile:
26
26
  ```gemfile
27
27
  gem 'puppet_spec_facts'
28
28
  ```
29
- Add this line to your `spec/spec_helper.rb` file:
29
+ Add these lines to your `spec/spec_helper.rb` file:
30
30
 
31
31
  ```ruby
32
- require 'spec_helper'
32
+ require 'puppet_spec_facts'
33
+ include PuppetSpecFacts
33
34
  ```
34
35
 
35
36
  ## Usage
@@ -52,7 +53,7 @@ describe 'example' do
52
53
  # etc
53
54
  describe "example class without any parameters on #{name}" do
54
55
  let(:params) {{ }}
55
- let(:facts) { facthash } # the facter output you sent in above is now available in rspec
56
+ let(:facts) { facthash } # the fact hash from puppet_spec_facts is now available for rspec tests
56
57
 
57
58
  it { should compile.with_all_deps }
58
59
  end
@@ -83,11 +84,3 @@ describe 'example' do
83
84
  end
84
85
  end
85
86
  ```
86
-
87
- ## Contributing
88
-
89
- 1. Fork it ( https://github.com/[my-github-username]/puppet_spec_facts/fork )
90
- 2. Create your feature branch (`git checkout -b my-new-feature`)
91
- 3. Commit your changes (`git commit -am 'Add some feature'`)
92
- 4. Push to the branch (`git push origin my-new-feature`)
93
- 5. Create a new Pull Request
@@ -1,3 +1,3 @@
1
1
  module PuppetSpecFacts
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -29,8 +29,10 @@ module PuppetSpecFacts
29
29
 
30
30
  # inject some additional facts to simplify lookups from rspec
31
31
  def self.overload_facts(fact_hash)
32
- fact_hash['fact_style'] = fact_style(fact_hash)
33
- fact_hash['is_pe'] = 'true' if is_pe(fact_hash)
32
+ fact_hash['fact_style'] = fact_style(fact_hash)
33
+ fact_hash['is_pe'] = 'true' if is_pe(fact_hash)
34
+ fact_hash['concat_basedir'] = '/fake_concat_basedir'
35
+ fact_hash['path'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
34
36
  return fact_hash
35
37
  end
36
38
 
@@ -0,0 +1,27 @@
1
+ #!/bin/sh
2
+
3
+ # gather facter facts on boxes with puppet already installed
4
+ kernel=$(facter kernel)
5
+ arch=$(facter architecture)
6
+ release=$(facter operatingsystemrelease)
7
+ puppetversion=$(facter puppetversion)
8
+ osfamily=$(facter osfamily)
9
+ date=$(date +"%s")
10
+ mkdir -p "/vagrant/facts/${kernel}/${osfamily}"
11
+
12
+ puppet apply -e 'package {"curl": ensure => present}'
13
+ puppet config set stringify_facts true
14
+ fact_style="stringified"
15
+ filename="${kernel}-${osfamily}-${release}-${arch}-${puppetversion}-${fact_style}-${date}"
16
+
17
+ facter --json > "/vagrant/facts/${kernel}/${osfamily}/${filename}"
18
+ facter --json | curl -H "Content-Type: application/json" -d @- http://facts.whilefork.com
19
+
20
+ puppet config set stringify_facts false
21
+ fact_style="structured"
22
+ filename="${kernel}-${osfamily}-${release}-${arch}-${puppetversion}-${fact_style}-${date}"
23
+
24
+ facter --json > "/vagrant/facts/${kernel}/${osfamily}/${filename}"
25
+ facter --json | curl -H "Content-Type: application/json" -d @- http://facts.whilefork.com
26
+
27
+ shutdown -h now
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet_spec_facts
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Dreier
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-01 00:00:00.000000000 Z
11
+ date: 2014-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,6 +105,7 @@ files:
105
105
  - ".ruby-gemset"
106
106
  - ".ruby-version"
107
107
  - ".travis.yml"
108
+ - CHANGELOG.md
108
109
  - Gemfile
109
110
  - LICENSE.txt
110
111
  - README.md
@@ -130,6 +131,7 @@ files:
130
131
  - lib/puppet_spec_facts.rb
131
132
  - lib/puppet_spec_facts/version.rb
132
133
  - puppet_spec_facts.gemspec
134
+ - scripts/gather_facts.sh
133
135
  - spec/lib/puppet_spec_facts_spec.rb
134
136
  - spec/spec_helper.rb
135
137
  homepage: https://github.com/danieldreier/puppet_spec_facts