specinfra 2.90.1 → 2.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d6192f34de8d2414c066911812cd4542641339486662cf67cdd02429ce627d1b
4
- data.tar.gz: d6c662a4bb193a898b212af07665aa3f6c91b61f58bd7027873ac16b05837450
3
+ metadata.gz: 41eadf19553cecaad597ee42c1e22757cfcddc9ba88fcd0c7c24a2b95400d426
4
+ data.tar.gz: ddd53b0f9a6750c08bc23aeb3de8b46f4b00f63a74925a3cf85de7d44fd4a194
5
5
  SHA512:
6
- metadata.gz: 268a137b4e34aeecfe587e98cc8fe9dc635d7342d5543f4848c6aa413d82a13015f59d6a12948a9260b41394d7b0c6be110bee1b81c29869b09f84ec8901d2fa
7
- data.tar.gz: 801e515067828d8faa1dfcdd6df2d25ba87da81949b85353bd7bf43dd70bc96ef45c02ad74b59d2395d48ce9414eac933799264af0a5037605e7c17adba21a8f
6
+ metadata.gz: b2aa5d0488509975ad807a8397b9b37d949e1a5526fa67e68a40e557b4a8fd2d688006a78b4816664408799eee6b23108a8224ba0252d75a996ec39b5903826f
7
+ data.tar.gz: 1439700273209ecd261aeb17ed9a6992925d03ddd46f09aba71d85b1def93802dce9b5fa47ed96a7e34c568c5babbc578e1162699f5564271f95a35085ee05ce
@@ -141,7 +141,7 @@ module Specinfra
141
141
  end
142
142
 
143
143
  def with_env
