specinfra 2.84.0 → 2.85.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
  SHA1:
3
- metadata.gz: 8409581baad2004ebb1c11e01d99598c39d5b5b4
4
- data.tar.gz: b5febfb1b4f1130c379811b680669132ea5ea556
3
+ metadata.gz: 5dcca0a6c67f3f9b47c2833d86186ef641f41483
4
+ data.tar.gz: b4fcb4bc6a28133ef0e581947a748fb8f4cf5218
5
5
  SHA512:
6
- metadata.gz: 9292019070312c7ce37faad96381f175be5c56f7ec733d2776ab265ed75ada52f6f6c859b06fbc564def43c0f7bfd7633fe0bc5ee41ece8dd2acb6c75e92fc12
7
- data.tar.gz: d950653eb89b474c57b183a390e3d2f218915c8077b6da4ee592e32aeec83b031978cfa041365d51697fe27249f1db8121ac2e9c2fca86560bd680000e15166e
6
+ metadata.gz: 57fb67750b01a42c2967f2aa98e1759d18bf62c77ff6fc49a8887fd3a54e775d5b48db3b7d4c095871d9592130a52a453a7d1e3a003caa42e625842058acec93
7
+ data.tar.gz: 590f94b6646ef7d036d4481d6df2c5ead0f2545847bc1e1a852f41c66101767858669faedf32fa407735fec175ee7a14ed0180e0521a077155059990495e9324
@@ -70,7 +70,7 @@ module Specinfra
70
70
  end
71
71
 
72
72
  def find_powershell(dirs)
73
- ( dirs.map { |dir| "#{ENV['WINDIR']}\\#{dir}\\WindowsPowerShell\\v1.0\\powershell.exe" } ).find { |exe| File.exists?(exe) } || 'powershell'
73
+ ( dirs.map { |dir| "#{ENV['WINDIR']}\\#{dir}\\WindowsPowerShell\\v1.0\\powershell.exe" } ).find { |exe| File.exist?(exe) } || 'powershell'
74
74
  end
75
75
 
76
76
  end
@@ -0,0 +1,31 @@
1
+ class Specinfra::Command::Guix::Base::Service < Specinfra::Command::Linux::Base::Service
2
+ class << self
3
+ def check_is_enabled(service, level=nil)
4
+ "herd status #{escape(service)} | grep 'It is enabled.'"
5
+ end
6
+
7
+ def check_is_running(service)
8
+ "herd status #{escape(service)} | grep 'It is started.'"
9
+ end
10
+
11
+ def enable(service)
12
+ "herd enable #{escape(service)}"
13
+ end
14
+
15
+ def disable(service)
16
+ "herd disable #{escape(service)}"
17
+ end
18
+
19
+ def start(service)
20
+ "herd start #{escape(service)}"
21
+ end
22
+
23
+ def stop(service)
24
+ "herd stop #{escape(service)}"
25
+ end
26
+
27
+ def restart(service)
28
+ "herd restart #{escape(service)}"
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,2 @@
1
+ class Specinfra::Command::Guix::Base < Specinfra::Command::Linux::Base
2
+ end
@@ -0,0 +1 @@
1
+ class Specinfra::Command::Guix; end
@@ -235,6 +235,11 @@ require 'specinfra/command/gentoo/base'
235
235
  require 'specinfra/command/gentoo/base/package'
236
236
  require 'specinfra/command/gentoo/base/service'
237
237
 
238
+ # Guix (inherit Linux)
239
+ require 'specinfra/command/guix'
240
+ require 'specinfra/command/guix/base'
241
+ require 'specinfra/command/guix/base/service'
242
+
238
243
  # Plamo (inherit Linux)
239
244
  require 'specinfra/command/plamo'
240
245
  require 'specinfra/command/plamo/base'
@@ -0,0 +1,10 @@
1
+ class Specinfra::Helper::DetectOs::Guix < 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
+ if line =~ /ID=guix/
6
+ { :family => 'guix', :release => nil }
7
+ end
8
+ end
9
+ end
10
+ end
@@ -31,6 +31,7 @@ require 'specinfra/helper/detect_os/esxi'
31
31
  require 'specinfra/helper/detect_os/eos'
32
32
  require 'specinfra/helper/detect_os/freebsd'
33
33
  require 'specinfra/helper/detect_os/gentoo'
