specinfra 2.87.1 → 2.88.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: a50ea94541eea4de681f5c0490c0042efaa9d32733e77170a36c395fa9997c36
4
- data.tar.gz: aad5becf5ccb1ba86243f9b53cf402c4409d37e04db03a879ce0f2e7bde4bc9d
3
+ metadata.gz: 5653294259d7e35a26af3b0841cb507c5a7bd69668d022af79f4f32ae7299810
4
+ data.tar.gz: c0c2cef79bb876c01ce2dc8fbb21ab138a6a0e367186c34ba94e7f35772ec12d
5
5
  SHA512:
6
- metadata.gz: 26096c32f4c426f8bcb5d961b3fa988cc2c85bef201a3663424c2482ec5a6d44a2e1e7583a196bfe7227ced8bb75623dff1c105bd9d1eba64d31baeaa8d7b8eb
7
- data.tar.gz: b0f53c294311bc1f3fbe40da1c8d081d89857d2baa3ada13f85de1933148caf3e2dfc060087fd7deb60942a0aaf3c9f0a1151be809d1ef4a3b5bba53ed0846ef
6
+ metadata.gz: 18f97e98b911c4354b87de096cc6af94d8d4c7e793d8fab46ed72cea47b95ee4803cce160e2dcd54d7c61e3b076877018d904641050d99fa28b3a354afff4a58
7
+ data.tar.gz: 14eebac1837c79a17e352eada2496dbea730463de4a94782fe366e6f72f172e37715ec7c6068bc1c63259882f0865124f8fafc12d61171e6dc586b2d8c462acf
data/README.md CHANGED
@@ -20,6 +20,11 @@ Or install it yourself as:
20
20
  gem install specinfra
