vagrant-address 0.3 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df04df6b6dee6501743d4e6eb22fb9de71c97e85
4
- data.tar.gz: 85c5423af7f31519b7313adcb453634de87836f4
3
+ metadata.gz: e9532d82f2ba884ea5beed44743dce59fbfac60f
4
+ data.tar.gz: 4ad550b1168684267084304d269cb9890d7143ba
5
5
  SHA512:
6
- metadata.gz: d7dcf97416e27cf3b0def20278619810605e626e830d288a70f7294ead3dfb44f57a615c8d0b60c923cf5cf71758fc5a80a30cc5a2626da0863acdaa0822ada2
7
- data.tar.gz: f87da989642b7ac2e87a1a7bd6b700fc88c5802f5aece0ea4762bd87e9e62baccfdc88a5fc2ecaacfccc5a052c38af05f374a01c7de44f1f5c170bdedd529739
6
+ metadata.gz: 7b81f0fbb7ae8eb82b03143fd1f3473a2c2240aa106166020a7b639f5fff44f9063e1d338c1fb0a2793c2c819582eac9c59e2f448dceec1694d339043498bbf6
7
+ data.tar.gz: de777fa3c408a5d6edb103f614e05bcdcfaef6c0bca5db390812824e053b172b4bd0071ff6c55245253deebcdef184684d13299c47299981f732f11c8a6d7d2b
@@ -16,6 +16,14 @@ module VagrantPlugins
16
16
 
17
17
  with_target_vms(argv, {:single_target=>true}) do |machine|
18
18
  ip = machine.provider.capability(:public_address)
19
+
20
+ if machine.state.id != :running
21
+ raise ::VagrantPlugins::CommandAddress::Errors::NotRunning
22
+ end
23
+ if ip == nil
24
+ raise ::VagrantPlugins::CommandAddress::Errors::Unknown
25
+ end
26
+
19
27
  message = ENV['TEAMCITY_VERSION'] ? "##teamcity[setParameter name='env.VAGRANT_ADDRESS' value='#{ip}']" : ip
20
28
  @env.ui.info(message)
21
29
  end
@@ -0,0 +1,16 @@
1
+ module VagrantPlugins
2
+ module CommandAddress
3
+ module Errors
4
+ class AddressError < Vagrant::Errors::VagrantError
5
+ error_namespace("vagrant_address.errors")
6
+ end
7
+
8
+ class NotRunning < AddressError
9
+ error_key(:not_running)
10
+ end
11
+ class Unknown < AddressError
12
+ error_key(:unknown)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ en:
2
+ vagrant_address:
3
+ errors:
4
+ not_running: |-
5
+ A machine is not running
6
+ unknown: |-
7
+ The address is unknown. Refer to https://github.com/mkuzmin/vagrant-address/issues/5
@@ -2,6 +2,8 @@ require "vagrant"
2
2
 
3
3
  module VagrantPlugins
4
4
  module CommandAddress
5
+ autoload :Errors, File.expand_path("../errors", __FILE__)
6
+
5
7
  class Plugin < Vagrant.plugin("2")
6
8
  name "address"
7
9
  description <<-DESC
@@ -10,8 +12,19 @@ module VagrantPlugins
10
12
 
11
13
  command("address", primary: false) do
12
14
  require_relative "command"
15
+ init!
13
16
  Command
14
17
  end
18
+
19
+ protected
20
+
21
+ def self.init!
22
+ return if defined?(@_init)
23
+ I18n.load_path << File.expand_path("../locales/en.yml", __FILE__)
24
+ I18n.reload!
25
+ @_init = true
26
+ end
27
+
15
28
  end
16
29
  end
17
30
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'vagrant-address'
3
- spec.version = '0.3'
3
+ spec.version = '0.3.1'
4
4
  spec.authors = ['Michael Kuzmin']
5
5
  spec.email = ['mkuzmin@gmail.com']
6
6
  spec.summary = 'Vagrant plugin for obtaining IP address of a guest machine'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-address
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.3'
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Kuzmin
@@ -52,6 +52,8 @@ files:
52
52
  - README.md
53
53
  - Rakefile
54
54
  - lib/command.rb
55
+ - lib/errors.rb
56
+ - lib/locales/en.yml
55
57
  - lib/vagrant-address.rb
56
58
  - vagrant-address.gemspec
57
59
  homepage: https://github.com/mkuzmin/vagrant-address