Class: VagrantPlugins::ServerSpec::Provisioner
- Inherits:
-
Object
- Object
- VagrantPlugins::ServerSpec::Provisioner
- Defined in:
- lib/vagrant-serverspec/provisioner.rb
Instance Method Summary collapse
-
#initialize(machine, config) ⇒ Provisioner
constructor
A new instance of Provisioner.
- #provision ⇒ Object
Constructor Details
#initialize(machine, config) ⇒ Provisioner
Returns a new instance of Provisioner.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vagrant-serverspec/provisioner.rb', line 9 def initialize(machine, config) super(machine, config) @spec_files = config.spec_files RSpec.configure do |spec| spec.before :all do ssh_host = machine.ssh_info[:host] ssh_username = machine.ssh_info[:username] ssh_opts = Net::SSH::Config.for(machine.ssh_info[:host]) ssh_opts[:port] = machine.ssh_info[:port] ssh_opts[:forward_agent] = machine.ssh_info[:forward_agent] ssh_opts[:keys] = machine.ssh_info[:private_key_path] spec.ssh = Net::SSH.start(ssh_host, ssh_username, ssh_opts) end spec.after :all do spec.ssh.close if spec.ssh && !spec.ssh.closed? end end end |
Instance Method Details
#provision ⇒ Object
32 33 34 |
# File 'lib/vagrant-serverspec/provisioner.rb', line 32 def provision RSpec::Core::Runner.run(@spec_files) end |