nugrant 1.4.2 → 2.0.0.dev1
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 +15 -0
- data/.gitignore +1 -2
- data/.travis.yml +0 -6
- data/CHANGELOG.md +3 -79
- data/Gemfile +8 -8
- data/README.md +10 -146
- data/lib/nugrant.rb +4 -19
- data/lib/nugrant/bag.rb +8 -12
- data/lib/nugrant/config.rb +55 -24
- data/lib/nugrant/helper/bag.rb +19 -17
- data/lib/nugrant/parameters.rb +37 -9
- data/lib/nugrant/vagrant/v1/command/parameters.rb +13 -13
- data/lib/nugrant/vagrant/v1/command/root.rb +2 -7
- data/lib/nugrant/vagrant/v1/config/user.rb +1 -10
- data/lib/nugrant/vagrant/v2/command/parameters.rb +1 -1
- data/lib/nugrant/vagrant/v2/command/root.rb +2 -7
- data/lib/nugrant/vagrant/v2/config/user.rb +1 -10
- data/lib/nugrant/version.rb +1 -1
- data/nugrant.gemspec +1 -4
- data/test/lib/nugrant/test_bag.rb +19 -33
- data/test/lib/nugrant/test_config.rb +92 -100
- data/test/lib/nugrant/test_parameters.rb +186 -203
- data/test/resources/README.md +11 -11
- data/test/resources/{vagrantfiles/v1.empty → Vagrantfile.v1.empty} +0 -0
- data/test/resources/{vagrantfiles/v1.fake → Vagrantfile.v1.fake} +0 -0
- data/test/resources/{vagrantfiles/v1.real → Vagrantfile.v1.real} +0 -0
- data/test/resources/{vagrantfiles/v2.empty → Vagrantfile.v2.empty} +0 -0
- data/test/resources/{vagrantfiles/v2.fake → Vagrantfile.v2.fake} +1 -4
- data/test/resources/{vagrantfiles/v2.real → Vagrantfile.v2.real} +0 -0
- data/test/resources/json/params_current_1.json +6 -0
- data/test/resources/json/params_current_2.json +29 -0
- data/test/resources/{yml → yaml}/params_array.yml +0 -0
- data/test/resources/{yml → yaml}/params_boolean.yml +0 -0
- data/test/resources/{yml → yaml}/params_combinations.yml +0 -0
- data/test/resources/yaml/params_current_1.yml +4 -0
- data/test/resources/yaml/params_current_2.yml +23 -0
- data/test/resources/{yml → yaml}/params_defaults_at_root.yml +0 -0
- data/test/resources/{yml → yaml}/params_defaults_not_at_root.yml +0 -0
- data/test/resources/{yml → yaml}/params_empty.yml +0 -0
- data/test/resources/{yml → yaml}/params_list.yml +0 -0
- data/test/resources/{yml → yaml}/params_simple.yml +0 -0
- data/test/resources/{yml → yaml}/params_system_1.yml +0 -0
- data/test/resources/{yml → yaml}/params_system_2.yml +0 -0
- data/test/resources/{yml → yaml}/params_unix_eol.yml +0 -0
- data/test/resources/{yml → yaml}/params_user_1.yml +0 -0
- data/test/resources/{yml → yaml}/params_user_2.yml +0 -0
- data/test/resources/{yml → yaml}/params_windows_eol.yml +0 -0
- metadata +71 -95
- data/lib/nugrant/helper/env/exporter.rb +0 -208
- data/lib/nugrant/helper/env/namer.rb +0 -47
- data/lib/nugrant/helper/stack.rb +0 -86
- data/lib/nugrant/vagrant/errors.rb +0 -27
- data/lib/nugrant/vagrant/v1/command/env.rb +0 -107
- data/lib/nugrant/vagrant/v2/command/env.rb +0 -107
- data/locales/en.yml +0 -13
- data/test/lib/nugrant/helper/env/test_exporter.rb +0 -238
- data/test/lib/nugrant/helper/test_stack.rb +0 -149
- data/test/resources/json/params_project_1.json +0 -6
- data/test/resources/json/params_project_2.json +0 -29
- data/test/resources/json/params_user_nil_values.json +0 -9
- data/test/resources/vagrantfiles/v1.defaults_mixed_string_symbols +0 -18
- data/test/resources/vagrantfiles/v1.defaults_using_string +0 -18
- data/test/resources/vagrantfiles/v1.defaults_using_symbol +0 -18
- data/test/resources/vagrantfiles/v1.missing_parameter +0 -3
- data/test/resources/vagrantfiles/v2.defaults_mixed_string_symbols +0 -20
- data/test/resources/vagrantfiles/v2.defaults_null_values_in_vagrantuser +0 -25
- data/test/resources/vagrantfiles/v2.defaults_using_string +0 -20
- data/test/resources/vagrantfiles/v2.defaults_using_symbol +0 -20
- data/test/resources/vagrantfiles/v2.missing_parameter +0 -5
- data/test/resources/yml/params_project_1.yml +0 -4
- data/test/resources/yml/params_project_2.yml +0 -23
- data/test/resources/yml/params_user_nil_values.yml +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZjIwNTk3YTQ5YjkyNTY5NWNkZjhlZWFlMDRmZGJkNDE4OWNjZGRiYQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
Yjg0NmU5NDc2MzM3ZTk0Yjg3OTkxZDhiZGIzY2YxMDEzYzNmOTk4OA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjBlNmI3MjJhYTJhZGZkYTFjNzA4YjU0ZGMyMjc0YzY4NzZlOGZmNjE1OTYz
|
10
|
+
MjdiNzBmYmFiZjE5NWJjY2I5OGRjZWUxZWY2ZGFhN2EwZDlhMzYyNmNiMTI1
|
11
|
+
ZmZmMjhlODkyMDJmOTM0Y2RiMzJlYzc1MGYwZGZhNzM1MjQ1NDU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
Yjc3YmZkNzk1Y2I1OTNmYTQ2M2Q3NDYyNzlhMTM0MzY4NDI1ODA2OTY1MjRk
|
14
|
+
MGMyMzJkZTMzNWMyODE4NTU5MTkyOGQxNTRmYmJhODZhZDg0ODBmNDY3OTI5
|
15
|
+
OGY0OGNiYWZhOGI5N2Y3MDlhZDk3ZjgwZjIyYzU0ZmQ1MDJiN2I=
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,77 +1,12 @@
|
|
1
|
-
# 1.
|
2
|
-
|
3
|
-
* Fixed Vagrant `user` config class to make the `has?` method
|
4
|
-
available to people using Vagrant. This considered has a bug
|
5
|
-
fix because using `has?` was not working anyway before.
|
6
|
-
|
7
|
-
# 1.4.1 (December 15th, 2013)
|
8
|
-
|
9
|
-
* Fixed a superfluous warning message when using ruby >= 2.0.0 which is now the
|
10
|
-
default when installing Vagrant >= 1.4.0 (at least on Windows).
|
11
|
-
|
12
|
-
# 1.4.0 (November 28th, 2013)
|
13
|
-
|
14
|
-
* Adding support to export to an [autoenv](https://github.com/kennethreitz/autoenv)
|
15
|
-
file. See [GH-13](https://github.com/maoueh/nugrant/issues/13).
|
16
|
-
|
17
|
-
* Deprecated usage of `-s, --script` option for command
|
18
|
-
`vagrant user env`. This was replaced by the more generic
|
19
|
-
and extensible `-f, --format FORMAT` option. The
|
20
|
-
`-s, --script` option will be removed in 2.0.
|
21
|
-
|
22
|
-
# 1.3.0 (November 19th, 2013)
|
23
|
-
|
24
|
-
* Now using [minitest](https://github.com/seattlerb/minitest) as our
|
25
|
-
testing library.
|
26
|
-
|
27
|
-
* Added a new command that can be used either standalone or via
|
28
|
-
a small bash script to easily export environment variables
|
29
|
-
from your currently set parameters. See
|
30
|
-
[GH-13](https://github.com/maoueh/nugrant/issues/13).
|
31
|
-
|
32
|
-
* Keys associated to a null value are considered as being missing
|
33
|
-
by the merge process. It is still possible to define a null
|
34
|
-
parameter, but it will be overridden by any parameter and will not
|
35
|
-
override any. See [GH-12](https://github.com/maoueh/nugrant/issues/12).
|
36
|
-
|
37
|
-
* Fixed output of command `vagrant user parameters`, the keys were
|
38
|
-
serialized as symbol instead of string.
|
39
|
-
|
40
|
-
# 1.2.0 (October 24th, 2013)
|
41
|
-
|
42
|
-
* Now showing better error message to the end-user when a parameter
|
43
|
-
cannot be found. The message displays which key could not be found.
|
44
|
-
Moreover, we show the context within the Vagrantfile where we think
|
45
|
-
the error occurred:
|
46
|
-
|
47
|
-
```
|
48
|
-
Nugrant: Parameter 'param' was not found, is it defined in
|
49
|
-
your .vagrantuser file? Here where we think the error
|
50
|
-
could be in your Vagrantfile:
|
51
|
-
|
52
|
-
1: Vagrant.configure("2") do |config|
|
53
|
-
2:>> puts config.user.param
|
54
|
-
3: end
|
55
|
-
```
|
56
|
-
|
57
|
-
See [GH-8] (https://github.com/maoueh/nugrant/issues/8).
|
58
|
-
|
59
|
-
* Ensured that keys used within a `Bag` are always symbol. This make
|
60
|
-
sure that it is possible to retrieve a value with any access method.
|
61
|
-
See [GH-9](https://github.com/maoueh/nugrant/issues/9).
|
62
|
-
|
63
|
-
* Now using [multi_json](https://rubygems.org/gems/multi_json)
|
64
|
-
for JSON handling.
|
1
|
+
# 1.1.1 (unreleased)
|
65
2
|
|
66
3
|
# 1.1.0 (May 17th, 2013)
|
67
4
|
|
68
5
|
* Rewrite completely classes `Parameters` and `Bag`.
|
69
6
|
* Reduced chances to have a parameter name collapsing with an
|
70
7
|
implementation method.
|
71
|
-
|
72
8
|
* Removed dependency on `deep_merge`. We do now perform
|
73
9
|
our own merge.
|
74
|
-
|
75
10
|
* Added possibility to iterate through keys by using
|
76
11
|
`.each`:
|
77
12
|
|
@@ -84,7 +19,6 @@
|
|
84
19
|
### Backward Incompatibilities
|
85
20
|
|
86
21
|
* `Parameters` is not extending the `Bag` class anymore.
|
87
|
-
|
88
22
|
* `Parameters` and `Bag` attributes and methods are now almost
|
89
23
|
all prefixed with __ to reduce clashes to a minimum when
|
90
24
|
accessing parameters with method-like syntax
|
@@ -93,8 +27,7 @@
|
|
93
27
|
# 1.0.1 (April 9th, 2013)
|
94
28
|
|
95
29
|
* Fixed a crash when `user` config value is `nil` preventing `vagrant user parameters`
|
96
|
-
from working as expected.
|
97
|
-
|
30
|
+
from working as expected. [GH-4](https://github.com/maoueh/nugrant/issues/4)
|
98
31
|
* Fixed a bug preventing the version from being printed when doing `vagrant user -v`.
|
99
32
|
|
100
33
|
# 1.0.0 (March 21th, 2013)
|
@@ -106,7 +39,6 @@
|
|
106
39
|
# 0.0.14
|
107
40
|
|
108
41
|
* Renamed `ParameterBag` to `Bag`
|
109
|
-
|
110
42
|
* Cleanup `Bag` api
|
111
43
|
* Renamed method `has_param?` to `has_key?` in `Bag`
|
112
44
|
* Removed method `get_params` from `Bag`
|
@@ -116,7 +48,6 @@
|
|
116
48
|
* Cleanup `Parameters` and `ParameterBag` interface
|
117
49
|
* The method `defaults` has been removed from the bag
|
118
50
|
* Setting defaults on `Parameters` now recompute the final bag
|
119
|
-
|
120
51
|
* Improved `vagrant user parameters` command
|
121
52
|
* Now using the exact config as seen by Vagrant, this includes defaults parameters
|
122
53
|
* An option has been added to only see defaults parameters
|
@@ -124,11 +55,8 @@
|
|
124
55
|
# 0.0.12
|
125
56
|
|
126
57
|
* Added travis configuration file
|
127
|
-
|
128
58
|
* Added travis build status icon to readme
|
129
|
-
|
130
59
|
* Fixed a bug when `.vagrantuser` file is empty or not a hash type
|
131
|
-
|
132
60
|
* Improved parameters command
|
133
61
|
* The parameters command is now a proper subcommand
|
134
62
|
* An option has been added to see system parameters
|
@@ -142,7 +70,6 @@
|
|
142
70
|
# 0.0.10
|
143
71
|
|
144
72
|
* Added a subcommand `parameters` for vagrant command `user`
|
145
|
-
|
146
73
|
* Added a vagrant command `vagrant user subcommand [options]`
|
147
74
|
|
148
75
|
# 0.0.9
|
@@ -152,9 +79,7 @@
|
|
152
79
|
# 0.0.8
|
153
80
|
|
154
81
|
* Introduced possibility to set default values
|
155
|
-
|
156
|
-
* Introduced restricted keys (For now, restricted keys are [`defaults`]).
|
157
|
-
|
82
|
+
* Introduced restricted keys (For now, restricted keys are [`defaults`])
|
158
83
|
* Fixed a bug with system-wide parameters
|
159
84
|
|
160
85
|
# 0.0.7
|
@@ -172,5 +97,4 @@
|
|
172
97
|
# 0.0.4
|
173
98
|
|
174
99
|
* JSON is now the default file format for parameters (due to problem with YAML)
|
175
|
-
|
176
100
|
* It is now possible to store parameters in the JSON format
|
data/Gemfile
CHANGED
@@ -5,16 +5,16 @@ gemspec
|
|
5
5
|
group :development do
|
6
6
|
vagrant_dependencies = {
|
7
7
|
'v1' => {
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
'home' => "~/.vagrant.d.v1",
|
9
|
+
'gem' => Proc.new do
|
10
|
+
gem "vagrant", "~> 1.0.7"
|
11
|
+
end,
|
12
12
|
},
|
13
13
|
'v2' => {
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
14
|
+
'home' => "~/.vagrant.d",
|
15
|
+
'gem' => Proc.new do
|
16
|
+
gem "vagrant", :git => "git://github.com/mitchellh/vagrant.git"
|
17
|
+
end,
|
18
18
|
},
|
19
19
|
}
|
20
20
|
|
data/README.md
CHANGED
@@ -1,18 +1,8 @@
|
|
1
|
-
# Nugrant
|
2
|
-
|
3
|
-
[][gem]
|
4
|
-
[][travis]
|
5
|
-
[][gemnasium]
|
6
|
-
[][codeclimate]
|
7
|
-
|
8
|
-
[gem]: https://rubygems.org/gems/nugrant
|
9
|
-
[travis]: http://travis-ci.org/maoueh/nugrant
|
10
|
-
[gemnasium]: https://gemnasium.com/maoueh/nugrant
|
11
|
-
[codeclimate]: https://codeclimate.com/github/maoueh/nugrant
|
1
|
+
# Nugrant [](https://travis-ci.org/maoueh/nugrant)
|
12
2
|
|
13
3
|
Nugrant is a library to easily handle parameters that need to be
|
14
4
|
injected into an application via different sources (system, user,
|
15
|
-
|
5
|
+
current, defaults).
|
16
6
|
|
17
7
|
But Nugrant is foremost a Vagrant plugin that will enhance
|
18
8
|
Vagrantfile to allow user specific configuration values. The plugin
|
@@ -27,7 +17,7 @@ If you would like to use Nugrant as a library, simply reference
|
|
27
17
|
it as a dependency of your application. Probably by adding it to
|
28
18
|
your `Gemfile` or your `.gemspec` file.
|
29
19
|
|
30
|
-
|
20
|
+
nugrant ~> 1.0.1
|
31
21
|
|
32
22
|
### Vagrant
|
33
23
|
|
@@ -63,7 +53,7 @@ container, please use this command instead:
|
|
63
53
|
|
64
54
|
> gem install nugrant
|
65
55
|
|
66
|
-
#### Version 1.y.z (latest version tested 1.
|
56
|
+
#### Version 1.y.z (latest version tested 1.1.3)
|
67
57
|
|
68
58
|
In those versions, probably until 2.y.z is out, there
|
69
59
|
is a new way to install and register plugin with the Vagrant
|
@@ -97,9 +87,9 @@ priority will be overridden by values defined on higher priorities).
|
|
97
87
|
1. Defaults
|
98
88
|
2. System
|
99
89
|
3. User
|
100
|
-
4.
|
90
|
+
4. Current
|
101
91
|
|
102
|
-
In text, this means that
|
92
|
+
In text, this means that current parameters overrides user
|
103
93
|
parameters, user parameters overrides system parameters and
|
104
94
|
finally system parameters overrides defaults parameters.
|
105
95
|
|
@@ -116,7 +106,7 @@ and the format of the parameters file.
|
|
116
106
|
### Vagrant
|
117
107
|
|
118
108
|
All examples shown here are for Vagrant 1.1+. They have
|
119
|
-
been tested with Vagrant 1.
|
109
|
+
been tested with Vagrant 1.2.2. Keep this in mind when
|
120
110
|
copying examples.
|
121
111
|
|
122
112
|
Let start with a small use case. Say the git repository you want
|
@@ -201,7 +191,7 @@ That would be equivalent to:
|
|
201
191
|
end
|
202
192
|
|
203
193
|
As you can see, the parameters defined in the second `.vagrantuser` file
|
204
|
-
(the
|
194
|
+
(the current one) overrides settings defined in the `.vagrantuser` found
|
205
195
|
in the home directory (the user one).
|
206
196
|
|
207
197
|
Here the list of locations where Nugrant looks for parameters:
|
@@ -209,12 +199,12 @@ Here the list of locations where Nugrant looks for parameters:
|
|
209
199
|
1. Defaults (via `config.user.defaults` in `Vagrantfile`)
|
210
200
|
2. System (`/etc/.vagrantuser` on Unix, `%PROGRAMDATA%/.vagrantuser` or `%ALLUSERSPROFILE%/.vagrantuser` on Windows)
|
211
201
|
3. Home (`~/.vagrantuser`)
|
212
|
-
4.
|
202
|
+
4. current (`.vagrantuser` within the same folder as the `Vagrantfile`)
|
213
203
|
|
214
204
|
### Paths
|
215
205
|
|
216
206
|
When you want to specify paths on, specially on Windows, it's probably
|
217
|
-
better to only use
|
207
|
+
better to only use foward slash (`/`). The main reason for this is because
|
218
208
|
Ruby, which will be used at the end by Vagrant is able to deal with forward
|
219
209
|
slash even on Windows. This is great because with this, you can avoid
|
220
210
|
values escaping in YAML file. If you need to use backward slash (`\`), don't
|
@@ -223,18 +213,6 @@ forget to properly escape it!
|
|
223
213
|
value: "C:/Users/user/work/git"
|
224
214
|
value: "C:\\Users\\user\\work\\git"
|
225
215
|
|
226
|
-
Moreover, it is preferable that paths are specified in full
|
227
|
-
(i.e. no `~` for HOME directory for example). Normally, they
|
228
|
-
should be handled by `Vagrant` but it may happen that it's not
|
229
|
-
the case. If your have an error with a specific parameter,
|
230
|
-
either expand it in your config:
|
231
|
-
|
232
|
-
project: "/home/joe/work/ruby/git"
|
233
|
-
|
234
|
-
Of expand it in the `Vagrantfile`:
|
235
|
-
|
236
|
-
config.vm.synced_folder File.expand_path(config.user.repository.project), "/git"
|
237
|
-
|
238
216
|
### Parameters access
|
239
217
|
|
240
218
|
Parameters in the `Vagrantfile` can be retrieved via method call
|
@@ -307,120 +285,6 @@ Usage:
|
|
307
285
|
nodes_path: /Users/Chef/kitchen/nodes
|
308
286
|
roles_path: /Users/Chef/kitchen/roles
|
309
287
|
|
310
|
-
Add flag `-h` (or `--help`) for description of the command and a
|
311
|
-
list of available options.
|
312
|
-
|
313
|
-
#### Env
|
314
|
-
|
315
|
-
Sometimes, you would like to have acces to the different values
|
316
|
-
stored in your `.vagrantuser` from environment variables. This
|
317
|
-
command is meant is exactly for this.
|
318
|
-
|
319
|
-
By using one of the three methods below, you will be able to export
|
320
|
-
(but also unset) environment variables from your current
|
321
|
-
parameters as seen by Nugrant.
|
322
|
-
|
323
|
-
You can see the commands that will be executed by simply
|
324
|
-
calling the method:
|
325
|
-
|
326
|
-
vagrant user env
|
327
|
-
|
328
|
-
The name of the environment will be upper cased and full path of
|
329
|
-
the key, without the `config.user` prefix, separated
|
330
|
-
with `_`. For example, the key accessible using
|
331
|
-
`config.user.db.user` and with value `root` would generate the
|
332
|
-
export command:
|
333
|
-
|
334
|
-
export DB_USER=root
|
335
|
-
|
336
|
-
And the unset command:
|
337
|
-
|
338
|
-
unset DB_USER
|
339
|
-
|
340
|
-
The value are escaped so it is possible to define value containing
|
341
|
-
spaces for example.
|
342
|
-
|
343
|
-
A last note about generate commands is that pre-existing environment
|
344
|
-
variable are not taking in consideration by this command. So if
|
345
|
-
an environment variable with name `DB_USER` already exist, it
|
346
|
-
would be overwritten by an export command.
|
347
|
-
|
348
|
-
Add flag `-h` (or `--help`) for description of the command and a
|
349
|
-
list of available options.
|
350
|
-
|
351
|
-
##### Method #1
|
352
|
-
|
353
|
-
If you plan to use frequently this feature, our best suggestion
|
354
|
-
is to create a little bash script that will simply delegates
|
355
|
-
to the real command. By having a bash script that calls the
|
356
|
-
command, you will be able to easily export environment variables
|
357
|
-
by sourcing the script.
|
358
|
-
|
359
|
-
Create a file named `nugrant2env` somewhere accessible from
|
360
|
-
the `$PATH` variable with the following content:
|
361
|
-
|
362
|
-
#!/bin/env sh
|
363
|
-
|
364
|
-
$(vagrant user env "$@")
|
365
|
-
|
366
|
-
This script will simply delegates to the `vagrant user env`
|
367
|
-
command and pass all arguments it receives to it. The
|
368
|
-
magic happens because the command `vagrant user env` outputs
|
369
|
-
the various export commands to the standard output.
|
370
|
-
|
371
|
-
By sourcing the simple delegating bash script, the parameters
|
372
|
-
seen by Nugrant will be available in your environment:
|
373
|
-
|
374
|
-
. nugrant2env
|
375
|
-
|
376
|
-
By default, export commands are generated. But you can pass
|
377
|
-
some options to the `nugrant2env` script, For example, to
|
378
|
-
generate the unset ones, add `--unset` (or simply `-u`).
|
379
|
-
|
380
|
-
. nugrant2env --unset
|
381
|
-
|
382
|
-
For a list of options, see the help of the command delegated
|
383
|
-
to:
|
384
|
-
|
385
|
-
vagrant user env -h
|
386
|
-
|
387
|
-
##### Method #2
|
388
|
-
|
389
|
-
Use the command to generate a base script in the current
|
390
|
-
directory that you will then source:
|
391
|
-
|
392
|
-
vagrant user env --format script
|
393
|
-
|
394
|
-
This will generate a script called `nugrant2env.sh` into the
|
395
|
-
current directory. You then simply source this script:
|
396
|
-
|
397
|
-
. nugrant2env.sh
|
398
|
-
|
399
|
-
Using `vagrant user env -u --format script` will instead generate the bash
|
400
|
-
script that will unset the environment variables. Don't forget
|
401
|
-
to source it to unset variables.
|
402
|
-
|
403
|
-
##### Method #3
|
404
|
-
|
405
|
-
Use the command to generate an [autoenv](https://github.com/kennethreitz/autoenv)
|
406
|
-
file in the current directory. By using the [autoenv] project, anytime you
|
407
|
-
will enter the project directory via the `cd` command, variables
|
408
|
-
exported found in the `.env` file generated will be exported to
|
409
|
-
your environment.
|
410
|
-
|
411
|
-
vagrant user env --format autoenv
|
412
|
-
|
413
|
-
This will generate a file called `.env` in the
|
414
|
-
current directory. You then simply change to the directory
|
415
|
-
where the `.env` file was generated to made exported variables
|
416
|
-
available in your environment.
|
417
|
-
|
418
|
-
cd ..
|
419
|
-
cd <project_dir>
|
420
|
-
|
421
|
-
Using `vagrant user env -u --format autoenv` will instead generate
|
422
|
-
the autoenv file that will unset the environment variables.
|
423
|
-
|
424
288
|
## Contributing
|
425
289
|
|
426
290
|
You can contribute by filling issues when something goes
|
data/lib/nugrant.rb
CHANGED
@@ -2,31 +2,13 @@ require 'pathname'
|
|
2
2
|
require 'nugrant/config'
|
3
3
|
require 'nugrant/parameters'
|
4
4
|
|
5
|
+
# 1.8 Compatibility check
|
5
6
|
unless defined?(KeyError)
|
6
7
|
class KeyError < IndexError
|
7
8
|
end
|
8
9
|
end
|
9
10
|
|
10
|
-
module Nugrant
|
11
|
-
def self.create_parameters(options)
|
12
|
-
config = Nugrant::Config.new(options)
|
13
|
-
|
14
|
-
return Nugrant::Parameters.new(config)
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.setup_i18n()
|
18
|
-
I18n.load_path << File.expand_path("locales/en.yml", Nugrant.source_root)
|
19
|
-
I18n.reload!
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.source_root
|
23
|
-
@source_root ||= Pathname.new(File.expand_path("../../", __FILE__))
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
11
|
if defined?(Vagrant)
|
28
|
-
Nugrant.setup_i18n()
|
29
|
-
|
30
12
|
case
|
31
13
|
when defined?(Vagrant::Plugin::V2)
|
32
14
|
require 'nugrant/vagrant/v2/plugin'
|
@@ -36,3 +18,6 @@ if defined?(Vagrant)
|
|
36
18
|
abort("You are trying to use Nugrant with an unsupported Vagrant version [#{Vagrant::VERSION}]")
|
37
19
|
end
|
38
20
|
end
|
21
|
+
|
22
|
+
module Nugrant
|
23
|
+
end
|