Module: RSpecSystem::InternalHelpers Private
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
This is a helper module that exposes some internal helpers used by the main public ones, also the startup and teardown routines.
Instance Method Summary collapse
-
#custom_prefabs_path ⇒ Pathname
private
Return the path to the custom prefabs file.
-
#nodeset ⇒ Pathname
private
Return the path to the nodeset file.
-
#rspec_destroy ⇒ Boolean
private
Defines if a set will be destroyed before and after tests.
-
#rspec_system_config ⇒ Hash
private
Return the nodeset configuration hash.
-
#rspec_system_node_set ⇒ RSpecSystem::NodeSet::Base
private
Return the current nodeset object.
-
#rspec_system_tmp ⇒ Pathname
private
Return the path to the temporary directory.
-
#rspec_virtual_env ⇒ String
private
Grab the type of virtual environment we wish to run these tests in.
-
#start_nodes ⇒ void
private
Start all nodes.
-
#stop_nodes ⇒ void
private
Stop all nodes.
Instance Method Details
#custom_prefabs_path ⇒ Pathname
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the path to the custom prefabs file
18 19 20 |
# File 'lib/rspec-system/internal_helpers.rb', line 18 def custom_prefabs_path Pathname.new(File.(File.join(File.basename(__FILE__), '..', '.prefabs.yml'))) end |
#nodeset ⇒ Pathname
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the path to the nodeset file
11 12 13 |
# File 'lib/rspec-system/internal_helpers.rb', line 11 def nodeset Pathname.new(File.join(File.basename(__FILE__), '..', '.nodeset.yml')) end |
#rspec_destroy ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Defines if a set will be destroyed before and after tests
48 49 50 51 |
# File 'lib/rspec-system/internal_helpers.rb', line 48 def rspec_destroy return false if ENV["RSPEC_DESTROY"] =~ /(no|false)/ return true end |
#rspec_system_config ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the nodeset configuration hash
34 35 36 |
# File 'lib/rspec-system/internal_helpers.rb', line 34 def rspec_system_config YAML.load_file('.nodeset.yml') end |
#rspec_system_node_set ⇒ RSpecSystem::NodeSet::Base
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the current nodeset object
56 57 58 59 60 61 62 |
# File 'lib/rspec-system/internal_helpers.rb', line 56 def rspec_system_node_set setname = ENV['RSPEC_SET'] || rspec_system_config['default_set'] config = rspec_system_config['sets'][setname] = {} [:destroy] = rspec_destroy RSpecSystem::NodeSet.create(setname, config, rspec_virtual_env, custom_prefabs_path, ) end |
#rspec_system_tmp ⇒ Pathname
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Return the path to the temporary directory
25 26 27 28 29 |
# File 'lib/rspec-system/internal_helpers.rb', line 25 def rspec_system_tmp path = ENV["RSPEC_SYSTEM_TMP"] || File.(File.join(File.basename(__FILE__), '..', '.rspec_system')) FileUtils.mkdir_p(path) Pathname.new(path) end |
#rspec_virtual_env ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Grab the type of virtual environment we wish to run these tests in
41 42 43 |
# File 'lib/rspec-system/internal_helpers.rb', line 41 def rspec_virtual_env ENV["RSPEC_VIRTUAL_ENV"] || 'vagrant' end |
#start_nodes ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Start all nodes
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/rspec-system/internal_helpers.rb', line 67 def start_nodes ns = rspec_system_node_set output << "=begin===========================================================\n" output << "\n" output << bold("Starting nodes") << "\n" output << "\n" output << bold("Setname:") << " #{ns.setname}\n" output << bold("Configuration:") << " #{ns.config.pretty_inspect}" output << bold("Virtual Environment:") << " #{ns.env_type}\n" output << bold("Default node:") << " #{ns.default_node.name}\n" output << bold("Destroy node:") << " #{ns.destroy}\n" output << "\n" ns.setup output << "\n" output << "=end=============================================================\n" output << "\n" nil end |
#stop_nodes ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Stop all nodes
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/rspec-system/internal_helpers.rb', line 90 def stop_nodes output << "\n" output << "=begin===========================================================\n" output << "\n" output << bold("Stopping nodes\n") output << "\n" rspec_system_node_set.teardown output << "\n" output << "=end=============================================================\n" nil end |