mirror of
https://github.com/inspec/inspec
synced 2024-11-14 00:47:10 +00:00
Pulling requires out of often called methods.
While debugging this hairy situation, I had hooked require to try to figure out sequencing. These requires were called thousands upon thousands of times, creating a lot of noise and having no benefit other than a possible savings of a few millisecond on an already slow startup. Signed-off-by: Ryan Davis <zenspider@chef.io>
This commit is contained in:
parent
6adf1d2560
commit
f5d35494d9
3 changed files with 3 additions and 3 deletions
|
@ -2,6 +2,7 @@
|
|||
# author: Christoph Hartmann
|
||||
require 'inspec/dsl'
|
||||
require 'inspec/dsl_shared'
|
||||
require 'rspec/core/dsl'
|
||||
|
||||
module Inspec
|
||||
#
|
||||
|
@ -19,7 +20,6 @@ module Inspec
|
|||
# @param [ResourcesDSL] resources_dsl which has all resources to attach
|
||||
# @return [RuleContext] the inner context of rules
|
||||
def self.rule_context(resources_dsl, profile_id)
|
||||
require 'rspec/core/dsl'
|
||||
Class.new(Inspec::Rule) do
|
||||
include RSpec::Core::DSL
|
||||
with_resource_dsl resources_dsl
|
||||
|
|
|
@ -5,6 +5,7 @@ require 'rubygems/version'
|
|||
require 'rubygems/requirement'
|
||||
require 'semverse'
|
||||
require 'utils/spdx'
|
||||
require 'erb'
|
||||
|
||||
module Inspec
|
||||
# Extract metadata.rb information
|
||||
|
@ -198,7 +199,6 @@ module Inspec
|
|||
|
||||
def self.from_yaml(ref, content, profile_id, logger = nil)
|
||||
res = Metadata.new(ref, logger)
|
||||
require 'erb'
|
||||
res.params = YAML.load(ERB.new(content).result)
|
||||
res.content = content
|
||||
finalize(res, profile_id, {}, logger)
|
||||
|
|
|
@ -11,6 +11,7 @@ require 'inspec/metadata'
|
|||
require 'inspec/config'
|
||||
require 'inspec/dependencies/cache'
|
||||
require 'inspec/dist'
|
||||
require 'inspec/runner_rspec'
|
||||
# spec requirements
|
||||
|
||||
module Inspec
|
||||
|
@ -52,7 +53,6 @@ module Inspec
|
|||
@cache = Inspec::Cache.new(@conf[:vendor_cache])
|
||||
|
||||
@test_collector = @conf.delete(:test_collector) || begin
|
||||
require 'inspec/runner_rspec'
|
||||
RunnerRspec.new(@conf)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue