pdqtest 0.9.0 → 0.10.0
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 +4 -4
- data/lib/pdqtest/skeleton.rb +8 -6
- data/lib/pdqtest/upgrade.rb +44 -30
- data/lib/pdqtest/version.rb +2 -1
- data/res/skeleton/Gemfile +0 -1
- data/res/skeleton/Makefile +5 -0
- data/res/skeleton/bitbucket-pipelines.yml +16 -0
- data/res/skeleton/dot_travis.yml +4 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1486e70fe329976fc281d23baeb85cd441865254
|
4
|
+
data.tar.gz: 9208d08425b7b9890fc8d41e519d2ef2777b0dec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d10dfb2cac8a5db32c04fb7376632be1c735cff13b0d2b8d01a40bdf3815e9b4e26734d573d9a6ff26627354325361c72d8964f3df3db6abdcdd731626f4af60
|
7
|
+
data.tar.gz: 473d65b5bb0ee3f737164908f2ec25703418e80ed44f6aa813dafab5cdf08d76287ef990341fcd557cd49fa6812ffdc903168ab949fe80f236ebc084543fc246
|
data/lib/pdqtest/skeleton.rb
CHANGED
@@ -8,7 +8,6 @@ require 'pdqtest/upgrade'
|
|
8
8
|
module PDQTest
|
9
9
|
module Skeleton
|
10
10
|
FIXTURES = '.fixtures.yml'
|
11
|
-
BACKUP_EXT = '.pdqtest_old'
|
12
11
|
SPEC_DIR = 'spec'
|
13
12
|
ACCEPTANCE_DIR = File.join(SPEC_DIR, 'acceptance')
|
14
13
|
CLASSES_DIR = File.join(SPEC_DIR, 'classes')
|
@@ -32,8 +31,6 @@ module PDQTest
|
|
32
31
|
install = false
|
33
32
|
if File.exists?(target_file)
|
34
33
|
if replace and should_replace_file(target_file, skeleton_file)
|
35
|
-
# move existing file out of the way
|
36
|
-
FileUtils.mv(target_file, target_file + BACKUP_EXT)
|
37
34
|
install = true
|
38
35
|
end
|
39
36
|
else
|
@@ -64,7 +61,7 @@ module PDQTest
|
|
64
61
|
|
65
62
|
# move .fixtures.yml out of the way
|
66
63
|
if File.exists?(FIXTURES)
|
67
|
-
|
64
|
+
File.delete(FIXTURES)
|
68
65
|
end
|
69
66
|
|
70
67
|
# make directory structure for testcases
|
@@ -77,19 +74,24 @@ module PDQTest
|
|
77
74
|
# skeleton files if required
|
78
75
|
install_skeleton('Rakefile', 'Rakefile')
|
79
76
|
install_skeleton(File.join('spec', 'spec_helper.rb'), 'spec_helper.rb')
|
80
|
-
install_skeleton('.travis.yml', 'dot_travis.yml')
|
81
77
|
install_skeleton('.gitignore', 'dot_gitignore')
|
82
78
|
install_skeleton('.rspec', 'dot_rspec')
|
83
|
-
install_skeleton('Makefile', 'Makefile')
|
84
79
|
install_skeleton(File.join(SPEC_DIR, 'fixtures', HIERA_YAML), HIERA_YAML)
|
85
80
|
install_skeleton(File.join(HIERA_DIR, HIERA_TEST), HIERA_TEST)
|
86
81
|
|
87
82
|
install_acceptance()
|
88
83
|
install_gemfile()
|
84
|
+
install_integrations()
|
89
85
|
|
90
86
|
# Make sure there is a Gemfile and we are in it
|
91
87
|
end
|
92
88
|
|
89
|
+
def self.install_integrations()
|
90
|
+
install_skeleton('Makefile', 'Makefile')
|
91
|
+
install_skeleton('bitbucket-pipelines.yml', 'bitbucket-pipelines.yml')
|
92
|
+
install_skeleton('.travis.yml', 'dot_travis.yml')
|
93
|
+
end
|
94
|
+
|
93
95
|
def self.install_acceptance(example_file ="init.pp")
|
94
96
|
install_example(File.basename(example_file))
|
95
97
|
example_name = File.basename(example_file).gsub(/\.pp$/, '')
|
data/lib/pdqtest/upgrade.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'pdqtest/skeleton'
|
2
|
+
|
1
3
|
module PDQTest
|
2
4
|
module Upgrade
|
3
5
|
GEMFILE = 'Gemfile'
|
@@ -13,6 +15,10 @@ module PDQTest
|
|
13
15
|
'line' => "gem 'puppet-strings', :git => 'https://github.com/puppetlabs/puppet-strings'",
|
14
16
|
'added' => false,
|
15
17
|
},
|
18
|
+
'puppet' => {
|
19
|
+
'line' => "gem 'puppet', '#{PDQTest::PUPPET_VERSION}'",
|
20
|
+
'added' => false,
|
21
|
+
}
|
16
22
|
}
|
17
23
|
|
18
24
|
|
@@ -20,43 +26,51 @@ module PDQTest
|
|
20
26
|
def self.upgrade()
|
21
27
|
t_file = File.open("#{GEMFILE}.tmp","w")
|
22
28
|
updating_gem = false
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
|
30
|
+
if File.exists?(GEMFILE)
|
31
|
+
File.open(GEMFILE, 'r') do |f|
|
32
|
+
f.each_line{ |line|
|
33
|
+
if line =~ GEM_REGEXP
|
34
|
+
# a gem stanza
|
35
|
+
processing_gem = $2
|
36
|
+
if GEMS.keys.include?(processing_gem)
|
37
|
+
# fixup one of our monitored gems as needed, mark
|
38
|
+
# this as being a gem that is being updated so
|
39
|
+
# that we can kill any multi-line attributes
|
40
|
+
t_file.puts GEMS[processing_gem]['line']
|
41
|
+
updating_gem = true
|
42
|
+
GEMS[processing_gem]['added'] = true
|
43
|
+
else
|
44
|
+
# a gem we don't care about - write it out as-is
|
45
|
+
t_file.puts line
|
46
|
+
updating_gem = false
|
47
|
+
end
|
48
|
+
elsif updating_gem and line =~ GEM_ATTRIB_REGEXP
|
49
|
+
# do nothing - remove the multi-line attributes
|
35
50
|
else
|
36
|
-
#
|
51
|
+
# anything else... (esp comments)
|
37
52
|
t_file.puts line
|
38
|
-
updating_gem = false
|
39
53
|
end
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
# the code above will only UPGRADE existing gem lines, but if this is our
|
58
|
+
# first run, there will be nothing to upgrade, so loop through the GEMS
|
59
|
+
# for any that are not already added and append them
|
60
|
+
GEMS.each { |name, opts|
|
61
|
+
if ! opts['added']
|
62
|
+
t_file.puts opts['line']
|
45
63
|
end
|
46
64
|
}
|
47
|
-
end
|
48
65
|
|
49
|
-
|
50
|
-
|
51
|
-
# for any that are not already added and append them
|
52
|
-
GEMS.each { |name, opts|
|
53
|
-
if ! opts['added']
|
54
|
-
t_file.puts opts['line']
|
55
|
-
end
|
56
|
-
}
|
66
|
+
t_file.close
|
67
|
+
FileUtils.mv(t_file.path, GEMFILE)
|
57
68
|
|
58
|
-
|
59
|
-
|
69
|
+
# miscellanious file updates
|
70
|
+
PDQTest::Skeleton::install_integrations()
|
71
|
+
else
|
72
|
+
Escort::Logger.error.error "Gemfile not found in #{Dir.pwd}"
|
73
|
+
end
|
60
74
|
end
|
61
75
|
|
62
76
|
end
|
data/lib/pdqtest/version.rb
CHANGED
data/res/skeleton/Gemfile
CHANGED
data/res/skeleton/Makefile
CHANGED
data/res/skeleton/dot_travis.yml
CHANGED
@@ -5,10 +5,8 @@ services:
|
|
5
5
|
- docker
|
6
6
|
cache: bundler
|
7
7
|
before_install:
|
8
|
-
-
|
9
|
-
|
8
|
+
- bundle install
|
9
|
+
- bundle exec pdqtest setup
|
10
|
+
script: "make"
|
10
11
|
rvm:
|
11
|
-
- 2.
|
12
|
-
env:
|
13
|
-
matrix:
|
14
|
-
- PUPPET_GEM_VERSION="~> 4.7.0"
|
12
|
+
- 2.3.5
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pdqtest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -303,6 +303,7 @@ files:
|
|
303
303
|
- res/skeleton/Gemfile
|
304
304
|
- res/skeleton/Makefile
|
305
305
|
- res/skeleton/Rakefile
|
306
|
+
- res/skeleton/bitbucket-pipelines.yml
|
306
307
|
- res/skeleton/dot_gitignore
|
307
308
|
- res/skeleton/dot_rspec
|
308
309
|
- res/skeleton/dot_travis.yml
|