34
+ require 'specinfra/helper/detect_os/guix'
34
35
  require 'specinfra/helper/detect_os/nixos'
35
36
  require 'specinfra/helper/detect_os/openbsd'
36
37
  require 'specinfra/helper/detect_os/photon'
@@ -1,3 +1,3 @@
1
1
  module Specinfra
2
- VERSION = "2.84.0"
2
+ VERSION = "2.85.0"
3
3
  end
@@ -0,0 +1,24 @@
1
+ require 'spec_helper'
2
+
3
+ property[:os] = nil
4
+ set :os, :family => 'guix'
5
+
6
+ describe get_command(:enable_service, 'nginx') do
7
+ it { should eq 'herd enable nginx' }
8
+ end
9
+
10
+ describe get_command(:disable_service, 'nginx') do
11
+ it { should eq 'herd disable nginx' }
12
+ end
13
+
14
+ describe get_command(:start_service, 'nginx') do
15
+ it { should eq 'herd start nginx' }
16
+ end
17
+
18
+ describe get_command(:stop_service, 'nginx') do
19
+ it { should eq 'herd stop nginx' }
20
+ end
21
+
22
+ describe get_command(:restart_service, 'nginx') do
23
+ it { should eq 'herd restart nginx' }
24
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+ require 'specinfra/helper/detect_os/guix'
3
+
4
+ describe Specinfra::Helper::DetectOs::Guix do
5
+ guix = Specinfra::Helper::DetectOs::Guix.new(:exec)
6
+ it 'Should return guix when Guix is installed.' do
7
+ allow(guix).to receive(:run_command) {
8
+ CommandResult.new(:stdout => "NAME=\"Guix System\" \nID=guix\nPRETTY_NAME=\"Guix System\" \nLOGO=guix-icon\nHOME_URL=\"https://guix.gnu.org\" \nDOCUMENTATION_URL=\"https://guix.gnu.org/en/manual\" \nSUPPORT_URL=\"https://guix.gnu.org/en/help\" \nBUG_REPORT_URL=\"https://lists.gnu.org/mailman/listinfo/bug-guix\"", :exit_status => 0)
9
+ }
10
+ expect(guix.detect).to include(
11
+ :family => 'guix',
12
+ :release => nil
13
+ )
14
+ end
15
+ end
@@ -0,0 +1,50 @@
1
+ require 'spec_helper'
2
+
3
+ ## Output from 'df -k'
4
+ str = <<-EOH
5
+ Filesystem 1K-blocks Used Available Use% Mounted on
6
+ none 4015168 0 4015168 0% /dev
7
+ /dev/sda3 235797392 184584640 39162064 83% /
8
+ /dev/sda1 523248 3640 519608 1% /boot/efi
9
+ tmpfs 4025296 1052 4024244 1% /dev/shm
10
+ none 4025292 44 4025248 1% /run/systemd
11
+ none 4025292 0 4025292 0% /run/user
12
+ cgroup 4025292 0 4025292 0% /sys/fs/cgroup
13
+ none 4025292 0 4025292 0% /var/cache/fontconfig
14
+ none 4025292 684 4024608 1% /var/lib/gdm
15
+ tmpfs 805056 44 805012 1% /run/user/1000
16
+ EOH
17
+
18
+ describe Specinfra::HostInventory::Filesystem do
19
+ let(:host_inventory) { nil }
20
+ describe 'Example of Guix' do
21
+ ret = Specinfra::HostInventory::Filesystem.new(host_inventory).parse(str)
22
+ example "/dev/sda3" do
23
+ expect(ret["/dev/sda3"]).to include(
24
+ "kb_available" => "39162064",
25
+ "kb_size" => "235797392",
26
+ "mount" => "/",
27
+ "percent_used" => "83%",
28
+ "kb_used" => "184584640"
29
+ )
30
+ end
31
+ example "/dev/sda1" do
32
+ expect(ret["/dev/sda1"]).to include(
33
+ "kb_available" => "519608",
34
+ "kb_size" => "523248",
35
+ "mount" => "/boot/efi",
36
+ "percent_used" => "1%",
37
+ "kb_used" => "3640"
38
+ )
39
+ end
40
+ example "cgroup" do
41
+ expect(ret["cgroup"]).to include(
42
+ "kb_available" => "4025292",
43
+ "kb_size" => "4025292",
44
+ "mount" => "/sys/fs/cgroup",
45
+ "percent_used" => "0%",
46
+ "kb_used" => "0"
47
+ )
48
+ end
49
+ end
50
+ 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.84.0
4
+ version: 2.85.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: 2022-12-29 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-scp
@@ -290,6 +290,9 @@ files:
290
290
  - lib/specinfra/command/gentoo/base.rb
