chef-cleanroom 1.0.4 → 1.0.5

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: fe324b859b76d7f43d65406d899c590a69e390a9c7a10aa26a6730ecff2670cb
4
- data.tar.gz: 5ebf7b68e0fe6b4db5f2d0276ee6bc622b8676f4dbe48c14d964b95fda31e068
3
+ metadata.gz: e42a72a1052b8b5ccc5f43b721182480ca7f2c3ba3a101b2374cfbc736955922
4
+ data.tar.gz: fbd9245605d08efe5c31a5cc857835f9906dfa73bb869630a520b125b223f0cb
5
5
  SHA512:
6
- metadata.gz: b105701d7264cffa6c16aadf6a2ab523152cde8f94660ee8c4371cc9b3c00c04415132cd6ffd9f8c3755690fe8af4f1debe2c1223500a5f4809ef92a33ee108a
7
- data.tar.gz: b517ddb8d179aa7b559de16335b34a8b44871450710f8910d164be31ff9760fbd0e380688952736fd1118ca192db1ec85f2724092fe8871c19886b0c8e444e63
6
+ metadata.gz: 61caf5f3663b6787fd5e66682b4c7fbb1133d5f1bba091449bfe295045184669327f053431d10759c0ce5e44048aedd3e60bd17bd1f8dd0eef89673d1b2dfbb2
7
+ data.tar.gz: ddc69a1d4aaf3567d9ce6963003980ad11485d703f60bb271f5d73f640f2788607e68ae5096e47c365268753855750b5ce81ad4e28c39f04f1fb532b9cf18a7e
@@ -0,0 +1,17 @@
1
+ Write-Output "--- system details"
2
+ $Properties = 'Caption', 'CSName', 'Version', 'BuildType', 'OSArchitecture'
3
+ Get-CimInstance Win32_OperatingSystem | Select-Object $Properties | Format-Table -AutoSize
4
+
5
+ ruby -v
6
+ If ($lastexitcode -ne 0) { Throw $lastexitcode }
7
+
8
+ bundle --version
9
+ If ($lastexitcode -ne 0) { Throw $lastexitcode }
10
+
11
+ Write-Output "--- bundle install"
12
+ bundle install
13
+ If ($lastexitcode -ne 0) { Throw $lastexitcode }
14
+
15
+ Write-Output "+++ bundle exec rake"
16
+ bundle exec rake unit functional
17
+ If ($lastexitcode -ne 0) { Throw $lastexitcode }
@@ -0,0 +1,12 @@
1
+ #!/bin/bash
2
+
3
+ set -ue
4
+
5
+ export USER="root"
6
+
7
+ echo "--- bundle install"
8
+ bundle config --local path vendor/bundle
9
+ bundle install --jobs=7 --retry=3
10
+
11
+ echo "+++ bundle exec task"
12
+ bundle exec rake
@@ -0,0 +1,46 @@
1
+ # Documentation available at https://expeditor.chef.io/docs/getting-started/
2
+ ---
3
+
4
+ project:
5
+ alias: chef-cleanroom
6
+
7
+ # Slack channel in Chef Software slack to send notifications about build failures, etc
8
+ slack:
9
+ notify_channel: releng-notify
10
+
11
+ # This publish is triggered by the `built_in:publish_rubygems` artifact_action.
12
+ rubygems:
13
+ - chef-cleanroom
14
+
15
+ github:
16
+ # This deletes the GitHub PR branch after successfully merged into the release branch
17
+ delete_branch_on_merge: true
18
+ # The tag format to use (e.g. v1.0.0)
19
+ version_tag_format: "v{{version}}"
20
+ # allow bumping the minor release via label
21
+ minor_bump_labels:
22
+ - "Expeditor: Bump Version Minor"
23
+ # allow bumping the major release via label
24
+ major_bump_labels:
25
+ - "Expeditor: Bump Version Major"
26
+
27
+ subscriptions:
28
+ # These actions are taken, in order they are specified, anytime a Pull Request is merged.
29
+ - workload: pull_request_merged:{{github_repo}}:{{release_branch}}:*
30
+ actions:
31
+ - built_in:bump_version:
32
+ ignore_labels:
33
+ - "Expeditor: Skip Version Bump"
34
+ - "Expeditor: Skip All"
35
+ - bash:.expeditor/update_version.sh:
36
+ only_if: built_in:bump_version
37
+ - built_in:build_gem:
38
+ only_if: built_in:bump_version
39
+
40
+ - workload: project_promoted:{{agent_id}}:*
41
+ actions:
42
+ - built_in:publish_rubygems
43
+
44
+ pipelines:
45
+ - verify:
46
+ description: Pull Request validation tests
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+ #
3
+ # After a PR merge, Chef Expeditor will bump the PATCH version in the VERSION file.
4
+ # It then executes this file to update any other files/components with that new version.
5
+ #
6
+
7
+ set -evx
8
+
9
+ sed -i -r "s/^(\s*)VERSION = \".+\"/\1VERSION = \"$(cat VERSION)\"/" lib/cleanroom/version.rb
10
+
11
+ # Once Expeditor finishes executing this script, it will commit the changes and push
12
+ # the commit as a new tag corresponding to the value in the VERSION file.
@@ -0,0 +1,52 @@
1
+ ---
2
+ expeditor:
3
+ defaults:
4
+ buildkite:
5
+ retry:
6
+ automatic:
7
+ limit: 1
8
+ timeout_in_minutes: 30
9
+
10
+ steps:
11
+
12
+ - label: run-lint-and-specs-ruby-2.7
13
+ command:
14
+ - .expeditor/buildkite/verify.sh
15
+ expeditor:
16
+ cached_folders:
17
+ - vendor
18
+ executor:
19
+ docker:
20
+ image: ruby:2.7-buster
21
+
22
+ - label: run-lint-and-specs-ruby-3.0
23
+ command:
24
+ - .expeditor/buildkite/verify.sh
25
+ expeditor:
26
+ cached_folders:
27
+ - vendor
28
+ executor:
29
+ docker:
30
+ image: ruby:3.0-buster
31
+
32
+ - label: run-lint-and-specs-ruby-3.1
33
+ command:
34
+ - .expeditor/buildkite/verify.sh
35
+ expeditor:
36
+ cached_folders:
37
+ - vendor
38
+ executor:
39
+ docker:
40
+ image: ruby:3.1-buster
41
+
42
+ - label: ":windows: :ruby:"
43
+ command:
44
+ - /workdir/.expeditor/buildkite/verify.ps1
45
+ expeditor:
46
+ cached_folders:
47
+ - vendor
48
+ executor:
49
+ docker:
50
+ host_os: windows
51
+ image: rubydistros/windows-2019:3.1
52
+ shell: ["powershell", "-Command"]
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format documentation
3
+ --require spec_helper
4
+ --exclude-pattern spec/fixtures/**/*
data/.rubocop.yml ADDED
@@ -0,0 +1,5 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.5
3
+ Exclude:
4
+ - 'spec/fixtures/**/*'
5
+ - 'vendor/**/*'
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
  gemspec
