onceover 3.17.3 → 3.18.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
  SHA256:
3
- metadata.gz: be95e88779b3bfcb8ddc7a5853bda5071e93496291392f82858d1926c5458b0e
4
- data.tar.gz: 88685f7d52856b853877d88aaceb84f186c038c71a150feee2f06a504a76329a
3
+ metadata.gz: 994971aad52879b6500defdb15dd34f2959d1ec86112712e3fb9c02f1b25ff27
4
+ data.tar.gz: 9de0f213683ad7c635f6bde6e233de5c0b7a5a52e9947f8ccf7ae8fdb78b3819
5
5
  SHA512:
6
- metadata.gz: 65da2aa70b9b0e64fbb97e829ce8212e154ecfb530b244bdf4d7871abe1c48171e4bc4af67614fb87ec089d75000ce6d2df173a2db5d558f1431338179fe6475
7
- data.tar.gz: 339ea513c72bfe4f516684069ce19d71577ec9a38677abacd322bf5ec6deb9a71292fa568f721fe06b0878254f8722918b198ae941d8a33a206488bdcac6c150
6
+ metadata.gz: d078f45a54c3ec3df4a76907979c460825ccf5436be101524640f6e523272196564fb138431e7e96c7c67a3b291640f35f1de237edf952083a1e2e494c95bcf3
7
+ data.tar.gz: edc3120fab568247708a2810fe01074ee6f00c87bf894fa74cdfa3e5478c8a8a21312a60d7f6862b0c615cb377df71eea7506a84aa997a2529c349f0f2b260e7
data/README.md CHANGED
@@ -231,6 +231,13 @@ It's important to note that in order to reference a group using the *include/exc
231
231
 
232
232
  One or many tags that tests in this group should be tagged with. This allows you to run only certain tests using the `--tags` command line parameter. **NOTE:** Custom spec tests will always be run as they are not subject to tags
233
233
 
234
+ **include_spec_files** *Default: [**/*]*
235
+
236
+ Glob to select additionnal files to be run during `onceover` spec tests.
237
+
238
+ Default is to select all files located in the repo spec directory, usually `spec/`.
239
+ If you have some RSpec tests that depend on a different RSpec configuration than `onceover` or want, for example, to have a different job in your CI to run your own unit tests, you can use this option to select which spec files to run during `onceover` spec tests.
240
+
234
241
  ### factsets
235
242
 
236
243
  This gem comes with a few pre-canned factsets. These are listed under the `nodes` sections of `onceover.yaml` when you run `onceover init`. You can also add your own factsets by putting them in:
@@ -702,4 +709,5 @@ Cheers to all of those who helped out:
702
709
  - @alexjfisher
703
710
  - @smortex
704
711
  - @16c7x
712
+ - @neomilium
705
713
 
@@ -24,8 +24,8 @@ class Onceover
24
24
  FileUtils.mkdir_p("#{@repo.tempdir}/spec/classes")
25
25
  FileUtils.mkdir_p("#{@repo.tempdir}/spec/acceptance/nodesets")
26
26
 
27
- # Copy our entire spec directory over
28
- FileUtils.cp_r("#{@repo.spec_dir}", "#{@repo.tempdir}")
27
+ # Copy specified spec files over
28
+ @config.copy_spec_files(@repo)
29
29
 
30
30
  # Create the Rakefile so that we can take advantage of the existing tasks
31
31
  @config.write_rakefile(@repo.tempdir, "spec/classes/**/*_spec.rb")
@@ -50,6 +50,7 @@ class Onceover
50
50
  @before_conditions = config['before'] || []
51
51
  @after_conditions = config['after']
52
52
  @strict_variables = opts[:strict_variables] ? 'yes' : 'no'
53
+ @included_specs = [config['include_spec_files'] || ['**/*']].flatten
53
54
 
54
55
  # Set dynamic defaults for format
55
56
  if Array(opts[:format]) == [:defaults]
@@ -236,6 +237,19 @@ class Onceover
236
237
  )
237
238
  end
238
239
 
240
+ def copy_spec_files(repo)
241
+ source_files = @included_specs.map { |glob| Dir.glob "#{repo.spec_dir}/#{glob}" }.flatten.uniq
242
+ source_files.each do |source_file|
243
+ target_file = File.join(repo.tempdir, 'spec', source_file.sub(/^#{repo.spec_dir}/, ''))
244
+ if File.directory?(source_file)
245
+ FileUtils.cp_r source_file, target_file unless File.exists? target_file
246
+ else
247
+ FileUtils.mkdir_p File.dirname target_file
248
+ FileUtils.cp source_file, target_file
249
+ end
250
+ end
251
+ end
252
+
239
253
  def create_fixtures_symlinks(repo)
240
254
  logger.debug "Creating fixtures symlinks"
241
255
  FileUtils.rm_rf("#{repo.tempdir}/spec/fixtures/modules")
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
4
4
 
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "onceover"
7
- s.version = "3.17.3"
7
+ s.version = "3.18.0"
8
8
  s.authors = ["Dylan Ratcliffe"]
9
9
  s.email = ["dylan.ratcliffe@puppet.com"]
10
10
  s.homepage = "https://github.com/dylanratcliffe/onceover"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onceover
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.17.3
4
+ version: 3.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Ratcliffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-17 00:00:00.000000000 Z
11
+ date: 2020-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backticks