-
Notifications
You must be signed in to change notification settings - Fork 2
/
template.rb
48 lines (37 loc) · 1016 Bytes
/
template.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# frozen_string_literal: true
def source_paths
[__dir__, "#{__dir__}/vendor", "#{__dir__}/templates", "#{__dir__}/docker"]
end
# require dependencies
Dir["#{__dir__}/vendor/**/*.rb"].sort.each { |f| require f }
# Configurable gems
def configurable_gems
@configurable_gems ||= %w[
Annotate
Cors
DatabaseCleaner
DeviseJwt
FactoryBot
LetterOpener
Pundit
RSpec
Rubocop
]
end
# Setup options
opt = ::EtrTemplate::Base.configure(self, configurable_gems)
.merge(sym_options)
# Install and configure template data
::EtrTemplate::Base.install(opt)
# Install gems
::EtrTemplate::Gem.install(opt)
# Init
configurable_gems.map! { |conf_g| "::EtrTemplate::Gems::#{conf_g}".constantize.new(opt) }
# Configure gems
configurable_gems.each(&:install)
# Dockerize
::EtrTemplate::Docker.install(opt)
# # After install and configure template data
::EtrTemplate::Base.after_install(opt)
# # Run after install callbacks
configurable_gems.each(&:after_install)