data/Rakefile CHANGED
@@ -1,19 +1,24 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
2
 
3
- require 'rspec/core/rake_task'
4
- [:unit, :functional].each do |type|
3
+ require "rspec/core/rake_task"
4
+ %i{unit functional}.each do |type|
5
5
  RSpec::Core::RakeTask.new(type) do |t|
6
6
  t.pattern = "spec/#{type}/**/*_spec.rb"
7
7
  t.rspec_opts = [].tap do |a|
8
- a.push('--color')
9
- a.push('--format progress')
10
- end.join(' ')
8
+ a.push("--color")
9
+ a.push("--format progress")
10
+ end.join(" ")
11
11
  end
12
12
  end
13
13
 
14
- namespace :travis do
15
- desc 'Run tests on Travis'
16
- task ci: %w(unit functional)
14
+ require "chefstyle"
15
+ require "rubocop/rake_task"
16
+ desc "Run Chefstyle tests"
17
+ RuboCop::RakeTask.new(:style) do |task|
18
+ task.options += ["--display-cop-names", "--no-color"]
17
19
  end
18
20
 
19
- task default: %w(travis:ci)
21
+ desc "Run all tests"
22
+ task test: %i{style unit functional}
23
+
24
+ task default: :test
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.5
@@ -1,15 +1,14 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'cleanroom'
3
+ require "cleanroom"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
- spec.name = 'chef-cleanroom'
6
+ spec.name = "chef-cleanroom"
8
7
  spec.version = Cleanroom::VERSION
