vagrant-environments 0.1.3 → 0.1.4

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: 79f7661386f8b726207b77bde35bf8e3e9bf4d0e
4
- data.tar.gz: 5545e893e4dd9efc3fc864a1a96320e01993f88e
3
+ metadata.gz: d4e84e3113c87b2992cf438fbdbed5c70a6a98b7
4
+ data.tar.gz: c3994b810f3c58bef8ae7df2a9c3b856a2843810
5
5
  SHA512:
6
- metadata.gz: 6422aa3bfbfe4d4e1217427316dc8c3a799b71291088a49cee719b82e3a0d4564bbd8887b2d4468b203ebb57a40f77679187927a6db5e04efbbfab0a55d5e179
7
- data.tar.gz: 58c17507231d67b0d8144bddf5e0ed74000c5ce3a0719e693e9ee76b6689f92148516dce80e32802f274011e1060be50f0a54caedf247ba7dcb336e187577e3c
6
+ metadata.gz: 0bb0063c2fba8d80eae46204816ac4a067eed93bf0d9ca88f4bc2e1542d6aca011cf6f385e8ddd5f3f734b2f6b49fc446ec4d2ed0e8e1172f8cff40e79e67699
7
+ data.tar.gz: 7083fab8427e8172ae44f10a0ee811c9ea2392b96dfb04e9ea6811effb977e08827f3797f9d4147800eba5acc06fd9cd0183ecb530c058fc69a2f5bea5adfbf3
data/.gitignore CHANGED
@@ -5,4 +5,4 @@
5
5
  Gemfile.lock
6
6
  results.html
7
7
  .yaml
8
- .gem
8
+ *.gem
data/Vagrantfile CHANGED
@@ -1,5 +1,5 @@
1
1
  Vagrant.configure("2") do |config|
2
-
2
+ config.environments.default_environment = "local"
3
3
  config.environment.define config do |machine, options, env_settings|
4
4
  machine.vm.network :private_network, ip: options["ip"]
5
5
 
data/environments.yaml ADDED
@@ -0,0 +1,8 @@
1
+ ---
2
+ local:
3
+ configs:
4
+ chef_environment: "local"
5
+ machines:
6
+ server:
7
+ ip: "172.30.10.10"
8
+ cpu: 1
@@ -16,7 +16,6 @@ module Vagrant
16
16
  # If this method returns `nil`, then you should assume that help
17
17
  # was printed and parsing failed.
18
18
  def parse_options(opts=nil)
19
- p "Overriden-----------------------------------------"
20
19
  # Creating a shallow copy of the arguments so the OptionParser
21
20
  # doesn't destroy the originals.
22
21
  argv = @argv
@@ -3,7 +3,7 @@ require 'yaml'
3
3
  module VagrantPlugins
4
4
  module Environments
5
5
  class Config < Vagrant.plugin(2, :config)
6
- attr_accessor :file, :active
6
+ attr_accessor :file, :active, :default_environment
7
7
  attr_reader :data
8
8
 
9
9
  DEFAULT_SETTINGS = {
@@ -13,6 +13,7 @@ module VagrantPlugins
13
13
  def initialize
14
14
  @file = UNSET_VALUE
15
15
  @active = UNSET_VALUE
16
+ @default_environment = UNSET_VALUE
16
17
  end
17
18
 
18
19
  def file=(path)
@@ -23,6 +24,8 @@ module VagrantPlugins
23
24
 
24
25
  if @active == UNSET_VALUE && !ENV['VAGRANT_ENVIRONMENT'].nil?
25
26
  @active = ENV['VAGRANT_ENVIRONMENT']
27
+ elsif
28
+ @active = @default_environment
26
29
  end
27
30
 
28
31
  @active
@@ -32,18 +35,21 @@ module VagrantPlugins
32
35
  def data
33
36
  validate(nil)
34
37
  environments = YAML.load_file(@file)
35
- environments[@active]
38
+ environments[active]
36
39
  end
37
40
 
38
41
  def validate(_)
39
42
  finalize!
40
43
  errors = _detected_errors
41
44
 
45
+ errors.push("Please define default environment") if @default_environment == UNSET_VALUE
46
+
42
47
  if File.file?(@file)
43
48
 
44
49
  begin
45
50
  environments = YAML.load_file(@file)
46
51
  errors.push("There is no #{@active} environment in #{@file}") unless environments.has_key?(@active)
52
+
47
53
  rescue Exception
48
54
  errors.push("file #{@file} have wrong format")
49
55
  end
@@ -60,7 +66,6 @@ module VagrantPlugins
60
66
  active
61
67
  end
62
68
 
63
-
64
69
  end #Config
65
70
  end #Envrionments
66
71
  end # VagrantPlugins
@@ -1,7 +1,7 @@
1
1
  module VagrantPlugins
2
2
  module Environments
3
3
 
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.4'
5
5
 
6
6
  end # Environments
7
7
  end # VagrantPlugins
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-environments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Rodionov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Vagrant plugin to config muiltiple environments (dev, test, stage, prod)
14
14
  email: goruha@gmail.com
@@ -25,6 +25,7 @@ files:
25
25
  - Rakefile
26
26
  - Vagrantfile
27
27
  - cucumber.yml
28
+ - environments.yaml
28
29
  - features/step_definitions/steps.rb
29
30
  - features/support/env.rb
30
31
  - features/vagrant-exec.feature