vagrant-host-artix 0.0.2

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a0b4707c93720f594c7415c11b471559adce927136376ebb79f436898c40eb3e
4
+ data.tar.gz: eb3c081808e374592856827c5915ca1dfa01a8f9ed1966fae75a8662a7022e99
5
+ SHA512:
6
+ metadata.gz: 6e27625dde8b8b58137ea53a13458ff89ab60d9f146a1a1207c90197d85bd692ac4af87928758eeffb692c3e4192917a8725e434e8cb832853815fe4b627152f
7
+ data.tar.gz: 248e44a73f930a3f8f603f647791c8f15ff39811c5f629414ea3a84f572c78c585148e29ef2bac937ccdf6f17da5d571c97e8e1f99c55047edf944a795c7340e
@@ -0,0 +1,21 @@
1
+ on:
2
+ push:
3
+ branches:
4
+ - main
5
+ paths-ignore:
6
+ - 'CHANGELOG.md'
7
+
8
+ jobs:
9
+ build-gem:
10
+ name: Build gem
11
+ runs-on: ubuntu-18.04
12
+ steps:
13
+ - name: Code Checkout
14
+ uses: actions/checkout@v1
15
+ - name: Set Ruby
16
+ uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: '3.1'
19
+ - name: Build RubyGem
20
+ run: gem build my-vagrant-host-plugin-ruby-template.gemspec
21
+ working-directory: ${{github.workspace}}
@@ -0,0 +1,22 @@
1
+ on:
2
+ push:
3
+ tags: '*'
4
+
5
+ jobs:
6
+ release:
7
+ name: Build and release gem
8
+ runs-on: ubuntu-18.04
9
+ steps:
10
+ - name: Code Checkout
11
+ uses: actions/checkout@v1
12
+ - name: Set Ruby
13
+ uses: ruby/setup-ruby@v1
14
+ with:
15
+ ruby-version: '3.1'
16
+ - name: Build and release gem
17
+ env:
18
+ GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
19
+ run: |
20
+ gem build *.gemspec
21
+ gem push *.gem
22
+ working-directory: ${{github.workspace}}
data/.gitignore ADDED
@@ -0,0 +1,52 @@
1
+ # OS-specific
2
+ .DS_Store
3
+
4
+ # Editor swapfiles
5
+ .*.sw?
6
+ *~
7
+
8
+ # Vagrant stuff
9
+ acceptance_config.yml
10
+ boxes/*
11
+ /.vagrant
12
+ /website/.vagrant
13
+ /website/build
14
+ /vagrant-spec.config.rb
15
+ test/vagrant-spec/.vagrant/
16
+
17
+ # Bundler/Rubygems
18
+ *.gem
19
+ .bundle
20
+ pkg/*
21
+ tags
22
+ /Gemfile.lock
23
+ test/tmp/
24
+ vendor/
25
+ /exec
26
+ .ruby-bundle
27
+
28
+ # Documentation
29
+ _site/*
30
+ .yardoc/
31
+ doc/
32
+
33
+ # Python
34
+ *.pyc
35
+
36
+ # Rubinius
37
+ *.rbc
38
+
39
+ # IDE junk
40
+ .idea/*
41
+ *.iml
42
+ .project
43
+
44
+ # Ruby Managers
45
+ .rbenv
46
+ .rbenv-gemsets
47
+ .ruby-gemset
48
+ .ruby-version
49
+ .rvmrc
50
+
51
+ # Box storage for spec
52
+ test/vagrant-spec/boxes/*.box
data/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # 0.0.2
2
+
3
+ - Fixed NFS Capability
4
+ - Fixed Import of Platform Utils
5
+
6
+ # 0.0.1
7
+
8
+ - Initial Commit
9
+ - Added NFS Capabilities
10
+ - Added Platform Utils for OpenRC, dinit, runit, s6
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ if File.exist?(File.expand_path("../../vagrant", __FILE__))
7
+ gem 'vagrant', path: "../vagrant"
8
+ else
9
+ gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git', branch: "main"
10
+ end
11
+ gem 'rake', '>= 12.3.3'
12
+ end
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ ### Artix Linux Host Plugin for Vagrant 2.x
2
+
3
+ This Ruby Gem enables support for Artix Linux Hosts on Vagrant 2.x.
4
+
5
+ ### Installing
6
+
7
+ Currently installation can only be done from source, thus you will need to clone the repository:
8
+
9
+ ```
10
+ git clone git@github.com:Penaz91/vagrant-host-artix.git
11
+ ```
12
+
13
+ Then you will need to build the gem manually:
14
+
15
+ ```
16
+ cd vagrant-host-artix
17
+ gem build vagrant-host-artix.gemspec
18
+ ```
19
+
20
+ After that you can install the plugin:
21
+
22
+ ```
23
+ vagrant plugin install vagrant-host-artix-0.0.1.gem
24
+ ```
25
+
26
+ ### Known Issues
27
+
28
+ Some Artix systems may be migrated from Arch Linux. These systems will be detected by the builtin Arch host plugin, due to the presence of the `/etc/arch-release` file. Until this issue isn't fixed upstream, it's suggested to rename or delete such file.
29
+
30
+ ### TODOs
31
+
32
+ - [x] Testing on OpenRC
33
+ - [ ] Testing on S6
34
+ - [ ] Testing on dinit
35
+ - [ ] Testing on runit
36
+ - [ ] Automated Testing
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+ require 'rake/testtask'
4
+ require 'rspec/core/rake_task'
5
+
6
+ # Immediately sync all stdout so that tools like buildbot can
7
+ # immediately load in the output.
8
+ $stdout.sync = true
9
+ $stderr.sync = true
10
+
11
+ # This installs the tasks that help with gem creation and
12
+ # publishing.
13
+ Bundler::GemHelper.install_tasks
14
+
15
+ namespace :test do
16
+ RSpec::Core::RakeTask.new(:unit) do |t|
17
+ t.pattern = "test/unit/**/*_test.rb"
18
+ t.rspec_opts = "--color"
19
+ end
20
+ end
21
+
22
+ task default: "test:unit"
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.2
@@ -0,0 +1,43 @@
1
+ begin
2
+ require 'util/platform'
3
+ rescue LoadError
4
+ raise 'Cannot load Artix platform utilities!'
5
+ end
6
+
7
+ module VagrantArtixHost
8
+ module Cap
9
+ class NFS
10
+ def self.nfs_check_command(_env)
11
+ if VagrantArtixHost::Util::Platform.openrc?
12
+ '/etc/init.d/nfs status'
13
+ elsif VagrantArtixHost::Util::Platform.runit?
14
+ # NOTE: Runit may be monitoring another directory instead of the default /service/
15
+ 'sv status /service/nfs'
16
+ elsif VagrantArtixHost::Util::Platform.s6?
17
+ 's6-svstat /run/service/nfs'
18
+ elsif VagrantArtixHost::Util::Platform.dinit?
19
+ 'dinitctl status nfs'
20
+ else
21
+ # Fallback to init.d
22
+ '/etc/init.d/nfs status'
23
+ end
24
+ end
25
+
26
+ def self.nfs_start_command(_env)
27
+ if VagrantArtixHost::Util::Platform.openrc?
28
+ '/etc/init.d/nfs restart'
29
+ elsif VagrantArtixHost::Util::Platform.runit?
30
+ # NOTE: Runit may be monitoring another directory instead of the default /service/
31
+ 'sv status /service/nfs'
32
+ elsif VagrantArtixHost::Util::Platform.s6?
33
+ 's6-rc -u change nfs'
34
+ elsif VagrantArtixHost::Util::Platform.dinit?
35
+ 'dinitctl start nfs'
36
+ else
37
+ # Fallback to init.d
38
+ '/etc/init.d/nfs restart'
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
data/lib/host/host.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'logger'
2
+
3
+ module VagrantArtixHost
4
+ class Host < Vagrant.plugin("2", :host)
5
+ def detect?(env)
6
+ File.exist?("/etc/artix-release")
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,3 @@
1
+ module VagrantArtixHost
2
+ VERSION = File.read(File.expand_path("../../../VERSION", __FILE__)).chop
3
+ end
@@ -0,0 +1,56 @@
1
+ require 'vagrant/util/which'
2
+ require 'vagrant/util/subprocess'
3
+
4
+ module VagrantArtixHost
5
+ module Util
6
+ class Platform
7
+ class << self
8
+ # OpenRC is in use
9
+ def openrc?
10
+ if !defined?(@_openrc)
11
+ if Vagrant::Util::Which.which('rc-update')
12
+ @_openrc = true
13
+ else
14
+ @_openrc = false
15
+ end
16
+ end
17
+ @_openrc
18
+ end
19
+
20
+ # Runit is in use
21
+ def runit?
22
+ if !defined?(@_runit)
23
+ result = Vagrant::Util::Subprocess.execute('ps', '-o', 'comm=', '1')
24
+ @_runit = result.stdout.chomp == 'runit-init'
25
+ else
26
+ @_runit = false
27
+ end
28
+ @_runit
29
+ end
30
+
31
+ # S6 is in use
32
+ def s6?
33
+ if !defined?(@_s6)
34
+ result = Vagrant::Util::Subprocess.execute('ps', '-o', 'comm=', '1')
35
+ @_s6 = result.stdout.chomp == 's6-svscan'
36
+ else
37
+ @_s6 = false
38
+ end
39
+ @_s6
40
+ end
41
+
42
+ # dinit is in use
43
+ def dinit?
44
+ if !defined?(@_dinit)
45
+ if Util::Which.which('dinitctl')
46
+ @_dinit = true
47
+ else
48
+ @_dinit = false
49
+ end
50
+ end
51
+ @_dinit
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,31 @@
1
+ begin
2
+ require "vagrant"
3
+ rescue LoadError
4
+ raise "Vagrant is required!"
5
+ end
6
+
7
+ require "host/host"
8
+
9
+ module VagrantArtixHost
10
+ class Plugin < Vagrant.plugin("2")
11
+ name "VagrantArtixHost"
12
+ description <<-DESC
13
+ Vagrant Host plugin for Artix Linux
14
+ DESC
15
+
16
+ host(:artixhostplugin, :linux) do
17
+ Host
18
+ end
19
+
20
+ # Defining Host Capabilities
21
+ host_capability(:artixhostplugin, 'nfs_check_command') do
22
+ require_relative 'host/cap/nfs'
23
+ Cap::NFS
24
+ end
25
+
26
+ host_capability(:artixhostplugin, 'nfs_start_command') do
27
+ require_relative 'host/cap/nfs'
28
+ Cap::NFS
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = "vagrant-host-artix"
5
+ gem.version = File.read('VERSION').chop
6
+ gem.authors = ["Daniele Penazzo"]
7
+ gem.email = ["penazarea@altervista.org"]
8
+ gem.description = "Vagrant host plugin for Artix Linux"
9
+ gem.summary = "Adds Artix Linux Host support on Vagrant 2.x"
10
+ gem.license = 'MIT'
11
+ gem.homepage = "https://github.com/Penaz91/vagrant-host-artix/"
12
+
13
+ gem.add_development_dependency "rake", "~> 13.0"
14
+ gem.add_development_dependency "rspec", "~> 3.5.0"
15
+
16
+ gem.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|testdrive)/}) }
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.require_paths = ["lib"]
19
+ end
metadata ADDED
@@ -0,0 +1,85 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-host-artix
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Daniele Penazzo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2023-01-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 3.5.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 3.5.0
41
+ description: Vagrant host plugin for Artix Linux
42
+ email:
43
+ - penazarea@altervista.org
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".github/workflows/build.yml"
49
+ - ".github/workflows/release.yml"
50
+ - ".gitignore"
51
+ - CHANGELOG.md
52
+ - Gemfile
53
+ - README.md
54
+ - Rakefile
55
+ - VERSION
56
+ - lib/host/cap/nfs.rb
57
+ - lib/host/host.rb
58
+ - lib/host/version.rb
59
+ - lib/util/platform.rb
60
+ - lib/vagrant-host-artix.rb
61
+ - vagrant-host-artix.gemspec
62
+ homepage: https://github.com/Penaz91/vagrant-host-artix/
63
+ licenses:
64
+ - MIT
65
+ metadata: {}
66
+ post_install_message:
67
+ rdoc_options: []
68
+ require_paths:
69
+ - lib
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ required_rubygems_version: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubygems_version: 3.3.25
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Adds Artix Linux Host support on Vagrant 2.x
85
+ test_files: []