36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/lapis_lazuli/cli.rb', line 36
def config
STDOUT.write <<-INTRO
LapisLazuli searches for configuration files in the `config' subdirectory of
the current working directory, taking the stated test environment into
consideration.
Example:
ENV['TEST_ENV'] = 'production'
load_config("config/config.yml")
Will try to load the following files, in order:
- config/config-production.yml
- config/config-debug.yml
- config/config-test.yml
- config/config-local.yml
- config/config.yml
The first configuration file in the list that is found will be loaded, and its
contents become available via the configuraiton functions.
Supported configuration formats and file name extensions are:
.yml - YAML file
.json - JSON file
In addition to environment-specific configuration files, LapisLazuli supports
the concept of test environments within a single file, where environments are
just top-level keys, e.g.:
production:
- config for the production environment
development:
- config for the development environment
The configuration files can contain any configuration options, but a few are
interpreted by LapisLazuli. Note that instead of specifying these supported
options in the configuraiton file, you may also provide them in the environment
(convert option name to upper case). Environment variables override the
configuration file contents.
INTRO
STDOUT.flush
LapisLazuli::CONFIG_OPTIONS.each do |option, value|
printf "%22s\n", option
display_default = value[0]
if display_default.nil?
display_default = "No default."
else
display_default = "Defaults to '#{display_default}'."
end
printf " #{display_default}\n"
printf " #{value[1]}\n\n"
end
end
|