9
- spec.author = 'Seth Vargo'
10
- spec.email = 'sethvargo@gmail.com'
11
- spec.summary = '(More) safely evaluate Ruby DSLs with cleanroom'
12
- spec.description = <<-EOH.gsub(/^ {4}/, '').gsub(/\r?\n/, ' ').strip
8
+ spec.author = "Seth Vargo"
9
+ spec.email = "sethvargo@gmail.com"
10
+ spec.summary = "(More) safely evaluate Ruby DSLs with cleanroom"
11
+ spec.description = <<-EOH.gsub(/^ {4}/, "").gsub(/\r?\n/, " ").strip
13
12
  Ruby is an excellent programming language for creating and managing custom
14
13
  DSLs, but how can you securely evaluate a DSL while explicitly controlling
15
14
  the methods exposed to the user? Our good friends instance_eval and
@@ -20,18 +19,19 @@ Gem::Specification.new do |spec|
20
19
  limiting the information exposed by a DSL while giving users the ability to
21
20
  write awesome code!
22
21
  EOH
23
- spec.homepage = 'https://github.com/chef/cleanroom'
24
- spec.license = 'Apache-2.0'
22
+ spec.homepage = "https://github.com/chef/cleanroom"
23
+ spec.license = "Apache-2.0"
25
24
 
26
- spec.required_ruby_version = '>= 1.9.3'
25
+ spec.required_ruby_version = ">= 1.9.3"
27
26
 
28
27
  spec.files = `git ls-files -z`.split("\x0")
29
28
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
30
29
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
31
- spec.require_paths = ['lib']
30
+ spec.require_paths = ["lib"]
32
31
 
33
- spec.add_development_dependency 'rspec', '~> 3.0'
32
+ spec.add_development_dependency "rspec", "~> 3.0"
34
33
 
35
- spec.add_development_dependency 'bundler'
36
- spec.add_development_dependency 'rake'
34
+ spec.add_development_dependency "bundler"
35
+ spec.add_development_dependency "chefstyle"
36
+ spec.add_development_dependency "rake"
37
37
  end
@@ -23,11 +23,11 @@ module Cleanroom
23
23
  end
24
24
 
25
25
  def to_s
