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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34a5e474f1bf0c6dea10cfe5d5b13f3c364e9cc8
4
- data.tar.gz: 8388f6793a9f21ba0884974b14066863f2d40058
3
+ metadata.gz: f6178538ee6f9522da94f6ec5273f58d3f1d24c8
4
+ data.tar.gz: c9399075400ce46842b58b10a4761692a970c22d
5
5
  SHA512:
6
- metadata.gz: 7ea970399f9e90a4c7838524a2f5defec648a172f72bc4dea8f61424805e5e3a7a355dae9c58eafc8cd780df3f4c3204344d9b51e21e08388a4a8efc42cca2a7
7
- data.tar.gz: 52142307c7ba46c9635a770f3aa2c3955c7f0f96560ba06d8bbb83924aea060faf69ab1f99e6ff5f15936345d2c860801267e073d6cb6fff661d1eb1c4e5200a
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(read_file(path), path)
19
+ parse_yaml(load_text(path), path)
32
20
  end
33
21
 
34
- def parse_yaml(text, path)
35
- YAML.load(text)
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
- def eval_file(path)
49
- push_base_dir(path) {
50
- instance_eval(File.read(path), path.to_s, 1)
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
- private
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
@@ -97,7 +97,7 @@ module Bricolage
97
97
 
98
98
  def load_variables(path)
99
99
  Variables.define {|vars|
100
- parameter_file_loader.load_eruby_yaml(path).each do |name, value|
100
+ @filesystem.config_file_loader.load_yaml(path).each do |name, value|
101
101
  vars[name] = value
102
102
  end
103
103
  }
@@ -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(load_eruby_yaml(database_yml), @context, @logger)
38
+ DataSourceFactory.new(load_yaml(database_yml), @context, @logger)
39
39
  end
40
40
 
41
41
  def password(name)
@@ -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?
@@ -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.load_eruby_yaml(path)
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.read_file(path)
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}, '')
@@ -1,4 +1,4 @@
1
1
  module Bricolage
2
2
  APPLICATION_NAME = 'Bricolage'
3
- VERSION = '5.9.3'
3
+ VERSION = '5.9.4'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bricolage
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.9.3
4
+ version: 5.9.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Minero Aoki