biran 0.1.12 → 0.1.13.1
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 +4 -4
- data/config/_my_config.yml.erb +2 -0
- data/config/app_config.yml +13 -0
- data/lib/biran/configurinator.rb +1 -1
- data/lib/biran/version.rb +1 -1
- metadata +30 -24
- data/lib/biran/configurinator.rb.test_changes +0 -155
- data/lib/biran/hash_refinement.rb +0 -19
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ec150cd74d08598ecb7d3bfb1324bf57c15e20806c0143b042b257569f430bf6
|
|
4
|
+
data.tar.gz: 7863cf3face519ede43bb1ca24f569112ad83fe8e686c467141c81a13a0b981d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5464720ba0f9989e9941b77ca1fd54a17388eedd3d044e180689ce58fb7a1da87252e0ccfa09fab514410077ffe18b0a7fbbb52a56a35fce0ebc8ed6b5fb4964
|
|
7
|
+
data.tar.gz: 1edb42ac1ebc49f45d6c60e312a4bd089495fdc11c2c96be0f1f2328f4a8d6bbdb5d14b11dbfe16fae34b8c1ab086b6ee48c82bfe4d0c3d0e8a0400e73a4b907
|
data/lib/biran/configurinator.rb
CHANGED
|
@@ -114,7 +114,7 @@ module Biran
|
|
|
114
114
|
end
|
|
115
115
|
|
|
116
116
|
def sanitize_config_files files_list
|
|
117
|
-
lambda do |file, _|
|
|
117
|
+
lambda do |(file, _)|
|
|
118
118
|
files_list[file] ||= {extension: ''}
|
|
119
119
|
ext = files_list[file].fetch(:extension, '').strip
|
|
120
120
|
ext.prepend('.') unless ext.start_with?('.') || ext.empty?
|
data/lib/biran/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: biran
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.13.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- javierg
|
|
8
8
|
- brlanier
|
|
9
9
|
- seancookr
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: railties
|
|
@@ -44,6 +44,9 @@ dependencies:
|
|
|
44
44
|
name: rails
|
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
|
46
46
|
requirements:
|
|
47
|
+
- - "~>"
|
|
48
|
+
- !ruby/object:Gem::Version
|
|
49
|
+
version: '5.0'
|
|
47
50
|
- - ">="
|
|
48
51
|
- !ruby/object:Gem::Version
|
|
49
52
|
version: 5.0.7
|
|
@@ -51,6 +54,9 @@ dependencies:
|
|
|
51
54
|
prerelease: false
|
|
52
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
53
56
|
requirements:
|
|
57
|
+
- - "~>"
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '5.0'
|
|
54
60
|
- - ">="
|
|
55
61
|
- !ruby/object:Gem::Version
|
|
56
62
|
version: 5.0.7
|
|
@@ -58,58 +64,58 @@ dependencies:
|
|
|
58
64
|
name: bundler
|
|
59
65
|
requirement: !ruby/object:Gem::Requirement
|
|
60
66
|
requirements:
|
|
61
|
-
- - "
|
|
67
|
+
- - "~>"
|
|
62
68
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: '
|
|
69
|
+
version: '2.1'
|
|
64
70
|
type: :development
|
|
65
71
|
prerelease: false
|
|
66
72
|
version_requirements: !ruby/object:Gem::Requirement
|
|
67
73
|
requirements:
|
|
68
|
-
- - "
|
|
74
|
+
- - "~>"
|
|
69
75
|
- !ruby/object:Gem::Version
|
|
70
|
-
version: '
|
|
76
|
+
version: '2.1'
|
|
71
77
|
- !ruby/object:Gem::Dependency
|
|
72
78
|
name: rspec
|
|
73
79
|
requirement: !ruby/object:Gem::Requirement
|
|
74
80
|
requirements:
|
|
75
|
-
- - "
|
|
81
|
+
- - "~>"
|
|
76
82
|
- !ruby/object:Gem::Version
|
|
77
|
-
version: '
|
|
83
|
+
version: '3.7'
|
|
78
84
|
type: :development
|
|
79
85
|
prerelease: false
|
|
80
86
|
version_requirements: !ruby/object:Gem::Requirement
|
|
81
87
|
requirements:
|
|
82
|
-
- - "
|
|
88
|
+
- - "~>"
|
|
83
89
|
- !ruby/object:Gem::Version
|
|
84
|
-
version: '
|
|
90
|
+
version: '3.7'
|
|
85
91
|
- !ruby/object:Gem::Dependency
|
|
86
92
|
name: tapout
|
|
87
93
|
requirement: !ruby/object:Gem::Requirement
|
|
88
94
|
requirements:
|
|
89
|
-
- - "
|
|
95
|
+
- - "~>"
|
|
90
96
|
- !ruby/object:Gem::Version
|
|
91
|
-
version: '0'
|
|
97
|
+
version: '0.4'
|
|
92
98
|
type: :development
|
|
93
99
|
prerelease: false
|
|
94
100
|
version_requirements: !ruby/object:Gem::Requirement
|
|
95
101
|
requirements:
|
|
96
|
-
- - "
|
|
102
|
+
- - "~>"
|
|
97
103
|
- !ruby/object:Gem::Version
|
|
98
|
-
version: '0'
|
|
104
|
+
version: '0.4'
|
|
99
105
|
- !ruby/object:Gem::Dependency
|
|
100
106
|
name: rspec-ontap
|
|
101
107
|
requirement: !ruby/object:Gem::Requirement
|
|
102
108
|
requirements:
|
|
103
|
-
- - "
|
|
109
|
+
- - "~>"
|
|
104
110
|
- !ruby/object:Gem::Version
|
|
105
|
-
version: '0'
|
|
111
|
+
version: '0.3'
|
|
106
112
|
type: :development
|
|
107
113
|
prerelease: false
|
|
108
114
|
version_requirements: !ruby/object:Gem::Requirement
|
|
109
115
|
requirements:
|
|
110
|
-
- - "
|
|
116
|
+
- - "~>"
|
|
111
117
|
- !ruby/object:Gem::Version
|
|
112
|
-
version: '0'
|
|
118
|
+
version: '0.3'
|
|
113
119
|
description: Biran is the guy that will help you generate config files for your rail
|
|
114
120
|
app.
|
|
115
121
|
email:
|
|
@@ -121,14 +127,14 @@ files:
|
|
|
121
127
|
- MIT-LICENSE
|
|
122
128
|
- README.md
|
|
123
129
|
- Rakefile
|
|
130
|
+
- config/_my_config.yml.erb
|
|
131
|
+
- config/app_config.yml
|
|
124
132
|
- lib/biran.rb
|
|
125
133
|
- lib/biran/config.rb
|
|
126
134
|
- lib/biran/config_defaults.rb
|
|
127
135
|
- lib/biran/configurinator.rb
|
|
128
|
-
- lib/biran/configurinator.rb.test_changes
|
|
129
136
|
- lib/biran/erb_config.rb
|
|
130
137
|
- lib/biran/exceptions.rb
|
|
131
|
-
- lib/biran/hash_refinement.rb
|
|
132
138
|
- lib/biran/railtie.rb
|
|
133
139
|
- lib/biran/version.rb
|
|
134
140
|
- lib/tasks/biran_tasks.rake
|
|
@@ -136,7 +142,7 @@ homepage: https://github.com/amco/biran
|
|
|
136
142
|
licenses:
|
|
137
143
|
- MIT
|
|
138
144
|
metadata: {}
|
|
139
|
-
post_install_message:
|
|
145
|
+
post_install_message:
|
|
140
146
|
rdoc_options: []
|
|
141
147
|
require_paths:
|
|
142
148
|
- lib
|
|
@@ -151,8 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
151
157
|
- !ruby/object:Gem::Version
|
|
152
158
|
version: '0'
|
|
153
159
|
requirements: []
|
|
154
|
-
rubygems_version: 3.
|
|
155
|
-
signing_key:
|
|
160
|
+
rubygems_version: 3.2.3
|
|
161
|
+
signing_key:
|
|
156
162
|
specification_version: 4
|
|
157
163
|
summary: Helper for generating config generate tasks.
|
|
158
164
|
test_files: []
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
require 'biran/hash_refinement'
|
|
2
|
-
|
|
3
|
-
module Biran
|
|
4
|
-
class Configurinator
|
|
5
|
-
include ConfigDefaults
|
|
6
|
-
using HashRefinement
|
|
7
|
-
|
|
8
|
-
DEFAULT_ENV = 'development'
|
|
9
|
-
|
|
10
|
-
attr_reader :config, :db_config, :env
|
|
11
|
-
|
|
12
|
-
class << self
|
|
13
|
-
attr_accessor :config
|
|
14
|
-
|
|
15
|
-
def configure
|
|
16
|
-
self.config ||= Config.instance
|
|
17
|
-
yield config
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def initialize(env: nil)
|
|
22
|
-
@env = env || app_env
|
|
23
|
-
@config = build_app_config
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def file_tasks
|
|
27
|
-
files_to_generate.keys
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
def files_to_generate
|
|
31
|
-
@files_to_generate ||= config.fetch(:app, {})
|
|
32
|
-
.fetch(:files_to_generate, configuration.files_to_generate)
|
|
33
|
-
.tap { |files_list| files_list.each(&sanitize_config_files(files_list)) }
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def create(name:, extension:, output_dir: nil, output_name: nil)
|
|
37
|
-
output_dir ||= config_dir
|
|
38
|
-
output_name ||= name
|
|
39
|
-
generated_file = ERBConfig.new(filtered_config, name, extension, config_dir, output_dir, output_name)
|
|
40
|
-
generated_file.bindings = bindings
|
|
41
|
-
generated_file.save!
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
private
|
|
45
|
-
|
|
46
|
-
def build_app_config
|
|
47
|
-
raise 'Environment not set to build the application config' unless @env
|
|
48
|
-
app_config = {
|
|
49
|
-
app_root_dir: app_root,
|
|
50
|
-
app_shared_dir: app_shared_dir,
|
|
51
|
-
app_base_dir: app_base,
|
|
52
|
-
env: env,
|
|
53
|
-
local_config_file: local_config_file,
|
|
54
|
-
secrets_file_path: secrets_file,
|
|
55
|
-
vhost: config_vhost_dirs
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
app_config.deep_merge! app_config_defaults
|
|
59
|
-
app_config[:secrets].deep_merge! get_secret_contents(app_config)
|
|
60
|
-
app_config[:db_config] = build_db_config
|
|
61
|
-
|
|
62
|
-
app_config.deep_merge! local_config_file_contents
|
|
63
|
-
|
|
64
|
-
puts "app config final is #{app_config.inspect}"
|
|
65
|
-
app_config
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def build_db_config
|
|
69
|
-
default_db_config = base_db_config
|
|
70
|
-
return default_db_config unless File.exist? db_config_override_file
|
|
71
|
-
default_db_config.deep_merge! process_config_file(db_config_override_file)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
def base_db_config
|
|
75
|
-
return @base_db_config if @base_db_config
|
|
76
|
-
return @base_db_config = {} unless File.exists? default_db_config_file
|
|
77
|
-
@base_db_config ||= process_config_file(default_db_config_file)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def app_config_defaults
|
|
81
|
-
return @app_config_defaults if @app_config_defaults
|
|
82
|
-
app_config_file = File.join(configuration.config_dirname, configuration.config_filename)
|
|
83
|
-
app_defaults = app_defaults_init.dup
|
|
84
|
-
config_properties = process_config_file(app_config_file)
|
|
85
|
-
@app_config_defaults = app_defaults.deep_merge! config_properties
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def process_config_file(config_file)
|
|
89
|
-
config_file_contents = File.read(config_file)
|
|
90
|
-
config_file_contents = ERB.new(config_file_contents).result
|
|
91
|
-
config_file_contents = YAML.safe_load(config_file_contents, [], [], true)
|
|
92
|
-
#puts "Config file contents after yaml load before env grab #{config_file_contents.inspect}"
|
|
93
|
-
config_file_contents_for_test = config_file_contents['test']
|
|
94
|
-
config_file_contents_for_env = config_file_contents[env]
|
|
95
|
-
puts "Config file contents for test:"
|
|
96
|
-
puts config_file_contents_for_test.to_yaml
|
|
97
|
-
puts
|
|
98
|
-
puts "Config file contents for #{env}:"
|
|
99
|
-
puts config_file_contents_for_env.to_yaml
|
|
100
|
-
puts
|
|
101
|
-
config_file_diff = config_file_contents_for_test.deep_diff(config_file_contents_for_env)
|
|
102
|
-
puts "diff hash is:"
|
|
103
|
-
puts config_file_diff.to_yaml
|
|
104
|
-
puts
|
|
105
|
-
config_file_diff_r = config_file_contents_for_env.deep_diff(config_file_contents_for_test)
|
|
106
|
-
puts "diff hash reversed is:"
|
|
107
|
-
puts config_file_diff_r.to_yaml
|
|
108
|
-
puts
|
|
109
|
-
|
|
110
|
-
config_file_contents_for_env.deep_symbolize_keys!
|
|
111
|
-
rescue Errno::ENOENT
|
|
112
|
-
raise "Missing config file: #{config_file}"
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def config_vhost_dirs
|
|
116
|
-
{
|
|
117
|
-
public_dir: File.join(app_root, vhost_public_dirname),
|
|
118
|
-
shared_dir: app_shared_dir.to_s,
|
|
119
|
-
log_dir: File.join(app_root, 'log'),
|
|
120
|
-
pids_dir: File.join(app_root, 'tmp', 'pids')
|
|
121
|
-
}
|
|
122
|
-
end
|
|
123
|
-
|
|
124
|
-
def local_config_file_contents
|
|
125
|
-
return @local_config_contents if @local_config_contents
|
|
126
|
-
return @local_config_conents = {} unless File.exists? local_config_file
|
|
127
|
-
@local_config_contents = process_config_file(local_config_file)
|
|
128
|
-
end
|
|
129
|
-
|
|
130
|
-
def get_secret_contents(app_config)
|
|
131
|
-
secrets_file_contents = {}
|
|
132
|
-
if File.exist? app_config[:secrets_file_path]
|
|
133
|
-
secrets_file_contents = process_config_file app_config[:secrets_file_path]
|
|
134
|
-
end
|
|
135
|
-
secrets_file_contents
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
def sanitize_config_files files_list
|
|
139
|
-
lambda do |file, _|
|
|
140
|
-
files_list[file] ||= {extension: ''}
|
|
141
|
-
ext = files_list[file].fetch(:extension, '').strip
|
|
142
|
-
ext.prepend('.') unless ext.start_with?('.') || ext.empty?
|
|
143
|
-
files_list[file][:extension] = ext
|
|
144
|
-
end
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
def filtered_config
|
|
148
|
-
@filtered_config ||= config.except(*configuration.app_setup_blocks)
|
|
149
|
-
end
|
|
150
|
-
|
|
151
|
-
def use_capistrano?
|
|
152
|
-
app_config_defaults[:app][:use_capistrano]
|
|
153
|
-
end
|
|
154
|
-
end
|
|
155
|
-
end
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module HashRefinement
|
|
2
|
-
|
|
3
|
-
refine Hash do
|
|
4
|
-
def deep_diff(b)
|
|
5
|
-
a = self
|
|
6
|
-
(a.keys | b.keys).inject({}) do |diff, k|
|
|
7
|
-
if a[k] != b[k]
|
|
8
|
-
if a[k].respond_to?(:deep_diff) && b[k].respond_to?(:deep_diff)
|
|
9
|
-
diff[k] = a[k].deep_diff(b[k])
|
|
10
|
-
else
|
|
11
|
-
#diff[k] = b[k] || a[k]
|
|
12
|
-
diff[k] = b.keys.exclude?(k) ? a[k] : b[k]
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
diff
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|