opskeleton 0.4.5 → 0.4.6

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: fb8e6cfdc4545ead41ce026add622d10a3c6b7e6
4
- data.tar.gz: 142bf7f79131d930062982a2d317eb7eac8d4f09
3
+ metadata.gz: 1fc7f3c7be28794db4f4439d770863d598989ba5
4
+ data.tar.gz: a39ccc598356b656e7429dbcad46f9c11f0fc604
5
5
  SHA512:
6
- metadata.gz: a691af74c57934132d1339f4de8074326fd242ed7cc7085da211180f738f3ce79b23f54bed9249617ff74e726b994a93512c01f3117e00cdffdfb7e9a3a8c4e5
7
- data.tar.gz: 7e484c8928869d46bf0a1c6e062eaf8507d857a95f731a3542f454f593a96b44b52fa757af15bdb1a8eb86fb1c88b71be4fc975288643416ea3166a9c93e5fa3
6
+ metadata.gz: a036c652786fc5bf457b6fd01e1076ea0d25923d4fe0cf2d3660685349fe3a60e1c55e0da74e4cf396e6fa6689c02ebc97ec592a2d4d26e5bde94f1383cb6793
7
+ data.tar.gz: f06e8eb48afc25c213fd49ef7f753b569568ce729627e5bb654f909be84af4fc7e56e5872d5695b19af0a4f482c59a114b75fe743ce0b0e0eec8b6976866aba0
@@ -74,5 +74,9 @@ module Opsk
74
74
  end
75
75
  end
76
76
  end
77
+
78
+ def server_spec
79
+ directory('templates/parent/spec', "#{path}/spec")
80
+ end
77
81
  end
78
82
  end
@@ -1,3 +1,3 @@
1
1
  module Opskeleton
2
- VERSION = '0.4.5'
2
+ VERSION = '0.4.6'
3
3
  end
data/templates/Rakefile CHANGED
@@ -1,4 +1,13 @@
1
- task :spec do
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec) do |t|
5
+ t.pattern = 'spec/*/*_spec.rb'
6
+ end
7
+
8
+ task :default => :spec
9
+
10
+ task :modspec do
2
11
  FileList["static-modules/**/Rakefile"].each do |project|
3
12
  Rake::Task.clear
4
13
  load project
data/templates/gemfile CHANGED
@@ -12,3 +12,4 @@ gem 'puppet-lint'
12
12
  gem 'rake'
13
13
  gem 'librarian-puppet'
14
14
  gem 'opskeleton'
15
+ gem 'serverspec'
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe package('httpd') do
4
+ it { should be_installed }
5
+ end
6
+
7
+ describe service('httpd') do
8
+ it { should be_enabled }
9
+ it { should be_running }
10
+ end
11
+
12
+ describe port(80) do
13
+ it { should be_listening }
14
+ end
15
+
16
+ describe file('/etc/httpd/conf/httpd.conf') do
17
+ it { should be_file }
18
+ its(:content) { should match /ServerName default/ }
19
+ end
@@ -0,0 +1,46 @@
1
+ require 'serverspec'
2
+ require 'pathname'
3
+ require 'net/ssh'
4
+
5
+ include SpecInfra::Helper::Ssh
6
+ include SpecInfra::Helper::DetectOS
7
+
8
+ RSpec.configure do |c|
9
+ if ENV['ASK_SUDO_PASSWORD']
10
+ require 'highline/import'
11
+ c.sudo_password = ask("Enter sudo password: ") { |q| q.echo = false }
12
+ else
13
+ c.sudo_password = ENV['SUDO_PASSWORD']
14
+ end
15
+ c.before :all do
16
+ block = self.class.metadata[:example_group_block]
17
+ if RUBY_VERSION.start_with?('1.8')
18
+ file = block.to_s.match(/.*@(.*):[0-9]+>/)[1]
19
+ else
20
+ file = block.source_location.first
21
+ end
22
+ host = File.basename(Pathname.new(file).dirname)
23
+ if c.host != host
24
+ c.ssh.close if c.ssh
25
+ c.host = host
26
+ options = Net::SSH::Config.for(c.host)
27
+ user = options[:user] || Etc.getlogin
28
+ vagrant_up = `vagrant up default`
29
+ config = `vagrant ssh-config default`
30
+ if config != ''
31
+ config.each_line do |line|
32
+ if match = /HostName (.*)/.match(line)
33
+ host = match[1]
34
+ elsif match = /User (.*)/.match(line)
35
+ user = match[1]
36
+ elsif match = /IdentityFile (.*)/.match(line)
37
+ options[:keys] = [match[1].gsub(/"/,'')]
38
+ elsif match = /Port (.*)/.match(line)
39
+ options[:port] = match[1]
40
+ end
41
+ end
42
+ end
43
+ c.ssh = Net::SSH.start(host, user, options)
44
+ end
45
+ end
46
+ end
@@ -4,5 +4,5 @@ rvm:
4
4
  script:
5
5
  - "librarian-puppet install"
6
6
  - "rake lint"
7
- - "rake spec"
7
+ - "rake modspec"
8
8
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opskeleton
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - narkisr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-26 00:00:00.000000000 Z
11
+ date: 2014-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -136,6 +136,8 @@ files:
136
136
  - templates/module/Rakefile.erb
137
137
  - templates/module/spec_helper.rb
138
138
  - templates/opsk.yml
139
+ - templates/parent/spec/default/httpd_spec.rb
140
+ - templates/parent/spec/spec_helper.rb
139
141
  - templates/parent/travis.erb
140
142
  - templates/puppet/default.erb
141
143
  - templates/puppet/site.erb