bricolage 5.9.3 → 5.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bricolage/configloader.rb +18 -22
- data/lib/bricolage/context.rb +1 -1
- data/lib/bricolage/datasource.rb +1 -1
- data/lib/bricolage/filesystem.rb +4 -0
- data/lib/bricolage/jobfile.rb +2 -2
- data/lib/bricolage/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6178538ee6f9522da94f6ec5273f58d3f1d24c8
|
4
|
+
data.tar.gz: c9399075400ce46842b58b10a4761692a970c22d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6843c00f3ce9ebd77541208d856a150860103ef40aae4cb8af225cd04a031f35af3798b6fd1352f29dbeac1d75c2c264114732e65338ff2019af964e66e2a5a0
|
7
|
+
data.tar.gz: f3039246c29a45a74db335f50a857adfeaf94e155c81288248c9d5fd937d81e264d130fc567b4cae67895bc73c5b639574b4e7e3d9fc6d7576090b3f68b6f424
|
@@ -10,31 +10,17 @@ require 'date'
|
|
10
10
|
module Bricolage
|
11
11
|
|
12
12
|
class ConfigLoader
|
13
|
-
def ConfigLoader.load_eruby_yaml(path)
|
14
|
-
new(nil).load_eruby_yaml(path)
|
15
|
-
end
|
16
|
-
|
17
13
|
def initialize(app_home)
|
18
14
|
@app_home = app_home
|
19
15
|
@base_dir = Pathname('.')
|
20
16
|
end
|
21
17
|
|
22
|
-
def load_eruby(path)
|
23
|
-
eruby(read_file(path), path)
|
24
|
-
end
|
25
|
-
|
26
|
-
def load_eruby_yaml(path)
|
27
|
-
parse_yaml(load_eruby(path), path)
|
28
|
-
end
|
29
|
-
|
30
18
|
def load_yaml(path)
|
31
|
-
parse_yaml(
|
19
|
+
parse_yaml(load_text(path), path)
|
32
20
|
end
|
33
21
|
|
34
|
-
def
|
35
|
-
|
36
|
-
rescue => err
|
37
|
-
raise ParameterError, "#{path}: config file syntax error: #{err.message}"
|
22
|
+
def load_text(path)
|
23
|
+
eruby(read_file(path), path)
|
38
24
|
end
|
39
25
|
|
40
26
|
def eruby(text, path)
|
@@ -45,10 +31,12 @@ module Bricolage
|
|
45
31
|
}
|
46
32
|
end
|
47
33
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
34
|
+
private
|
35
|
+
|
36
|
+
def parse_yaml(text, path)
|
37
|
+
YAML.load(text)
|
38
|
+
rescue => err
|
39
|
+
raise ParameterError, "#{path}: config file syntax error: #{err.message}"
|
52
40
|
end
|
53
41
|
|
54
42
|
def read_file(path)
|
@@ -57,7 +45,9 @@ module Bricolage
|
|
57
45
|
raise ParameterError, "could not read file: #{err.message}"
|
58
46
|
end
|
59
47
|
|
60
|
-
|
48
|
+
#
|
49
|
+
# For embedded code
|
50
|
+
#
|
61
51
|
|
62
52
|
include EmbeddedCodeAPI
|
63
53
|
|
@@ -77,6 +67,12 @@ module Bricolage
|
|
77
67
|
@base_dir = saved
|
78
68
|
end
|
79
69
|
end
|
70
|
+
|
71
|
+
# $base_dir + "vars.yml" -> "$base_dir/vars.yml"
|
72
|
+
# $base_dir + "/abs/path/vars.yml" -> "/abs/path/vars.yml"
|
73
|
+
def read_config_file(path)
|
74
|
+
load_text(relative_path(Pathname(path)))
|
75
|
+
end
|
80
76
|
end
|
81
77
|
|
82
78
|
end
|
data/lib/bricolage/context.rb
CHANGED
data/lib/bricolage/datasource.rb
CHANGED
@@ -35,7 +35,7 @@ module Bricolage
|
|
35
35
|
database_yml = @context.config_pathes(basename).detect {|path| path.exist? }
|
36
36
|
raise ParameterError, "database.yml does not exist" unless database_yml
|
37
37
|
@config_dir = database_yml.parent
|
38
|
-
DataSourceFactory.new(
|
38
|
+
DataSourceFactory.new(load_yaml(database_yml), @context, @logger)
|
39
39
|
end
|
40
40
|
|
41
41
|
def password(name)
|
data/lib/bricolage/filesystem.rb
CHANGED
@@ -126,6 +126,10 @@ module Bricolage
|
|
126
126
|
[ "config/#{name}", "config/#{@environment}/#{name}" ].map {|rel| root.relative(rel) }
|
127
127
|
end
|
128
128
|
|
129
|
+
def config_file_loader
|
130
|
+
ConfigLoader.new(home_path)
|
131
|
+
end
|
132
|
+
|
129
133
|
def job_file(id)
|
130
134
|
path = typed_name(id, 'job')
|
131
135
|
return path if path.exist?
|
data/lib/bricolage/jobfile.rb
CHANGED
@@ -8,7 +8,7 @@ module Bricolage
|
|
8
8
|
values = if /\.sql\.job\z/ =~ path.to_s
|
9
9
|
load_embedded_definition(ctx, path)
|
10
10
|
else
|
11
|
-
ctx.parameter_file_loader.
|
11
|
+
ctx.parameter_file_loader.load_yaml(path)
|
12
12
|
end
|
13
13
|
parse(values, path)
|
14
14
|
end
|
@@ -17,7 +17,7 @@ module Bricolage
|
|
17
17
|
private
|
18
18
|
|
19
19
|
def load_embedded_definition(ctx, path)
|
20
|
-
sql = ctx.parameter_file_loader.
|
20
|
+
sql = ctx.parameter_file_loader.load_text(path)
|
21
21
|
block = sql.slice(%r{\A/\*.*?^\*/}m) or
|
22
22
|
raise ParameterError, "missing embedded job definition block: #{path}"
|
23
23
|
yaml = block.sub(%r{\A/\*}, '').sub(%r{^\*/\s*\z}, '')
|
data/lib/bricolage/version.rb
CHANGED