vagrant-mro 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7657184476f9bf0f502e66fc592c8405cd43ae47
4
+ data.tar.gz: 7df1c623e696b75ad29de974b9df04187a538547
5
+ SHA512:
6
+ metadata.gz: da83117e83f4ba25b29995adce09e7b9381880958d0f6c5dfdc1793f3c53d8a92380af5d90fa9ad584172ff614af876c7ddb1d5626ecc8ecec18b9976a149201
7
+ data.tar.gz: 0e2d9dff466e973b2a0b8e17e0efffc63e789f1484580a3c6a17d4354b097dbae6cb53572e25178fa3753a7ff8b63a41ea66a60a3965ed1e49472cb9cdcf72c4
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-mro.gemspec
4
+
5
+ group :development do
6
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git"
7
+ end
8
+
9
+ group :plugins do
10
+ gemspec
11
+ end
12
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Sam Halicke
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # VagrantPlugins::MRO
2
+
3
+ This is a solution for getting machine-readable global status output
4
+ from Vagrant, until this functionality is implemented in Vagrant itself.
5
+
6
+ ## Installation
7
+
8
+ vagrant plugin install vagrant-mro
9
+
10
+ ## Usage
11
+
12
+ vagrant mro
13
+
14
+ # output:
15
+ # id, name, state
16
+
17
+ 915bee0,default,saved
18
+
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require "bundler/gem_tasks"
3
+ require 'bundler/setup'
4
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,8 @@
1
+ require "vagrant-mro/plugin"
2
+ require "vagrant-mro/version"
3
+
4
+ module VagrantPlugins
5
+ module MRO
6
+ # Your code goes here...
7
+ end
8
+ end
@@ -0,0 +1,46 @@
1
+ module VagrantPlugins
2
+ module MRO
3
+ class Command < Vagrant.plugin("2", :command)
4
+ def self.synopsis
5
+ "Outputs machine-readable global status."
6
+ end
7
+
8
+ def execute
9
+ attrs = [:id, :name, :state]
10
+
11
+ entries = []
12
+ prune = []
13
+ @env.machine_index.each do |entry|
14
+ # Always prune invalid entries.
15
+ if !entry.valid?(@env.home_path)
16
+ prune << entry
17
+ next
18
+ end
19
+ entries << entry
20
+ end
21
+ # Prune all the entries to prune
22
+ prune.each do |entry|
23
+ deletable = @env.machine_index.get(entry.id)
24
+ @env.machine_index.delete(deletable) if deletable
25
+ end
26
+
27
+ if entries.empty?
28
+ @env.ui.info(I18n.t("vagrant.global_status_none"))
29
+ return 0
30
+ end
31
+
32
+ entries.each do |entry|
33
+ v = {}
34
+ attrs.each do |method|
35
+ v[method] = entry.send(method).to_s
36
+ v[method] = v[method][0...7] if method == :id
37
+ end
38
+ @env.ui.info("#{v[:id]},#{v[:name]},#{v[:state]}", new_line: true)
39
+ end
40
+
41
+ # Success, exit status 0
42
+ 0
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,24 @@
1
+ begin
2
+ require 'vagrant'
3
+ rescue LoadError
4
+ raise "This libary only makes sense from within Vagrant."
5
+ end
6
+
7
+ if Vagrant::VERSION < "1.6.0"
8
+ raise "Requires Vagrant version 1.6.0 or greater."
9
+ end
10
+
11
+ module VagrantPlugins
12
+ module MRO
13
+ class Plugin < Vagrant.plugin(2)
14
+
15
+ name "vagrant-mro"
16
+ description "Produces machine-readable output of global status."
17
+
18
+ command :mro do
19
+ require_relative 'command'
20
+ Command
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module MRO
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-mro/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-mro"
8
+ spec.version = VagrantPlugins::MRO::VERSION
9
+ spec.authors = ["Sam Halicke"]
10
+ spec.email = ["sam@twenty20.com"]
11
+ spec.summary = %q{Produces machine-readable global status output.}
12
+ spec.homepage = "https://github.com/acceptly/vagrant-mro"
13
+ spec.license = "MIT"
14
+
15
+ spec.files = `git ls-files -z`.split("\x0")
16
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+
20
+ spec.add_development_dependency "bundler", "~> 1.6"
21
+ spec.add_development_dependency "rake"
22
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-mro
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Sam Halicke
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-14 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: '1.6'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.6'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description:
42
+ email:
43
+ - sam@twenty20.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - .gitignore
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/vagrant-mro.rb
54
+ - lib/vagrant-mro/command.rb
55
+ - lib/vagrant-mro/plugin.rb
56
+ - lib/vagrant-mro/version.rb
57
+ - vagrant-mro.gemspec
58
+ homepage: https://github.com/acceptly/vagrant-mro
59
+ licenses:
60
+ - MIT
61
+ metadata: {}
62
+ post_install_message:
63
+ rdoc_options: []
64
+ require_paths:
65
+ - lib
66
+ required_ruby_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ requirements: []
77
+ rubyforge_project:
78
+ rubygems_version: 2.0.14
79
+ signing_key:
80
+ specification_version: 4
81
+ summary: Produces machine-readable global status output.
82
+ test_files: []