vagrant-json 1.0.0

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: a0701aaf50a7ccb99cb5a80d79e21088c54b909c
4
+ data.tar.gz: 5975b5e67bec1e43f94ee152fc23177334693bbe
5
+ SHA512:
6
+ metadata.gz: 96f1445989c4666aa3461d509a80fb803109540834a372b4789c7eb6a18b57a719767ea7495e74e3cc586792e9efe5db4169a83ef17497f08ab638a7b3c6d957
7
+ data.tar.gz: 83d1f73b3217c8f41b109c1ba9449f38d0c6b7e052ab80dd46dc9878f12ee30150677ed7b3fbb92a287fbba6ade2f79f2fad31a7b32632d8c241b4015be79767
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ .idea/
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ group :development do
4
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
5
+ end
6
+
7
+ group :plugins do
8
+ gem 'vagrant-json', path: '.'
9
+ end
data/README.md ADDED
@@ -0,0 +1,13 @@
1
+ # Vagrant JSON Status
2
+
3
+ Extremely simple Vagrant plugin that will output `global-status` in JSON instead of the current CSV format.
4
+
5
+ ## Installation
6
+
7
+ $ gem install vagrant-json
8
+
9
+ ## Usage
10
+
11
+ ```shell
12
+ vagrant json-status [--pretty]
13
+ ```
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ Bundler::GemHelper.install_tasks
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "vagrant/json_status"
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,45 @@
1
+ require 'json'
2
+ require 'optparse'
3
+
4
+ module Vagrant
5
+ module Json
6
+ class Command < Vagrant.plugin('2', :command)
7
+
8
+ # Executes this command.
9
+ def execute
10
+
11
+ options = {}
12
+ opts = OptionParser.new do |opt|
13
+ opt.banner = 'Usage: vagrant json-status'
14
+ opt.separator ''
15
+
16
+ opt.on('--pretty', 'Pretty print JSON.') do |p|
17
+ options[:pretty] = true
18
+ end
19
+ end
20
+
21
+ # Parse any commandline options
22
+ argv = parse_options(opts)
23
+ return unless argv
24
+
25
+ entries = {
26
+ machines: {}
27
+ }
28
+
29
+ # Get all vagrant machines
30
+ @env.machine_index.each do |entry|
31
+
32
+ entries[:machines][entry.id] = {
33
+ name: entry.name,
34
+ provider: entry.provider,
35
+ state: entry.state,
36
+ directory: entry.vagrantfile_path
37
+ }
38
+ end
39
+
40
+ @env.ui.info (options[:pretty] ? JSON.pretty_generate(entries) : JSON.generate(entries))
41
+ 0
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,12 @@
1
+ module Vagrant
2
+ module Json
3
+ class Plugin < Vagrant.plugin('2')
4
+ name 'JSON Status'
5
+
6
+ command 'json-status' do
7
+ require_relative 'command'
8
+ Command
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module Json
3
+ VERSION = '1.0.0'
4
+ end
5
+ end
@@ -0,0 +1,11 @@
1
+ require 'vagrant/json/version'
2
+ require 'bundler'
3
+
4
+ begin
5
+ require 'vagrant'
6
+ rescue LoadError
7
+ Bundler.require(:default, :development)
8
+ end
9
+
10
+ require 'vagrant/json/plugin'
11
+ require 'vagrant/json/command'
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant/json/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'vagrant-json'
8
+ spec.version = Vagrant::Json::VERSION
9
+ spec.authors = ['Nate Strandberg']
10
+ spec.email = ['nate@juliabalfour.com']
11
+
12
+ spec.summary = 'Vagrant JSON Status'
13
+ spec.description = 'Extremely simple Vagrant plugin that will output `global-status` in JSON instead of the current CSV format.'
14
+ spec.homepage = 'https://github.com/nater540/vagrant-json'
15
+
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
18
+ f.match(%r{^(test|spec|features)/})
19
+ end
20
+ spec.bindir = 'exe'
21
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_development_dependency 'bundler', '~> 1.14'
25
+ spec.add_development_dependency 'rake', '~> 10.0'
26
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-json
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Nate Strandberg
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2017-02-17 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.14'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.14'
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: Extremely simple Vagrant plugin that will output `global-status` in JSON
42
+ instead of the current CSV format.
43
+ email:
44
+ - nate@juliabalfour.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - lib/vagrant/json.rb
56
+ - lib/vagrant/json/command.rb
57
+ - lib/vagrant/json/plugin.rb
58
+ - lib/vagrant/json/version.rb
59
+ - vagrant-json.gemspec
60
+ homepage: https://github.com/nater540/vagrant-json
61
+ licenses: []
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.6.8
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Vagrant JSON Status
83
+ test_files: []