opskeleton 0.6.3 → 0.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3b4a374826399d13c9fcb8a303f01ebf3cf8c102
4
- data.tar.gz: 615a09a04588c88aa91fa8d8fc8c556dd75db332
3
+ metadata.gz: f0ce97c953f80ab8ee81d8702974054793781cf6
4
+ data.tar.gz: 7fde5abe563d7a19aa1fe909e43d44d3000b81c7
5
5
  SHA512:
6
- metadata.gz: 234f43f5a80f63a4bee67ce23c012d6565bca69b82d262236faeb5ad6eb8e33fac894ecb17be3b01822f1db00037d4dcbdc6ae6baa8e8b3d35c9948654ded1b5
7
- data.tar.gz: b4217476b3d80871faa553179a88726e1aa5670e4a3e824b69aa8c7421693fa838ee47f9c1f9d54e1590ea241277828d984d2425dce4852154fc948e847184b9
6
+ metadata.gz: 55f8f738ce76f66d382aecc2ae553070a2305f5d9cd859f5a99ade740ba825431a75a8e8bfe0b53910bd9c2c4a812fe1395d762a357d7012375a305df480c2de
7
+ data.tar.gz: 04327c6ca106b4c777bfaab9ae84d3b9c8ede2f16689a918e320d923f4d0094314caf882f4ecf69ba9296b7aa25f5195e7dc94391754205e1eb080557d5cd84c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- opskeleton (0.6.3)
4
+ opskeleton (0.6.4)
5
5
  bintray_deploy
6
6
  thor
7
7
 
@@ -1,3 +1,3 @@
1
1
  module Opskeleton
2
- VERSION = '0.6.3'
2
+ VERSION = '0.6.4'
3
3
  end
@@ -7,14 +7,28 @@ end
7
7
 
8
8
  task :default => :spec
9
9
 
10
- task :modspec do
11
- FileList["static-modules/**/Rakefile"].each do |project|
12
- Rake::Task.clear
13
- load project
14
- dir = project.pathmap("%d")
15
- Dir.chdir(dir) do
16
- spec_task = Rake::Task[:spec]
17
- spec_task.invoke()
18
- end
10
+ desc "Run serverspec to all hosts"
11
+ task :spec => 'serverspec:all'
12
+
13
+ class ServerspecTask < RSpec::Core::RakeTask
14
+
15
+ attr_accessor :target
16
+
17
+ def spec_command
18
+ cmd = super
19
+ "env TARGET_HOST=#{target} #{cmd}"
20
+ end
21
+
22
+ end
23
+
24
+ namespace :serverspec do
25
+
26
+ %w(<%=@name=>).each do |profile|
27
+ ServerspecTask.new(profile.to_sym) do |t|
28
+ t.target = profile
29
+ t.pattern = "spec/#{profile}/*_spec.rb"
19
30
  end
31
+ end
20
32
  end
33
+
34
+ task :default => 'serverspec:minimal'
@@ -6,41 +6,28 @@ include SpecInfra::Helper::Ssh
6
6
  include SpecInfra::Helper::DetectOS
7
7
 
8
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
9
  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
10
+ c.host = ENV['TARGET_HOST']
11
+ c.ssh.close if c.ssh
12
+ options = Net::SSH::Config.for(c.host)
13
+ user = 'vagrant'
14
+ vagrant_up = `vagrant up #{c.host}`
15
+ config = `vagrant ssh-config #{c.host}`
16
+ sshhost = sshuser = ''
17
+ if config != ''
18
+ config.each_line do |line|
19
+ if match = /HostName (.*)/.match(line)
20
+ sshhost = match[1]
21
+ elsif match = /User (.*)/.match(line)
22
+ sshuser = match[1]
23
+ elsif match = /IdentityFile (.*)/.match(line)
24
+ options[:keys] = [match[1].gsub(/"/,'')]
25
+ elsif match = /Port (.*)/.match(line)
26
+ options[:port] = match[1]
41
27
  end
42
28
  end
43
- c.ssh = Net::SSH.start(host, user, options)
44
29
  end
30
+
31
+ c.ssh = Net::SSH.start(sshhost, sshuser, options)
45
32
  end
46
33
  end
@@ -22,3 +22,29 @@ end
22
22
  require 'puppet-lint/tasks/puppet-lint'
23
23
  PuppetLint.configuration.ignore_paths =['modules/**/*', 'vendor/**/*']
24
24
  PuppetLint.configuration.send("disable_80chars")
25
+
26
+ desc "Run serverspec to all hosts"
27
+ task :spec => 'serverspec:all'
28
+
29
+ class ServerspecTask < RSpec::Core::RakeTask
30
+
31
+ attr_accessor :target
32
+
33
+ def spec_command
34
+ cmd = super
35
+ "env TARGET_HOST=#{target} #{cmd}"
36
+ end
37
+
38
+ end
39
+
40
+ namespace :serverspec do
41
+
42
+ %w(<%=@name=>).each do |profile|
43
+ ServerspecTask.new(profile.to_sym) do |t|
44
+ t.target = profile
45
+ t.pattern = "spec/#{profile}/*_spec.rb"
46
+ end
47
+ end
48
+ end
49
+
50
+ task :default => 'serverspec:minimal'
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.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - narkisr
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-20 00:00:00.000000000 Z
11
+ date: 2014-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -164,7 +164,7 @@ files:
164
164
  - templates/hiera_vagrant.yaml
165
165
  - templates/module/Rakefile.erb
166
166
  - templates/module/spec_helper.rb
167
- - templates/parent/spec/default/httpd_spec.rb
167
+ - templates/parent/spec/default/stub_spec.rb
168
168
  - templates/parent/spec/spec_helper.rb
169
169
  - templates/parent/travis.erb
170
170
  - templates/puppet/Rakefile