vagrant-gs 0.0.1

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
+ SHA1:
3
+ metadata.gz: aba9f971ea4f5f903d713f42f62a0a6d1b76b20f
4
+ data.tar.gz: 9a0c034dd1925eb14e80d144acee6ff382d859c1
5
+ SHA512:
6
+ metadata.gz: 80f5042d312b807cd554404800b97855849e438020c3d80ef6141875ebcae391f231e326336988e1c2fb40c7a1cf92a74da0cf741558e9018aabc578caafd1df
7
+ data.tar.gz: c2eaf3ae7d3b6d41914d30f81c65e35821afcf4eddd543a3141b2210e4308ba5ccb007fd2daecde553c462f49ba14f7add278a0fae88d6ae604ad8aa132369ab
data/..gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require './version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "."
8
+ spec.version = .::VERSION
9
+ spec.authors = ["Justin Downing"]
10
+ spec.email = ["justin@apartmenttherapy.com"]
11
+ spec.summary = %q{TODO: Write a short summary. Required.}
12
+ spec.description = %q{TODO: Write a longer description. Optional.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.5"
22
+ spec.add_development_dependency "rake"
23
+ end
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'bundler'
4
+ gem 'rake'
5
+
6
+ group :development do
7
+ gem "vagrant", :git => "https://github.com/mitchellh/vagrant.git"
8
+ end
9
+
10
+ group :plugins do
11
+ gem "vagrant-gs", path: "."
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Justin Downing
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,29 @@
1
+ # .
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem '.'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install .
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it ( http://github.com/<my-github-username>/./fork )
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
data/Vagrantfile ADDED
@@ -0,0 +1,9 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ # require 'vagrant-gs' plugin for testing
5
+ Vagrant.require_plugin "vagrant-gs"
6
+
7
+ Vagrant.configure("2") do |config|
8
+ config.vm.box = "jdowning/trusty64"
9
+ end
data/lib/..rb ADDED
@@ -0,0 +1,5 @@
1
+ require "./version"
2
+
3
+ module .
4
+ # Your code goes here...
5
+ end
data/lib/vagrant-gs.rb ADDED
@@ -0,0 +1 @@
1
+ require_relative "vagrant-gs/plugin"
@@ -0,0 +1,111 @@
1
+ require_relative "version"
2
+ require "vagrant"
3
+
4
+ module VagrantPlugins
5
+ module Gs
6
+ class Plugin < Vagrant.plugin("2")
7
+ name "vagrant-down"
8
+ description "This plugin is an alias for the `global-status` command."
9
+
10
+ command :gs do
11
+ Command
12
+ end
13
+
14
+ end
15
+
16
+ class Command < Vagrant.plugin("2", :command)
17
+ def self.synopsis
18
+ 'alias for global-status command'
19
+ end
20
+
21
+ def execute
22
+ options = {}
23
+
24
+ opts = OptionParser.new do |o|
25
+ o.banner = "Usage: vagrant gs [options]"
26
+ o.separator ""
27
+ o.on("--prune", "Prune invalid entries.") do |p|
28
+ options[:prune] = true
29
+ end
30
+ end
31
+
32
+ # Parse the options
33
+ argv = parse_options(opts)
34
+ return if !argv
35
+
36
+ columns = [
37
+ ["id", :id],
38
+ ["name", :name],
39
+ ["provider", :provider],
40
+ ["state", :state],
41
+ ["directory", :vagrantfile_path],
42
+ ]
43
+
44
+ widths = {}
45
+ widths[:id] = 8
46
+ widths[:name] = 6
47
+ widths[:provider] = 6
48
+ widths[:state] = 6
49
+ widths[:vagrantfile_path] = 35
50
+
51
+ entries = []
52
+ prune = []
53
+ @env.machine_index.each do |entry|
54
+ # If we're pruning and this entry is invalid, skip it
55
+ # and prune it later.
56
+ if options[:prune] && !entry.valid?(@env.home_path)
57
+ prune << entry
58
+ next
59
+ end
60
+
61
+ entries << entry
62
+
63
+ columns.each do |_, method|
64
+ # Skip the id
65
+ next if method == :id
66
+
67
+ widths[method] ||= 0
68
+ cur = entry.send(method).to_s.length
69
+ widths[method] = cur if cur > widths[method]
70
+ end
71
+ end
72
+
73
+ # Prune all the entries to prune
74
+ prune.each do |entry|
75
+ deletable = @env.machine_index.get(entry.id)
76
+ @env.machine_index.delete(deletable) if deletable
77
+ end
78
+
79
+ total_width = 0
80
+ columns.each do |header, method|
81
+ header = header.ljust(widths[method]) if widths[method]
82
+ @env.ui.info("#{header} ", new_line: false)
83
+ total_width += header.length + 1
84
+ end
85
+ @env.ui.info("")
86
+ @env.ui.info("-" * total_width)
87
+
88
+ if entries.empty?
89
+ @env.ui.info(I18n.t("vagrant.global_status_none"))
90
+ return 0
91
+ end
92
+
93
+ entries.each do |entry|
94
+ columns.each do |_, method|
95
+ v = entry.send(method).to_s
96
+ v = v[0...7] if method == :id
97
+ v = v.ljust(widths[method]) if widths[method]
98
+ @env.ui.info("#{v} ", new_line: false)
99
+ end
100
+
101
+ @env.ui.info("")
102
+ end
103
+
104
+ @env.ui.info(" \n" + I18n.t("vagrant.global_status_footer"))
105
+
106
+ # Success, exit status 0
107
+ 0
108
+ end
109
+ end
110
+ end
111
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module Gs
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "vagrant-gs/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-gs"
8
+ spec.version = VagrantPlugins::Gs::VERSION
9
+ spec.authors = ["Justin Downing"]
10
+ spec.email = ["justin@downing.us"]
11
+ spec.description = %q{Vagrant global-status alias}
12
+ spec.summary = spec.description
13
+ spec.homepage = "https://github.com/justindowning/vagrant-gs"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-gs
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Justin Downing
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-12 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.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
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: Vagrant global-status alias
42
+ email:
43
+ - justin@downing.us
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ..gemspec
49
+ - .gitignore
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - Vagrantfile
55
+ - lib/..rb
56
+ - lib/vagrant-gs.rb
57
+ - lib/vagrant-gs/plugin.rb
58
+ - lib/vagrant-gs/version.rb
59
+ - vagrant-gs.gemspec
60
+ homepage: https://github.com/justindowning/vagrant-gs
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - '>='
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.0.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: Vagrant global-status alias
84
+ test_files: []