26
- <<-EOH.gsub(/\r?\n/, ' ')
26
+ <<-EOH.gsub(/\r?\n/, " ")
27
27
  Undefined local variable or method `#{@name}' for #{@instance}. It may have
28
28
  been removed for the purposes of evaluating the DSL or for added security. If
29
29
  you feel you have reached this message in error, please open an issue.
30
- EOH
30
+ EOH
31
31
  end
32
32
  end
33
33
  end
@@ -14,10 +14,10 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require_relative '../cleanroom'
17
+ require_relative "../cleanroom"
18
18
 
19
19
  unless defined?(RSpec)
20
- require 'rspec'
20
+ require "rspec"
21
21
  end
22
22
 
23
23
  #
@@ -20,5 +20,5 @@ module Cleanroom
20
20
  #
21
21
  # @return [String]
22
22
  #
23
- VERSION = '1.0.4'
23
+ VERSION = "1.0.5".freeze
24
24
  end
data/lib/cleanroom.rb CHANGED
@@ -14,8 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require_relative 'cleanroom/errors'
18
- require_relative 'cleanroom/version'
17
+ require_relative "cleanroom/errors"
18
+ require_relative "cleanroom/version"
19
19
 
20
20
  module Cleanroom
21
21
  #
@@ -102,7 +102,7 @@ module Cleanroom
102
102
  #
103
103
  def cleanroom
104
104
  exposed = exposed_methods.keys
105
- parent = self.name || 'Anonymous'
105
+ parent = name || "Anonymous"
106
106
 
107
107
  Class.new(Object) do
108
108
  class << self
@@ -126,8 +126,8 @@ module Cleanroom
126
126
  end
127
127
 
128
128
  exposed.each do |exposed_method|
129
- define_method(exposed_method) do |*args, &block|
130
- __instance__.public_send(exposed_method, *args, &block)
129
+ define_method(exposed_method) do |*args, **kwargs, &block|
130
+ __instance__.public_send(exposed_method, *args, **kwargs, &block)
131
131
  end
132
132
  end
133
133
 
@@ -155,6 +155,7 @@ module Cleanroom
155
155
  #
156
156
  def from_superclass(m, default = nil)
157
157
  return default if superclass == Cleanroom
158
+
158
159
  superclass.respond_to?(m) ? superclass.send(m) : default
159
160
  end
160
161
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Cleanroom do
4
4
  let(:klass) do
@@ -33,56 +33,56 @@ describe Cleanroom do
33
33
 
34
34
  let(:instance) { klass.new }
35
35
 
36
- describe '#evaluate_file' do
37
- let(:path) { tmp_path('file.rb') }
36
+ describe "#evaluate_file" do
37
+ let(:path) { tmp_path("file.rb") }
38
38
 
39
39
  before do
40
- File.open(path, 'w') do |f|
41
- f.write <<-EOH.gsub(/^ {10}/, '')
40
+ File.open(path, "w") do |f|
41
+ f.write <<-EOH.gsub(/^ {10}/, "")
42
42
  method_1 'hello'
43
43
  method_2 false
44
44
  EOH
45
45
  end
46
46
  end
47
47
 
48
- it 'evaluates the file' do
48
+ it "evaluates the file" do
49
49
  instance.evaluate_file(path)
50
- expect(instance.method_1).to eq('hello')
50
+ expect(instance.method_1).to eq("hello")
51
51
  expect(instance.method_2).to be(false)
52
52
  end
53
53
  end
54
54
 
55
- describe '#evaluate' do
55
+ describe "#evaluate" do
56
56
  let(:contents) do
57
- <<-EOH.gsub(/^ {8}/, '')
57
+ <<-EOH.gsub(/^ {8}/, "")
58
58
  method_1 'hello'
59
59
  method_2 false
60
60
  EOH
61
61
  end
62
62
 
63
- it 'evaluates the file' do
63
+ it "evaluates the file" do
64
64
  instance.evaluate(contents)
65
- expect(instance.method_1).to eq('hello')
65
+ expect(instance.method_1).to eq("hello")
66
66
  expect(instance.method_2).to be(false)
67
67
  end
68
68
  end
69
69
 
70
- describe 'security' do
71
- it 'restricts access to __instance__' do
70
+ describe "security" do
71
+ it "restricts access to __instance__" do
72
72
  expect {
73
73
  instance.evaluate("__instance__")
74
74
  }.to raise_error(Cleanroom::InaccessibleError)
75
75
  end
76
76
 
77
- it 'restricts access to __instance__ using :send' do
77
+ it "restricts access to __instance__ using :send" do
78
78
  expect {
79
79
  instance.evaluate("send(:__instance__)")
80
80
  }.to raise_error(Cleanroom::InaccessibleError)
81
81
  end
82
82
 
83
- it 'restricts access to defining new methods' do
83
+ it "restricts access to defining new methods" do
84
84
  expect {
85
- instance.evaluate <<-EOH.gsub(/^ {12}/, '')
85
+ instance.evaluate <<-EOH.gsub(/^ {12}/, "")
86
86
  self.class.class_eval do
87
87
  def new_method
88
88
  __instance__.method_3
data/spec/spec_helper.rb CHANGED
@@ -1,7 +1,7 @@
1
- require 'rspec'
2
- require 'fileutils'
1
+ require "rspec"
2
+ require "fileutils"
3
3
 
4
- require 'cleanroom'
4
+ require "cleanroom"
5
5
 
6
6
  RSpec.configure do |config|
7
7
  config.filter_run(focus: true)
@@ -19,7 +19,7 @@ RSpec.configure do |config|
19
19
  end
20
20
 
21
21
  # Run specs in a random order
22
- config.order = 'random'
22
+ config.order = "random"
23
23
  end
24
24
 
25
25
  #
@@ -31,6 +31,5 @@ end
31
31
  # @return [String]
32
32
  #
33
33
  def tmp_path(*paths)
34
- root = File.expand_path('../..', __FILE__)
35
- File.join('tmp', *paths)
34
+ File.join("tmp", *paths)
36
35
  end
@@ -1,4 +1,4 @@
1
- require 'spec_helper'
1
+ require "spec_helper"
2
2
 
3
3
  describe Cleanroom do
4
4
  let(:klass) do
@@ -16,33 +16,33 @@ describe Cleanroom do
16
16
 
17
17
  let(:instance) { klass.new }
18
18
 
19
- describe '.included' do
19
+ describe ".included" do
20
20
  let(:klass) { Class.new { include Cleanroom } }
21
21
 
22
- it 'extends the ClassMethods' do
22
+ it "extends the ClassMethods" do
23
23
  expect(klass).to be_a(Cleanroom::ClassMethods)
24
24
  end
25
25
 
26
- it 'includes the InstanceMethods' do
26
+ it "includes the InstanceMethods" do
27
27
  expect(instance).to be_a(Cleanroom::InstanceMethods)
28
28
  end
29
29
  end
30
30
 
31
- describe '.extended' do
31
+ describe ".extended" do
32
32
  let(:klass) { Class.new { extend Cleanroom } }
33
33
 
34
- it 'extends the ClassMethods' do
34
+ it "extends the ClassMethods" do
35
35
  expect(klass).to be_a(Cleanroom::ClassMethods)
36
36
  end
37
37
 
38
- it 'includes the InstanceMethods' do
38
+ it "includes the InstanceMethods" do
39
39
  expect(instance).to be_a(Cleanroom::InstanceMethods)
40
40
  end
41
41
  end
42
42
 
43
- describe '.evaluate_file' do
44
- let(:path) { '/path/to/file' }
45
- let(:contents) { 'contents' }
43
+ describe ".evaluate_file" do
44
+ let(:path) { "/path/to/file" }
45
+ let(:contents) { "contents" }
46
46
 
47
47
  before do
48
48
  allow(File).to receive(:expand_path)
@@ -56,25 +56,25 @@ describe Cleanroom do
56
56
  allow(klass).to receive(:evaluate)
57
57
  end
58
58
 
59
- it 'gets the absolute path to the file' do
59
+ it "gets the absolute path to the file" do
60
60
  expect(File).to receive(:expand_path).with(path).once
61
61
  klass.evaluate_file(instance, path)
62
62
  end
63
63
 
64
- it 'reads the contents to a string' do
64
+ it "reads the contents to a string" do
65
65
  expect(IO).to receive(:read).with(path).once
66
66
  klass.evaluate_file(instance, path)
67
67
  end
68
68
 
69
- it 'evaluates the contents' do
69
+ it "evaluates the contents" do
70
70
  expect(klass).to receive(:evaluate).with(instance, contents, path, 1).once
71
71
  klass.evaluate_file(instance, path)
72
72
  end
73
73
  end
74
74
 
75
- describe '.evaluate' do
76
- let(:cleanroom) { double('Cleanroom.cleanroom') }
77
- let(:cleanroom_instance) { double('Cleanroom.cleanroom_instance') }
75
+ describe ".evaluate" do
76
+ let(:cleanroom) { double("Cleanroom.cleanroom") }
77
+ let(:cleanroom_instance) { double("Cleanroom.cleanroom_instance") }
78
78
 
79
79
  let(:string) { '"hello"' }
80
80
 
@@ -89,18 +89,18 @@ describe Cleanroom do
89
89
  .and_return(cleanroom)
90
90
  end
91
91
 
92
- it 'creates a new cleanroom object' do
92
+ it "creates a new cleanroom object" do
93
93
  expect(cleanroom).to receive(:new).with(instance).once
94
94
  klass.evaluate(instance, string)
95
95
  end
96
96
 
97
- it 'evaluates against the new cleanroom object' do
97
+ it "evaluates against the new cleanroom object" do
98
98
  expect(cleanroom_instance).to receive(:instance_eval).with(string).once
99
99
  klass.evaluate(instance, string)
100
100
  end
101
101
  end
102
102
 
103
- describe '.expose' do
103
+ describe ".expose" do
104
104
  let(:klass) do
105
105
  Class.new do
106
106
  include Cleanroom
@@ -108,38 +108,40 @@ describe Cleanroom do
108
108
  def public_method; end
109
109
 
110
110
  protected
111
+
111
112
  def protected_method; end
112
113
 
113
114
  private
115
+
114
116
  def private_method; end
115
117
  end
116
118
  end
117
119
 
118
- it 'exposes the method when it is public' do
120
+ it "exposes the method when it is public" do
119
121
  expect { klass.expose(:public_method) }.to_not raise_error
120
122
  expect(klass.exposed_methods).to include(:public_method)
121
123
  end
122
124
 
123
- it 'raises an exception if the method is not defined' do
125
+ it "raises an exception if the method is not defined" do
124
126
  expect { klass.expose(:no_method) }.to raise_error(NameError)
125
127
  end
126
128
 
127
- it 'raises an exception if the method is protected' do
129
+ it "raises an exception if the method is protected" do
128
130
  expect { klass.expose(:protected_method) }.to raise_error(NameError)
129
131
  end
130
132
 
131
- it 'raises an exception if the method is private' do
133
+ it "raises an exception if the method is private" do
132
134
  expect { klass.expose(:private_method) }.to raise_error(NameError)
133
135
  end
134
136
  end
135
137
 
136
- describe '.exposed_methods' do
137
- it 'returns a hash' do
138
+ describe ".exposed_methods" do
139
+ it "returns a hash" do
138
140
  expect(klass.exposed_methods).to be_a(Hash)
139
141
  end
140
142
  end
141
143
 
142
- describe '.cleanroom' do
144
+ describe ".cleanroom" do
143
145
  let(:klass) do
144
146
  Class.new do
145
147
  include Cleanroom
@@ -156,19 +158,19 @@ describe Cleanroom do
156
158
  end
157
159
  end
158
160
 
159
- it 'creates a new anonymous class each time' do
161
+ it "creates a new anonymous class each time" do
160
162
  a, b = klass.send(:cleanroom), klass.send(:cleanroom)
161
163
  expect(a).to_not be(b)
162
164
  end
163
165
 
164
- it 'creates a method for each exposed one on the proxy object' do
166
+ it "creates a method for each exposed one on the proxy object" do
165
167
  cleanroom = klass.send(:cleanroom)
166
168
 
167
169
  expect(cleanroom).to be_public_method_defined(:method_1)
168
170
  expect(cleanroom).to be_public_method_defined(:method_2)
169
171
  end
170
172
 
171
- it 'calls the proxied method' do
173
+ it "calls the proxied method" do
172
174
  cleanroom = klass.send(:cleanroom).new(instance)
173
175
  cleanroom.method_1
174
176
  cleanroom.method_2
@@ -177,7 +179,7 @@ describe Cleanroom do
177
179
  expect(instance.instance_variable_get(:@method_2)).to be(true)
178
180
  end
179
181
 
180
- it 'prevents calls to the instance directly' do
182
+ it "prevents calls to the instance directly" do
181
183
  cleanroom = klass.send(:cleanroom).new(instance)
182
184
  expect {
183
185
  cleanroom.__instance__
@@ -189,25 +191,25 @@ describe Cleanroom do
189
191
  end
190
192
  end
191
193
 
192
- describe '#evaluate_file' do
193
- let(:path) { '/path/to/file' }
194
+ describe "#evaluate_file" do
195
+ let(:path) { "/path/to/file" }
194
196
 
195
197
  before do
196
198
  allow(klass).to receive(:evaluate_file)
197
199
  .with(instance, path)
198
200
  end
199
201
 
200
- it 'delegates to the class method' do
202
+ it "delegates to the class method" do
201
203
  expect(klass).to receive(:evaluate_file).with(instance, path)
202
204
  instance.evaluate_file(path)
203
205
  end
204
206
 
205
- it 'returns self' do
207
+ it "returns self" do
206
208
  expect(instance.evaluate_file(path)).to be(instance)
207
209
  end
208
210
  end
209
211
 
210
- describe '#evaluate' do
212
+ describe "#evaluate" do
211
213
  let(:string) { '"hello"' }
212
214
 
213
215
  before do
@@ -215,17 +217,17 @@ describe Cleanroom do
215
217
  .with(instance, string)
216
218
  end
217
219
 
218
- it 'delegates to the class method' do
220
+ it "delegates to the class method" do
219
221
  expect(klass).to receive(:evaluate).with(instance, string)
220
222
  instance.evaluate(string)
221
223
  end
222
224
 
223
- it 'returns self' do
225
+ it "returns self" do
224
226
  expect(instance.evaluate(string)).to be(instance)
225
227
  end
226
228
  end
227
229
 
228
- context 'when evaluating a DSL subclass' do
230
+ context "when evaluating a DSL subclass" do
229
231
  let(:parent) do
230
232
  Class.new do
231
233
  include Cleanroom
@@ -244,19 +246,19 @@ describe Cleanroom do
244
246
 
245
247
  let(:instance) { child.new }
246
248
 
247
- it 'inherits the parent DSL methods' do
249
+ it "inherits the parent DSL methods" do
248
250
  expect {
249
251
  instance.evaluate("parent_method")
250
252
  }.to_not raise_error
251
253
  end
252
254
 
253
- it 'allows for custom DSL methods' do
255
+ it "allows for custom DSL methods" do
254
256
  expect {
255
257
  instance.evaluate("child_method")
256
258
  }.to_not raise_error
257
259
  end
258
260
 
259
- it 'does not change the parent DSL' do
261
+ it "does not change the parent DSL" do
260
262
  expect {
261
263
  parent.new.evaluate("child_method")
262
264
  }.to raise_error(NameError)
@@ -1,7 +1,7 @@
1
- require 'spec_helper'
2
- require 'cleanroom/rspec'
1
+ require "spec_helper"
2
+ require "cleanroom/rspec"
3
3
 
4
- describe 'RSpec matchers' do
4
+ describe "RSpec matchers" do
5
5
  let(:klass) do
6
6
  Class.new do
7
7
  include Cleanroom
@@ -15,61 +15,61 @@ describe 'RSpec matchers' do
15
15
 
16
16
  let(:instance) { klass.new }
17
17
 
18
- describe '#be_an_exposed_method_on' do
19
- context 'when given a class' do
20
- it 'is true when the method is exposed' do
18
+ describe "#be_an_exposed_method_on" do
19
+ context "when given a class" do
20
+ it "is true when the method is exposed" do
21
21
  expect(:method_1).to be_an_exposed_method_on(klass)
22
22
  end
23
23
 
24
- it 'is false when the method exists, but is not exposed' do
24
+ it "is false when the method exists, but is not exposed" do
25
25
  expect(:method_2).to_not be_an_exposed_method_on(klass)
26
26
  end
27
27
 
28
- it 'is false when the method is not exposed' do
28
+ it "is false when the method is not exposed" do
29
29
  expect(:method_3).to_not be_an_exposed_method_on(klass)
30
30
  end
31
31
  end
32
32
 
33
- context 'when given an instance' do
34
- it 'is true when the method is exposed' do
33
+ context "when given an instance" do
34
+ it "is true when the method is exposed" do
35
35
  expect(:method_1).to be_an_exposed_method_on(instance)
36
36
  end
37
37
 
38
- it 'is false when the method exists, but is not exposed' do
38
+ it "is false when the method exists, but is not exposed" do
39
39
  expect(:method_2).to_not be_an_exposed_method_on(instance)
40
40
  end
41
41
 
42
- it 'is false when the method is not exposed' do
42
+ it "is false when the method is not exposed" do
43
43
  expect(:method_3).to_not be_an_exposed_method_on(instance)
44
44
  end
45
45
  end
46
46
  end
47
47
 
48
- describe '#have_exposed_method' do
49
- context 'when given a class' do
50
- it 'is true when the method is exposed' do
48
+ describe "#have_exposed_method" do
49
+ context "when given a class" do
50
+ it "is true when the method is exposed" do
51
51
  expect(klass).to have_exposed_method(:method_1)
52
52
  end
53
53
 
54
- it 'is false when the method exists, but is not exposed' do
54
+ it "is false when the method exists, but is not exposed" do
55
55
  expect(klass).to_not have_exposed_method(:method_2)
56
56
  end
57
57
 
58
- it 'is false when the method is not exposed' do
58
+ it "is false when the method is not exposed" do
59
59
  expect(klass).to_not have_exposed_method(:method_3)
60
60
  end
61
61
  end
62
62
 
63
- context 'when given an instance' do
64
- it 'is true when the method is exposed' do
63
+ context "when given an instance" do
64
+ it "is true when the method is exposed" do
65
65
  expect(instance).to have_exposed_method(:method_1)
66
66
  end
67
67
 
68
- it 'is false when the method exists, but is not exposed' do
68
+ it "is false when the method exists, but is not exposed" do
69
69
  expect(instance).to_not have_exposed_method(:method_2)
70
70
  end
71
71
 
72
- it 'is false when the method is not exposed' do
72
+ it "is false when the method is not exposed" do
73
73
  expect(instance).to_not have_exposed_method(:method_3)
74
74
  end
75
75
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-cleanroom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seth Vargo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-01 00:00:00.000000000 Z
11
+ date: 2022-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: chefstyle
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rake
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -65,13 +79,20 @@ executables: []
65
79
  extensions: []
66
80
  extra_rdoc_files: []
67
81
  files:
82
+ - ".expeditor/buildkite/verify.ps1"
83
+ - ".expeditor/buildkite/verify.sh"
84
+ - ".expeditor/config.yml"
85
+ - ".expeditor/update_version.sh"
86
+ - ".expeditor/verify.pipeline.yml"
68
87
  - ".gitignore"
69
- - ".travis.yml"
88
+ - ".rspec"
89
+ - ".rubocop.yml"
70
90
  - CHANGELOG.md
71
91
  - Gemfile
72
92
  - LICENSE
73
93
  - README.md
74
94
  - Rakefile
95
+ - VERSION
75
96
  - chef-cleanroom.gemspec
76
97
  - lib/cleanroom.rb
77
98
  - lib/cleanroom/errors.rb
@@ -85,7 +106,7 @@ homepage: https://github.com/chef/cleanroom
85
106
  licenses:
86
107
  - Apache-2.0
87
108
  metadata: {}
88
- post_install_message:
109
+ post_install_message:
89
110
  rdoc_options: []
90
111
  require_paths:
91
112
  - lib
@@ -100,8 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
121
  - !ruby/object:Gem::Version
101
122
  version: '0'
102
123
  requirements: []
103
- rubygems_version: 3.2.22
104
- signing_key:
124
+ rubygems_version: 3.3.7
125
+ signing_key:
105
126
  specification_version: 4
106
127
  summary: "(More) safely evaluate Ruby DSLs with cleanroom"
107
128
  test_files:
data/.travis.yml DELETED
@@ -1,12 +0,0 @@
1
- rvm:
2
- - 1.9.3
3
- - 2.0.0
4
- - 2.1
5
-
6
- bundler_args: --jobs 7
7
-
8
- branches:
9
- only:
10
- - master
11
-
12
- script: bundle exec rake travis:ci