specinfra 2.84.1 → 2.85.1

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
  SHA1:
3
- metadata.gz: 41306d41b21769e34d5564f7acf46d531eda921b
4
- data.tar.gz: f6973f9b4f45ccedcbab6f1fbb1297d3af614a77
3
+ metadata.gz: f4d95326df395f0dc227c42c60374f4ff6cdfa87
4
+ data.tar.gz: 962f068198272e29bb5ef4595ce2526797f33201
5
5
  SHA512:
6
- metadata.gz: c5508bd5a247b73322c86d042f5ee6ff739c5aa088fff4a1d63ce9a796ab994f0bef3ecdb7bc1d5b66d58f5f858d5249853054cced9671cc6b4c5683de6138f8
7
- data.tar.gz: ffeec8d6970d6f7690c468ce99c8917150a2179e076fb59fb0f3a5cbc2b146e4f5547003d86114fe023a35a1f4ed5ec80ce69887ce9a3334b5ef108b6226a5d0
6
+ metadata.gz: aae0d43151afbedeb361280fc7331eaf383259167aaa622d79a707dc4376723703616665376589c635f6e23bf075898fc40eea0d96de3e93ca03c44053ebcc0c
7
+ data.tar.gz: ca998bf4525bfc02ee240f6e63cd652b32e6aa7fb75191b093678c89c6fc8ac09d2b81d966913265c08b9a968467b85666f761086b28bbc66f30689b6af499be
@@ -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
@@ -0,0 +1,2 @@
1
+ class Specinfra::Command::Neon::Base < Specinfra::Command::Ubuntu::Base
2
+ end
@@ -0,0 +1 @@
1
+ class Specinfra::Command::Neon; end
@@ -223,6 +223,10 @@ require 'specinfra/command/linuxmint/base'
223
223
  require 'specinfra/command/elementary'
224
224
  require 'specinfra/command/elementary/base'
225
225
 
226
+ # Neon (inherit Ubuntu)
227
+ require 'specinfra/command/neon'
228
+ require 'specinfra/command/neon/base'
229
+
226
230
  # Cumulus Networks (inherit Debian)
227
231
  require 'specinfra/command/cumulus'
228
232
  require 'specinfra/command/cumulus/base'
@@ -235,6 +239,11 @@ require 'specinfra/command/gentoo/base'
235
239
  require 'specinfra/command/gentoo/base/package'
236
240
  require 'specinfra/command/gentoo/base/service'
237
241
 
242
+ # Guix (inherit Linux)
243
+ require 'specinfra/command/guix'
244
+ require 'specinfra/command/guix/base'
245
+ require 'specinfra/command/guix/base/service'
246
+
238
247
  # Plamo (inherit Linux)
239
248
  require 'specinfra/command/plamo'
240
249
  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.1"
2
+ VERSION = "2.85.1"
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.1
4
+ version: 2.85.1
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-01-27 00:00:00.000000000 Z
11
+ date: 2023-05-24 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
@@ -327,6 +330,8 @@ files:
327
330
  - lib/specinfra/command/module/ss.rb
328
331
  - lib/specinfra/command/module/systemd.rb
329
332
  - lib/specinfra/command/module/zfs.rb
333
+ - lib/specinfra/command/neon.rb
334
+ - lib/specinfra/command/neon/base.rb
330
335
  - lib/specinfra/command/nixos.rb
331
336
  - lib/specinfra/command/nixos/base.rb
332
337
  - lib/specinfra/command/nixos/base/package.rb
@@ -468,6 +473,7 @@ files:
468
473
  - lib/specinfra/helper/detect_os/esxi.rb
469
474
  - lib/specinfra/helper/detect_os/freebsd.rb
470
475
  - lib/specinfra/helper/detect_os/gentoo.rb
476
+ - lib/specinfra/helper/detect_os/guix.rb
471
477
  - lib/specinfra/helper/detect_os/nixos.rb
472
478
  - lib/specinfra/helper/detect_os/openbsd.rb
473
479
  - lib/specinfra/helper/detect_os/photon.rb
@@ -557,6 +563,7 @@ files:
557
563
  - spec/command/freebsd/interface_spec.rb
558
564
  - spec/command/freebsd/package_spec.rb
559
565
  - spec/command/freebsd/service_spec.rb
566
+ - spec/command/guix/service_spec.rb
560
567
  - spec/command/linux/bond_spec.rb
561
568
  - spec/command/linux/bridge_spec.rb
562
569
  - spec/command/linux/file_spec.rb
@@ -600,6 +607,7 @@ files:
600
607
  - spec/helper/detect_os/eos_spec.rb
601
608
  - spec/helper/detect_os/esxi_spec.rb
602
609
  - spec/helper/detect_os/freebsd_spec.rb
610
+ - spec/helper/detect_os/guix_spec.rb
603
611
  - spec/helper/detect_os/openbsd_spec.rb
604
612
  - spec/helper/detect_os/suse_spec.rb
605
613
  - spec/helper/os_spec.rb
@@ -611,6 +619,7 @@ files:
611
619
  - spec/host_inventory/darwin/filesystem_spec.rb
612
620
  - spec/host_inventory/darwin/kernel_spec.rb
613
621
  - spec/host_inventory/freebsd/filesystem_spec.rb
622
+ - spec/host_inventory/guix/filesystem_spec.rb
614
623
  - spec/host_inventory/linux/block_device_spec.rb
615
624
  - spec/host_inventory/linux/cpu_spec.rb
616
625
  - spec/host_inventory/linux/filesystem_spec.rb
@@ -704,6 +713,7 @@ test_files:
704
713
  - spec/command/freebsd/interface_spec.rb
705
714
  - spec/command/freebsd/package_spec.rb
706
715
  - spec/command/freebsd/service_spec.rb
716
+ - spec/command/guix/service_spec.rb
707
717
  - spec/command/linux/bond_spec.rb
708
718
  - spec/command/linux/bridge_spec.rb
709
719
  - spec/command/linux/file_spec.rb
@@ -747,6 +757,7 @@ test_files:
747
757
  - spec/helper/detect_os/eos_spec.rb
748
758
  - spec/helper/detect_os/esxi_spec.rb
749
759
  - spec/helper/detect_os/freebsd_spec.rb
760
+ - spec/helper/detect_os/guix_spec.rb
750
761
  - spec/helper/detect_os/openbsd_spec.rb
751
762
  - spec/helper/detect_os/suse_spec.rb
752
763
  - spec/helper/os_spec.rb
@@ -758,6 +769,7 @@ test_files:
758
769
  - spec/host_inventory/darwin/filesystem_spec.rb
759
770
  - spec/host_inventory/darwin/kernel_spec.rb
760
771
  - spec/host_inventory/freebsd/filesystem_spec.rb
772
+ - spec/host_inventory/guix/filesystem_spec.rb
761
773
  - spec/host_inventory/linux/block_device_spec.rb
762
774
  - spec/host_inventory/linux/cpu_spec.rb
763
775
  - spec/host_inventory/linux/filesystem_spec.rb