21
21
  ```
22
22
 
23
+ For Ruby versions older than 2.3.0, pin net-telnet to version 0.1.1 in your `Gemfile` or `*.gemspec`.
24
+ See also [pin net-telnet dependency to keep ruby support for < 2.3 #665][issue665].
25
+
26
+ [issue665]: https://github.com/mizzy/specinfra/pull/665
27
+
23
28
  ## Running tests
24
29
 
25
30
  ```
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'singleton'
4
+ require 'fileutils'
5
+ require 'shellwords'
6
+ require 'sfl' if Specinfra.ruby_is_older_than?(1, 9, 0)
7
+
8
+ module Specinfra
9
+ module Backend
10
+ # LXD transport
11
+ class Lxd < Exec
12
+ def initialize(config = {})
13
+ super
14
+
15
+ raise 'Please specify lxd_instance' unless (@instance = get_config(:lxd_instance))
16
+ raise 'Please specify lxd_remote' unless (@remote = get_config(:lxd_remote))
17
+
18
+ @remote_instance = [@remote, @instance].compact.join(':')
19
+ end
20
+
21
+ class << self
22
+ protected
23
+
24
+ def run_command(cmd, opts = {})
25
+ cmd = build_command(cmd)
26
+ run_pre_command(opts)
27
+ stdout, stderr, exit_status = with_env do
28
+ spawn_command(cmd)
29
+ end
30
+
31
+ if @example
32
+ @example.metadata[:command] = cmd
33
+ @example.metadata[:stdout] = stdout
34
+ end
35
+
36
+ CommandResult.new :stdout => stdout, :stderr => stderr, :exit_status => exit_status
37
+ end
38
+
39
+ def build_command(cmd)
40
+ cmd = super(cmd)
41
+ "lxc exec #{@remote_instance} -- #{cmd}"
42
+ end
43
+
44
+ def send_file(source, destination)
45
+ flags = %w[--create-dirs]
46
+ if File.directory?(source)
47
+ flags << '--recursive'
48
+ destination = Pathname.new(destination).dirname.to_s
49
+ end
50
+ cmd = %W[lxc file push #{source} #{@remote_instance}#{destination}] + flags
51
+ spawn_command(cmd.join(' '))
52
+ end
53
+
54
+ private
55
+
56
+ def run_pre_command(_opts)
57
+ return unless get_config(:pre_command)
58
+
59
+ cmd = build_command(get_config(:pre_command))
60
+ spawn_command(cmd)
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -6,6 +6,7 @@ require 'specinfra/backend/powershell/command'
6
6
  require 'specinfra/backend/cmd'
7
7
  require 'specinfra/backend/docker'
8
8
  require 'specinfra/backend/lxc'
9
+ require 'specinfra/backend/lxd'
9
10
  require 'specinfra/backend/winrm'
10
11
  require 'specinfra/backend/shell_script'
11
12
  require 'specinfra/backend/dockerfile'
@@ -20,6 +20,8 @@ module Specinfra
20
20
  :docker_image,
21
21
  :docker_url,
22
22
  :lxc,
23
+ :lxd_remote,
24
+ :lxd_instance,
23
25
  :request_pty,
24
26
  :ssh_options,
25
27
  :ssh_without_env,
@@ -1,5 +1,5 @@
1
1
  module Specinfra
2
- VERSION = "2.87.1"
2
+ VERSION = "2.88.0"
3
3
 
4
4
  def self.ruby_is_older_than?(*version)
5
5
  (RUBY_VERSION.split('.').map(&:to_i) <=> version) < 0
@@ -18,7 +18,7 @@ describe Specinfra::Backend::Exec do
18
18
  end
19
19
 
20
20
  it 'should escape quotes' do
21
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7')
21
+ if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.7')
22
22
  expect(Specinfra.backend.build_command(%Q{find /etc/apt/ -name \*.list | xargs grep -o -E "^deb +[\\"']?http://ppa.launchpad.net/gluster/glusterfs-3.7"})).to eq('/bin/sh -c find\ /etc/apt/\ -name\ \*.list\ \|\ xargs\ grep\ -o\ -E\ \"\^deb\ \+\[\\\\\"\\\'\]\?http://ppa.launchpad.net/gluster/glusterfs-3.7\"')
23
23
  else
24
24
  # Since Ruby 2.7, `+` is not escaped.
data/specinfra.gemspec CHANGED
@@ -21,10 +21,10 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_runtime_dependency "net-scp"
23
23
  spec.add_runtime_dependency "net-ssh", ">= 2.7"
24
- spec.add_runtime_dependency "net-telnet", *(Specinfra.ruby_is_older_than?(2, 3, 0) ? ["0.1.1"] : [])
25
- spec.add_runtime_dependency "sfl" if Specinfra.ruby_is_older_than?(1, 9, 0)
24
+ spec.add_runtime_dependency "net-telnet" # intentionally version-unspecified for Ruby older than 2.3.0
25
+ spec.add_runtime_dependency "sfl" # required for Ruby older than 1.9.0
26
26
 
27
- spec.add_development_dependency "rake", "~> 10.1.1"
27
+ spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency "rspec"
29
29
  spec.add_development_dependency "rspec-its"
30
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.87.1
4
+ version: 2.88.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gosuke Miyashita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-16 00:00:00.000000000 Z
11
+ date: 2024-02-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
@@ -52,20 +52,34 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: sfl
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: rake
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
- - - "~>"
73
+ - - ">="
60
74
  - !ruby/object:Gem::Version
61
- version: 10.1.1
75
+ version: '0'
62
76
  type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
- - - "~>"
80
+ - - ">="
67
81
  - !ruby/object:Gem::Version
68
- version: 10.1.1
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: rspec
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +128,7 @@ files:
114
128
  - lib/specinfra/backend/exec.rb
115
129
  - lib/specinfra/backend/jexec.rb
116
130
  - lib/specinfra/backend/lxc.rb
131
+ - lib/specinfra/backend/lxd.rb
117
132
  - lib/specinfra/backend/powershell/command.rb
118
133
  - lib/specinfra/backend/powershell/script_helper.rb
119
134
  - lib/specinfra/backend/powershell/support/check_file_access_rules.ps1