144
- keys = %w[BUNDLER_EDITOR BUNDLE_BIN_PATH BUNDLE_GEMFILE
144
+ keys = %w[BUNDLER_EDITOR BUNDLE_BIN_PATH BUNDLE_GEMFILE BUNDLER_SETUP
145
145
  RUBYOPT GEM_HOME GEM_PATH GEM_CACHE]
146
146
 
147
147
  keys.each { |key| ENV["_SPECINFRA_#{key}"] = ENV[key] ; ENV.delete(key) }
@@ -0,0 +1,11 @@
1
+ module Specinfra
2
+ module Command
3
+ module Module
4
+ module Runit
5
+ include Specinfra::Command::Module::Service::Runit
6
+ extend Specinfra::Command::Module::Service::Delegator
7
+ def_delegator_service_under :runit
8
+ end
9
+ end
10
+ end
11
+ end
@@ -10,6 +10,30 @@ module Specinfra
10
10
  def check_is_enabled_under_runit(service)
11
11
  "test ! -f /etc/sv/#{escape(service)}/down"
12
12
  end
13
+
14
+ def enable_under_runit(service)
15
+ "ln -s /etc/sv/#{service} /var/service/"
16
+ end
17
+
18
+ def disable_under_runit(service)
19
+ "rm /var/service/#{service}"
20
+ end
21
+
22
+ def start_under_runit(service)
23
+ "sv up /var/service/#{service}"
24
+ end
25
+
26
+ def stop_under_runit(service)
27
+ "sv down /var/service/#{service}"
28
+ end
29
+
30
+ def restart_under_runit(service)
31
+ "sv restart /var/service/#{service}"
32
+ end
33
+
34
+ def reload_under_runit(service)
35
+ "sv reload /var/service/#{service}"
36
+ end
13
37
  end
14
38
  end
15
39
  end
@@ -0,0 +1,21 @@
1
+ class Specinfra::Command::Voidlinux::Base::Package < Specinfra::Command::Linux::Base::Package
2
+ class << self
3
+ def check_is_installed(package, version=nil)
4
+ "xbps-query -S #{escape(package)} | grep -q 'state: installed'"
5
+ end
6
+
7
+ alias :check_is_installed_by_xbps :check_is_installed
8
+
9
+ def get_version(package, opts=nil)
10
+ "xbps-query -S #{package} | sed -nE 's/^pkgver: #{package}-([^\)+])/\1/p'"
11
+ end
12
+
13
+ def install(package, version=nil, option='')
14
+ "xbps-install --yes #{package}"
15
+ end
16
+
17
+ def remove(package, option='')
18
+ "xbps-remove --yes #{option} #{package}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ class Specinfra::Command::Voidlinux::Base::Service < Specinfra::Command::Linux::Base::Service
2
+ class << self
3
+ include Specinfra::Command::Module::Runit
4
+ end
5
+ end
@@ -0,0 +1,2 @@
1
+ class Specinfra::Command::Voidlinux::Base < Specinfra::Command::Linux::Base
2
+ end
@@ -0,0 +1,2 @@
1
+ class Specinfra::Command::Voidlinux < Specinfra::Command::Linux
2
+ end
@@ -19,6 +19,7 @@ require 'specinfra/command/module/systemd'
19
19
  require 'specinfra/command/module/zfs'
20
20
  require 'specinfra/command/module/ss'
21
21
  require 'specinfra/command/module/openrc'
22
+ require 'specinfra/command/module/runit'
22
23
 
23
24
  # Base
24
25
  require 'specinfra/command/base'
@@ -407,3 +408,9 @@ require 'specinfra/command/poky/base/interface'
407
408
  require 'specinfra/command/poky/base/inventory'
408
409
  require 'specinfra/command/poky/base/package'
409
410
  require 'specinfra/command/poky/base/service'
411
+
412
+ # VoidLinux (inherit Linux)
413
+ require 'specinfra/command/voidlinux'
414
+ require 'specinfra/command/voidlinux/base'
415
+ require 'specinfra/command/voidlinux/base/package'
416
+ require 'specinfra/command/voidlinux/base/service'
@@ -0,0 +1,11 @@
1
+ class Specinfra::Helper::DetectOs::Voidlinux < Specinfra::Helper::DetectOs
2
+ def detect
3
+ if run_command("ls /etc/os-release").success?
4
+ line = run_command("cat /etc/os-release").stdout
5
+
6
+ if line =~ /^ID="void"/
7
+ { :family => 'voidlinux', :release => nil }
8
+ end
9
+ end
10
+ end
11
+ end
@@ -40,3 +40,4 @@ require 'specinfra/helper/detect_os/poky'
40
40
  require 'specinfra/helper/detect_os/redhat'
41
41
  require 'specinfra/helper/detect_os/solaris'
42
42
  require 'specinfra/helper/detect_os/suse'
43
+ require 'specinfra/helper/detect_os/voidlinux'
@@ -1,5 +1,5 @@
1
1
  module Specinfra
2
- VERSION = "2.90.1"
2
+ VERSION = "2.92.0"
3
3
 
4
4
  def self.ruby_is_older_than?(*version)
5
5
  (RUBY_VERSION.split('.').map(&:to_i) <=> version) < 0
@@ -6,7 +6,7 @@ describe Specinfra.backend.run_command('echo $LANG').stdout.strip do
6
6
  it { should eq 'C' }
7
7
  end
8
8
 
9
- describe do
9
+ describe "override ENV with config(:env)" do
10
10
  before do
11
11
  set :backend, :exec
12
12
 
@@ -18,3 +18,11 @@ describe do
18
18
  it { expect(ENV['LANG']).to eq 'C' }
19
19
  end
20
20
 
21
+ describe "clear env for BUNDLER" do
22
+ before do
23
+ set :backend, :exec
24
+
25
+ ENV['BUNDLER_SETUP'] = 'any-value'
26
+ end
27
+ it { expect(Specinfra.backend.run_command('printenv BUNDLER_SETUP').stdout).to eq '' }
28
+ end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+
3
+ describe Specinfra::Command::Module::Service::Runit do
4
+ class Specinfra::Command::Module::Service::Runit::Test < Specinfra::Command::Base
5
+ extend Specinfra::Command::Module::Service::Runit
6
+ end
7
+ let(:klass) { Specinfra::Command::Module::Service::Runit::Test }
8
+ it { expect(klass.check_is_enabled_under_runit('httpd')).to eq 'test ! -f /etc/sv/httpd/down' }
9
+ it { expect(klass.check_is_running_under_runit('httpd')).to eq "sv status httpd | grep -E '^run: '" }
10
+ it { expect(klass.enable_under_runit('httpd')).to eq 'ln -s /etc/sv/httpd /var/service/' }
11
+ it { expect(klass.disable_under_runit('httpd')).to eq 'rm /var/service/httpd' }
12
+ it { expect(klass.start_under_runit('httpd')).to eq 'sv up /var/service/httpd' }
13
+ it { expect(klass.stop_under_runit('httpd')).to eq 'sv down /var/service/httpd' }
14
+ it { expect(klass.restart_under_runit('httpd')).to eq 'sv restart /var/service/httpd' }
15
+ it { expect(klass.reload_under_runit('httpd')).to eq 'sv reload /var/service/httpd' }
16
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ require 'spec_helper'
4
+
5
+ set :os, { :family => 'voidlinux' }
6
+
7
+ describe get_command(:check_package_is_installed, 'httpd') do
8
+ it { should eq "xbps-query -S httpd | grep -q 'state: installed'" }
9
+ end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'voidlinux'
5
+
6
+ describe get_command(:enable_service, 'nginx') do
7
+ it { should eq 'ln -s /etc/sv/nginx /var/service/' }
8
+ end
9
+
10
+ describe get_command(:disable_service, 'nginx') do
11
+ it { should eq 'rm /var/service/nginx' }
12
+ end
13
+
14
+ describe get_command(:start_service, 'nginx') do
15
+ it { should eq 'sv up /var/service/nginx' }
16
+ end
17
+
18
+ describe get_command(:stop_service, 'nginx') do
19
+ it { should eq 'sv down /var/service/nginx' }
20
+ end
21
+
22
+ describe get_command(:restart_service, 'nginx') do
23
+ it { should eq 'sv restart /var/service/nginx' }
24
+ 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.90.1
4
+ version: 2.92.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: 2024-08-08 00:00:00.000000000 Z
11
+ date: 2025-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64
@@ -334,6 +334,7 @@ files:
334
334
  - lib/specinfra/command/linuxmint/base.rb
335
335
  - lib/specinfra/command/module.rb
336
336
  - lib/specinfra/command/module/openrc.rb
337
+ - lib/specinfra/command/module/runit.rb
337
338
  - lib/specinfra/command/module/service/daemontools.rb
338
339
  - lib/specinfra/command/module/service/delegator.rb
339
340
  - lib/specinfra/command/module/service/god.rb
@@ -450,6 +451,10 @@ files:
450
451
  - lib/specinfra/command/ubuntu/v15/service.rb
451
452
  - lib/specinfra/command/ubuntu/v18.rb
452
453
  - lib/specinfra/command/ubuntu/v18/port.rb
454
+ - lib/specinfra/command/voidlinux.rb
455
+ - lib/specinfra/command/voidlinux/base.rb
456
+ - lib/specinfra/command/voidlinux/base/package.rb
457
+ - lib/specinfra/command/voidlinux/base/service.rb
453
458
  - lib/specinfra/command/vyos.rb
454
459
  - lib/specinfra/command/vyos/base.rb
455
460
  - lib/specinfra/command/windows.rb
@@ -501,6 +506,7 @@ files:
501
506
  - lib/specinfra/helper/detect_os/redhat.rb
502
507
  - lib/specinfra/helper/detect_os/solaris.rb
503
508
  - lib/specinfra/helper/detect_os/suse.rb
509
+ - lib/specinfra/helper/detect_os/voidlinux.rb
504
510
  - lib/specinfra/helper/docker.rb
505
511
  - lib/specinfra/helper/host_inventory.rb
506
512
  - lib/specinfra/helper/lxc.rb
@@ -595,6 +601,7 @@ files:
595
601
  - spec/command/linux/selinux_spec.rb
596
602
  - spec/command/module/service/daemontools_spec.rb
597
603
  - spec/command/module/service/init_spec.rb
604
+ - spec/command/module/service/runit_spec.rb
598
605
  - spec/command/module/service/systemd_spec.rb
599
606
  - spec/command/module/ss_spec.rb
600
607
  - spec/command/module/systemd_spec.rb
@@ -618,6 +625,8 @@ files:
618
625
  - spec/command/sles15/service_spec.rb
619
626
  - spec/command/solaris11/user_spec.rb
620
627
  - spec/command/ubuntu/ppa_spec.rb
628
+ - spec/command/voidlinux/package_spec.rb
629
+ - spec/command/voidlinux/service_spec.rb
621
630
  - spec/command/windows/registry_key_spec.rb
622
631
  - spec/command/windows/service_spec.rb
623
632
  - spec/configuration_spec.rb
@@ -746,6 +755,7 @@ test_files:
746
755
  - spec/command/linux/selinux_spec.rb
747
756
  - spec/command/module/service/daemontools_spec.rb
748
757
  - spec/command/module/service/init_spec.rb
758
+ - spec/command/module/service/runit_spec.rb
749
759
  - spec/command/module/service/systemd_spec.rb
750
760
  - spec/command/module/ss_spec.rb
751
761
  - spec/command/module/systemd_spec.rb
@@ -769,6 +779,8 @@ test_files:
769
779
  - spec/command/sles15/service_spec.rb
770
780
  - spec/command/solaris11/user_spec.rb
771
781
  - spec/command/ubuntu/ppa_spec.rb
782
+ - spec/command/voidlinux/package_spec.rb
783
+ - spec/command/voidlinux/service_spec.rb
772
784
  - spec/command/windows/registry_key_spec.rb
773
785
  - spec/command/windows/service_spec.rb
774
786
  - spec/configuration_spec.rb