vagrant-ghost 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b1272341d9841d5f7da7d21cac09cb20fdaca5c
4
- data.tar.gz: 68a981863d585cde147053db205a1666ae4672c2
3
+ metadata.gz: 00e6088d25f9a6bb0f8263c070bc193e1cb6de56
4
+ data.tar.gz: 7280630cbdd5046a72a6c09d65d8fce5671e5955
5
5
  SHA512:
6
- metadata.gz: 9a75231f462e4f1d99c96d792377eff33a4259ae198593244305eee6c22fe5762d93a7bad3ddf50b8f4635c2938e9c3fd0a13bb2be9933dd4a80d47eb496e4bc
7
- data.tar.gz: 0e105a8cddafa500fd491409a00ac2be9463fc09cb87cec329ccf433383cb1cbf145d1d058efb949df8b8300bdd3712a145ce4aeb4127399d46af4d382685594
6
+ metadata.gz: a0947cc9714545dcc268d7c387f46a8c57ad86fa45e4408522c7d807fef878c85bf820cd1cde34530434670f9cc38ef8a32ba3cf8708dcebd8525f653211ad2c
7
+ data.tar.gz: ddf2b6047cbdb3268bfde3ddf62df23c0c6518b336a9dbad3db932a4b832d93dd4824333f561bc706dc0d79d632b265f6ef3b4a48c50f77dc92813c08ee4842d
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Vagrant::Ghost
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/vagrant-ghost.svg)](http://badge.fury.io/rb/vagrant-ghost)
4
+
3
5
  This plugin adds an entry to your /etc/hosts file on the host system.
4
6
 
5
7
  On **up**, **resume** and **reload** commands, it tries to add the information, if its not already in your hosts file. If it needs to be added, you will be asked for an administrator password, since it uses sudo to edit the file.
@@ -25,7 +27,11 @@ At the moment, the only things you need, are the hostname and a :private_network
25
27
  This ip and the hostname will be used for the entry in the /etc/hosts file.
26
28
 
27
29
  ## Changelog
28
-
30
+
31
+ ### 0.1.1
32
+ * Update the CLI to a "primary" command
33
+ * Make sure help doesn't try to fire a host update
34
+
29
35
  ### 0.1.0
30
36
  * Initial release
31
37
 
@@ -3,19 +3,13 @@ module VagrantPlugins
3
3
  class Command < Vagrant.plugin('2', :command)
4
4
  include Ghost
5
5
 
6
- def execute
7
- options = {}
8
- opts = OptionParser.new do |o|
9
- o.banner = 'Usage: vagrant ghost [vm-name]'
10
- o.separator ''
11
-
12
- o.on('--provider provider', String, 'Update machines with the specific provider.') do |provider|
13
- options[:provider] = provider
14
- end
15
- end
6
+ def self.synopsis
7
+ 'manages hosts files internally and externally'
8
+ end
16
9
 
17
- argv = parse_options(opts)
18
- options[:provider] ||= @env.default_provider
10
+ def execute
11
+ cmd, cmd_args, argv, options = parse_args
12
+ cmd && cmd_args or return nil
19
13
 
20
14
  @ui = @env.ui
21
15
 
@@ -47,6 +41,40 @@ module VagrantPlugins
47
41
 
48
42
  false
49
43
  end
44
+
45
+ private
46
+
47
+ def parse_args
48
+ options = {}
49
+ opts = OptionParser.new do |o|
50
+ o.banner = 'Usage: vagrant ghost [vm-name]'
51
+ o.separator ''
52
+
53
+ o.on('-h', '--help', 'Print this help') do
54
+ safe_puts(opts.help)
55
+ end
56
+
57
+ o.on('--provider provider', String, 'Update machines with the specific provider.') do |provider|
58
+ options[:provider] = provider
59
+ end
60
+ end
61
+
62
+ argv = split_main_and_subcommand(@argv.dup)
63
+ exec_args, cmd, cmd_args = argv[0], argv[1], argv[2]
64
+
65
+ # show help
66
+ if !cmd || exec_args.any? { |a| a == '-h' || a == '--help' }
67
+ safe_puts(opts.help)
68
+ return nil
69
+ end
70
+
71
+ options[:provider] ||= @env.default_provider
72
+
73
+ # remove extra "--" arge added by Vagrant
74
+ cmd_args.delete_if { |a| a == '--' }
75
+
76
+ return cmd, cmd_args, parse_options(opts), options
77
+ end
50
78
  end
51
79
  end
52
80
  end
@@ -44,7 +44,7 @@ module VagrantPlugins
44
44
  hook.append(Action::UpdateHosts)
45
45
  end
46
46
 
47
- command(:ghost, primary: false) do
47
+ command(:ghost, primary: true) do
48
48
  require_relative 'command'
49
49
  Command
50
50
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module Ghost
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-ghost
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John P Bloch