vagrant-environments 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/Vagrantfile +1 -1
- data/environments.yaml +8 -0
- data/lib/vagrant-environments/command.rb +0 -1
- data/lib/vagrant-environments/config.rb +8 -3
- data/lib/vagrant-environments/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4e84e3113c87b2992cf438fbdbed5c70a6a98b7
|
4
|
+
data.tar.gz: c3994b810f3c58bef8ae7df2a9c3b856a2843810
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb0063c2fba8d80eae46204816ac4a067eed93bf0d9ca88f4bc2e1542d6aca011cf6f385e8ddd5f3f734b2f6b49fc446ec4d2ed0e8e1172f8cff40e79e67699
|
7
|
+
data.tar.gz: 7083fab8427e8172ae44f10a0ee811c9ea2392b96dfb04e9ea6811effb977e08827f3797f9d4147800eba5acc06fd9cd0183ecb530c058fc69a2f5bea5adfbf3
|
data/.gitignore
CHANGED
data/Vagrantfile
CHANGED
data/environments.yaml
ADDED
@@ -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[
|
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
|
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.
|
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-
|
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
|