291
291
  - lib/specinfra/command/gentoo/base/package.rb
292
292
  - lib/specinfra/command/gentoo/base/service.rb
293
+ - lib/specinfra/command/guix.rb
294
+ - lib/specinfra/command/guix/base.rb
295
+ - lib/specinfra/command/guix/base/service.rb
293
296
  - lib/specinfra/command/linux.rb
294
297
  - lib/specinfra/command/linux/base.rb
295
298
  - lib/specinfra/command/linux/base/bond.rb
@@ -468,6 +471,7 @@ files:
468
471
  - lib/specinfra/helper/detect_os/esxi.rb
469
472
  - lib/specinfra/helper/detect_os/freebsd.rb
470
473
  - lib/specinfra/helper/detect_os/gentoo.rb
474
+ - lib/specinfra/helper/detect_os/guix.rb
471
475
  - lib/specinfra/helper/detect_os/nixos.rb
472
476
  - lib/specinfra/helper/detect_os/openbsd.rb
473
477
  - lib/specinfra/helper/detect_os/photon.rb
@@ -557,6 +561,7 @@ files:
557
561
  - spec/command/freebsd/interface_spec.rb
558
562
  - spec/command/freebsd/package_spec.rb
559
563
  - spec/command/freebsd/service_spec.rb
564
+ - spec/command/guix/service_spec.rb
560
565
  - spec/command/linux/bond_spec.rb
561
566
  - spec/command/linux/bridge_spec.rb
562
567
  - spec/command/linux/file_spec.rb
@@ -600,6 +605,7 @@ files:
600
605
  - spec/helper/detect_os/eos_spec.rb
601
606
  - spec/helper/detect_os/esxi_spec.rb
602
607
  - spec/helper/detect_os/freebsd_spec.rb
608
+ - spec/helper/detect_os/guix_spec.rb
603
609
  - spec/helper/detect_os/openbsd_spec.rb
604
610
  - spec/helper/detect_os/suse_spec.rb
605
611
  - spec/helper/os_spec.rb
@@ -611,6 +617,7 @@ files:
611
617
  - spec/host_inventory/darwin/filesystem_spec.rb
612
618
  - spec/host_inventory/darwin/kernel_spec.rb
613
619
  - spec/host_inventory/freebsd/filesystem_spec.rb
620
+ - spec/host_inventory/guix/filesystem_spec.rb
614
621
  - spec/host_inventory/linux/block_device_spec.rb
615
622
  - spec/host_inventory/linux/cpu_spec.rb
616
623
  - spec/host_inventory/linux/filesystem_spec.rb
@@ -704,6 +711,7 @@ test_files:
704
711
  - spec/command/freebsd/interface_spec.rb
705
712
  - spec/command/freebsd/package_spec.rb
706
713
  - spec/command/freebsd/service_spec.rb
714
+ - spec/command/guix/service_spec.rb
707
715
  - spec/command/linux/bond_spec.rb
708
716
  - spec/command/linux/bridge_spec.rb
709
717
  - spec/command/linux/file_spec.rb
@@ -747,6 +755,7 @@ test_files:
747
755
  - spec/helper/detect_os/eos_spec.rb
748
756
  - spec/helper/detect_os/esxi_spec.rb
749
757
  - spec/helper/detect_os/freebsd_spec.rb
758
+ - spec/helper/detect_os/guix_spec.rb
750
759
  - spec/helper/detect_os/openbsd_spec.rb
751
760
  - spec/helper/detect_os/suse_spec.rb
752
761
  - spec/helper/os_spec.rb
@@ -758,6 +767,7 @@ test_files:
758
767
  - spec/host_inventory/darwin/filesystem_spec.rb
759
768
  - spec/host_inventory/darwin/kernel_spec.rb
760
769
  - spec/host_inventory/freebsd/filesystem_spec.rb
770
+ - spec/host_inventory/guix/filesystem_spec.rb
761
771
  - spec/host_inventory/linux/block_device_spec.rb
762
772
  - spec/host_inventory/linux/cpu_spec.rb
763
773
  - spec/host_inventory/linux/filesystem_spec.rb