vagrant-global_halt 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7f157b14d791972f2c157cfd9f5cc404eba21c00b8b04fe2e12f187af1127ff8
4
+ data.tar.gz: 7996c5f54e42fd3d7a953501b78996f899cee965795b071c90ff8ecfca76220e
5
+ SHA512:
6
+ metadata.gz: cbca4841128940c6eeb0e91cf95fdca8f0be8c5026b9b9f31c728a2f54157ae1628e9455cd6cd96a7509cb47522d402ffb603836d54d5133b7cd2dc9af899d17
7
+ data.tar.gz: 6938341749ead08b77c0becdfcdb09d0be69d612f0759eb8671df08535b36393ae84f8da3ec5d94ddaa966346bf78e719afa0e348b27c7ae531571cce49205d9
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source "https://rubygems.org"
2
+
3
+ group :development do
4
+ gem "vagrant", git: "https://github.com/hashicorp/vagrant.git"
5
+ end
6
+
7
+ group :plugins do
8
+ gem "vagrant-global_halt", path: "."
9
+ end
10
+
data/Gemfile.lock ADDED
@@ -0,0 +1,119 @@
1
+ GIT
2
+ remote: https://github.com/hashicorp/vagrant.git
3
+ revision: 4ce8d84f7e6709e4478612a9f0810dc686076ee0
4
+ specs:
5
+ vagrant (2.2.6.dev)
6
+ bcrypt_pbkdf (~> 1.0.0)
7
+ childprocess (~> 0.6.0)
8
+ ed25519 (~> 1.2.4)
9
+ erubis (~> 2.7.0)
10
+ hashicorp-checkpoint (~> 0.1.5)
11
+ i18n (~> 1.1.1)
12
+ listen (~> 3.1.5)
13
+ log4r (~> 1.1.9, < 1.1.11)
14
+ net-scp (~> 1.2.0)
15
+ net-sftp (~> 2.1)
16
+ net-ssh (~> 5.1.0)
17
+ rb-kqueue (~> 0.2.0)
18
+ rest-client (>= 1.6.0, < 3.0)
19
+ ruby_dep (<= 1.3.1)
20
+ rubyzip (~> 1.2.2)
21
+ vagrant_cloud (~> 2.0.2)
22
+ wdm (~> 0.1.0)
23
+ winrm (~> 2.1)
24
+ winrm-elevated (~> 1.1)
25
+ winrm-fs (~> 1.0)
26
+
27
+ PATH
28
+ remote: .
29
+ specs:
30
+ vagrant-global_halt (0.1.0)
31
+
32
+ GEM
33
+ remote: https://rubygems.org/
34
+ specs:
35
+ bcrypt_pbkdf (1.0.1)
36
+ builder (3.2.3)
37
+ childprocess (0.6.3)
38
+ ffi (~> 1.0, >= 1.0.11)
39
+ concurrent-ruby (1.1.5)
40
+ domain_name (0.5.20180417)
41
+ unf (>= 0.0.5, < 1.0.0)
42
+ ed25519 (1.2.4)
43
+ erubis (2.7.0)
44
+ ffi (1.11.1)
45
+ gssapi (1.3.0)
46
+ ffi (>= 1.0.1)
47
+ gyoku (1.3.1)
48
+ builder (>= 2.1.2)
49
+ hashicorp-checkpoint (0.1.5)
50
+ http-cookie (1.0.3)
51
+ domain_name (~> 0.5)
52
+ httpclient (2.8.3)
53
+ i18n (1.1.1)
54
+ concurrent-ruby (~> 1.0)
55
+ listen (3.1.5)
56
+ rb-fsevent (~> 0.9, >= 0.9.4)
57
+ rb-inotify (~> 0.9, >= 0.9.7)
58
+ ruby_dep (~> 1.2)
59
+ little-plugger (1.1.4)
60
+ log4r (1.1.10)
61
+ logging (2.2.2)
62
+ little-plugger (~> 1.1)
63
+ multi_json (~> 1.10)
64
+ mime-types (3.2.2)
65
+ mime-types-data (~> 3.2015)
66
+ mime-types-data (3.2019.0331)
67
+ multi_json (1.13.1)
68
+ net-scp (1.2.1)
69
+ net-ssh (>= 2.6.5)
70
+ net-sftp (2.1.2)
71
+ net-ssh (>= 2.6.5)
72
+ net-ssh (5.1.0)
73
+ netrc (0.11.0)
74
+ nori (2.6.0)
75
+ rb-fsevent (0.10.3)
76
+ rb-inotify (0.10.0)
77
+ ffi (~> 1.0)
78
+ rb-kqueue (0.2.5)
79
+ ffi (>= 0.5.0)
80
+ rest-client (2.0.2)
81
+ http-cookie (>= 1.0.2, < 2.0)
82
+ mime-types (>= 1.16, < 4.0)
83
+ netrc (~> 0.8)
84
+ ruby_dep (1.3.1)
85
+ rubyntlm (0.6.2)
86
+ rubyzip (1.2.3)
87
+ unf (0.1.4)
88
+ unf_ext
89
+ unf_ext (0.0.7.6)
90
+ vagrant_cloud (2.0.2)
91
+ rest-client (~> 2.0.2)
92
+ wdm (0.1.1)
93
+ winrm (2.3.2)
94
+ builder (>= 2.1.2)
95
+ erubis (~> 2.7)
96
+ gssapi (~> 1.2)
97
+ gyoku (~> 1.0)
98
+ httpclient (~> 2.2, >= 2.2.0.2)
99
+ logging (>= 1.6.1, < 3.0)
100
+ nori (~> 2.0)
101
+ rubyntlm (~> 0.6.0, >= 0.6.1)
102
+ winrm-elevated (1.1.1)
103
+ winrm (~> 2.0)
104
+ winrm-fs (~> 1.0)
105
+ winrm-fs (1.3.2)
106
+ erubis (~> 2.7)
107
+ logging (>= 1.6.1, < 3.0)
108
+ rubyzip (~> 1.1)
109
+ winrm (~> 2.0)
110
+
111
+ PLATFORMS
112
+ ruby
113
+
114
+ DEPENDENCIES
115
+ vagrant!
116
+ vagrant-global_halt!
117
+
118
+ BUNDLED WITH
119
+ 2.0.1
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010-2019 Mitchell Hashimoto
4
+ Copyright (c) 2019 Masahiro IUCHI
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # vagrant-global-halt
2
+ Vagrant plugin to add `global-halt` command shuts your all virtual machines down forcefully.
3
+
4
+ ## License
5
+ MIT License
6
+
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "vagrant/global_halt"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,10 @@
1
+ require "vagrant/global_halt/command"
2
+ require "vagrant/global_halt/plugin"
3
+ require "vagrant/global_halt/version"
4
+
5
+ module Vagrant
6
+ module GlobalHalt
7
+ class Error < StandardError; end
8
+ # Your code goes here...
9
+ end
10
+ end
@@ -0,0 +1,51 @@
1
+ require 'optparse'
2
+
3
+ module Vagrant
4
+ module GlobalHalt
5
+ class Command < Vagrant.plugin('2', :command)
6
+ def self.synopsis
7
+ 'stops all vagrant machines'
8
+ end
9
+
10
+ def execute
11
+ options = {}
12
+ options[:force] = false
13
+
14
+ opts = OptionParser.new do |o|
15
+ o.banner = 'Usage: vagrant global-halt [options]'
16
+ o.separator ''
17
+ o.separator 'Options:'
18
+ o.separator ''
19
+
20
+ o.on('-f', '--force', 'Force shut down (equivalent of pulling power)') do |f|
21
+ options[:force] = f
22
+ end
23
+ end
24
+
25
+ argv = parse_options(opts)
26
+ return if !argv
27
+
28
+ active_machine_entries = @env.machine_index.find_all do |entry|
29
+ entry.state.to_s == 'running' && entry.valid?(@env.home_path)
30
+ end
31
+
32
+ if active_machine_entries.empty?
33
+ @env.ui.info('No running VM.')
34
+ return 0
35
+ end
36
+
37
+ active_machine_entries.each do |entry|
38
+ machine_info = "id: #{entry.id.to_s}, name: #{entry.name.to_s}, provider: #{entry.provider.to_s}, directory: #{entry.vagrantfile_path.to_s}"
39
+ @env.ui.info(machine_info)
40
+
41
+ with_target_vms(entry.id.to_s) do |vm|
42
+ vm.action(:halt, force_halt: options[:force])
43
+ end;
44
+ end
45
+
46
+ 0
47
+ end
48
+ end
49
+ end
50
+ end
51
+
@@ -0,0 +1,18 @@
1
+ require 'vagrant'
2
+
3
+ module Vagrant
4
+ module GlobalHalt
5
+ class Plugin < Vagrant.plugin('2')
6
+ name 'global-halt command'
7
+ description <<-DESC
8
+ The `global-halt` command shuts your all virtual machines down forcefully.
9
+ DESC
10
+
11
+ command 'global-halt' do
12
+ require File.expand_path('../command', __FILE__)
13
+ Command
14
+ end
15
+ end
16
+ end
17
+ end
18
+
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module GlobalHalt
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,41 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "vagrant/global_halt/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-global_halt"
8
+ spec.version = Vagrant::GlobalHalt::VERSION
9
+ spec.authors = ["Masahiro IUCHI"]
10
+ spec.email = ["masahiro.iuchi@gmail.com"]
11
+ spec.licenses = ['MIT']
12
+
13
+ spec.summary = %q{Vagrant plugin to halt all virtual machines.}
14
+ spec.description = spec.summary
15
+ spec.homepage = "https://github.com/masiuchi/vagrant-global-halt"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = "https://github.com/masiuchi/vagrant-global-halt"
24
+ spec.metadata["changelog_uri"] = spec.metadata['source_code_uri']
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_development_dependency "bundler", "~> 2.0"
40
+ spec.add_development_dependency "rake", "~> 10.0"
41
+ end
metadata ADDED
@@ -0,0 +1,88 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-global_halt
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Masahiro IUCHI
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-06-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Vagrant plugin to halt all virtual machines.
42
+ email:
43
+ - masahiro.iuchi@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - LICENSE
52
+ - README.md
53
+ - Rakefile
54
+ - bin/console
55
+ - bin/setup
56
+ - lib/vagrant/global_halt.rb
57
+ - lib/vagrant/global_halt/command.rb
58
+ - lib/vagrant/global_halt/plugin.rb
59
+ - lib/vagrant/global_halt/version.rb
60
+ - vagrant-global_halt.gemspec
61
+ homepage: https://github.com/masiuchi/vagrant-global-halt
62
+ licenses:
63
+ - MIT
64
+ metadata:
65
+ allowed_push_host: https://rubygems.org
66
+ homepage_uri: https://github.com/masiuchi/vagrant-global-halt
67
+ source_code_uri: https://github.com/masiuchi/vagrant-global-halt
68
+ changelog_uri: https://github.com/masiuchi/vagrant-global-halt
69
+ post_install_message:
70
+ rdoc_options: []
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ requirements: []
84
+ rubygems_version: 3.0.3
85
+ signing_key:
86
+ specification_version: 4
87
+ summary: Vagrant plugin to halt all virtual machines.
88
+ test_files: []