pdqtest 0.9.0 → 0.10.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: 59cfe8a4a7a28734f02acac84965152cb9e28197
4
- data.tar.gz: 1b70cf001fc4a3b622990c0f128ff4a6099800e6
3
+ metadata.gz: 1486e70fe329976fc281d23baeb85cd441865254
4
+ data.tar.gz: 9208d08425b7b9890fc8d41e519d2ef2777b0dec
5
5
  SHA512:
6
- metadata.gz: 364b23efc25433b0cf82a4d4c4f3e1d91302f90daffad172cc462905254c5cab2626b0512a5940048b693cee7bdc199b18f37c56dd6e6d94d78151a79b7ed6ed
7
- data.tar.gz: d0b0a259cfcbb34dc9f157405a1fbafb45f54e52b6465ac531006c64133a37384487b978a1258d59e46039ce4a9db79bc0c0fe0bbefd20fd3ef9c16ee79b9732
6
+ metadata.gz: d10dfb2cac8a5db32c04fb7376632be1c735cff13b0d2b8d01a40bdf3815e9b4e26734d573d9a6ff26627354325361c72d8964f3df3db6abdcdd731626f4af60
7
+ data.tar.gz: 473d65b5bb0ee3f737164908f2ec25703418e80ed44f6aa813dafab5cdf08d76287ef990341fcd557cd49fa6812ffdc903168ab949fe80f236ebc084543fc246
@@ -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
- FileUtils.mv(FIXTURES, FIXTURES + BACKUP_EXT)
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$/, '')
@@ -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
- File.open(GEMFILE, 'r') do |f|
24
- f.each_line{ |line|
25
- if line =~ GEM_REGEXP
26
- # a gem stanza
27
- processing_gem = $2
28
- if GEMS.keys.include?(processing_gem)
29
- # fixup one of our monitored gems as needed, mark
30
- # this as being a gem that is being updated so
31
- # that we can kill any multi-line attributes
32
- t_file.puts GEMS[processing_gem]['line']
33
- updating_gem = true
34
- GEMS[processing_gem]['added'] = true
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
- # a gem we don't care about - write it out as-is
51
+ # anything else... (esp comments)
37
52
  t_file.puts line
38
- updating_gem = false
39
53
  end
40
- elsif updating_gem and line =~ GEM_ATTRIB_REGEXP
41
- # do nothing - remove the multi-line attributes
42
- else
43
- # anything else... (esp comments)
44
- t_file.puts line
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
- # the code above will only UPGRADE existing gem lines, but if this is our
50
- # first run, there will be nothing to upgrade, so loop through the GEMS
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
- t_file.close
59
- FileUtils.mv(t_file.path, GEMFILE)
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
@@ -1,3 +1,4 @@
1
1
  module PDQTest
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
+ PUPPET_VERSION = "4.10.8"
3
4
  end
data/res/skeleton/Gemfile CHANGED
@@ -3,7 +3,6 @@ case RUBY_PLATFORM
3
3
  when /darwin/
4
4
  gem 'CFPropertyList'
5
5
  end
6
- gem 'puppet', '4.10.8'
7
6
  gem 'facter', '2.5.1'
8
7
  gem 'rubocop', '0.50.0'
9
8
  gem 'rspec-puppet-facts', '1.7.0'
@@ -4,3 +4,8 @@ all:
4
4
 
5
5
  shell:
6
6
  bundle exec pdqtest --keep-container acceptance
7
+
8
+ logical:
9
+ bundle exec pdqtest syntax
10
+ bundle exec pdqtest lint
11
+ bundle exec pdqtest rspec
@@ -0,0 +1,16 @@
1
+ image: ruby:2.3.5
2
+
3
+ pipelines:
4
+ default:
5
+ - step:
6
+ caches:
7
+ - bundler
8
+ script:
9
+ - ruby --version
10
+ - bundler --version
11
+ - bundle install
12
+ - make logical
13
+
14
+ definitions:
15
+ caches:
16
+ bundler: vendor/bundle
@@ -5,10 +5,8 @@ services:
5
5
  - docker
6
6
  cache: bundler
7
7
  before_install:
8
- - gem update bundler
9
- script: "bundle exec pdqtest setup && bundle exec pdqtest all"
8
+ - bundle install
9
+ - bundle exec pdqtest setup
10
+ script: "make"
10
11
  rvm:
11
- - 2.2.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.9.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-09-25 00:00:00.000000000 Z
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