Class: DiceBag::CommonTemplatesBag

Inherits:
AvailableTemplates show all
Defined in:
lib/dice_bag/templates/gems_checker.rb

Instance Method Summary collapse

Methods inherited from AvailableTemplates

all, checker_within_given_gems?, gem_specs, inherited, template_checkers, template_filename_for, #templates_location

Instance Method Details

#add_template(file, save_as: nil) ⇒ Object



30
31
32
33
# File 'lib/dice_bag/templates/gems_checker.rb', line 30

def add_template(file, save_as: nil)
  pwd = File.dirname(__FILE__)
  @needed_templates.push([File.join(pwd, file), save_as])
end

#templatesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/dice_bag/templates/gems_checker.rb', line 11

def templates
  @needed_templates = []
  configured = Configuration.new

  add_template("dalli.yml.dice") if defined?(Dalli)

  if defined?(Mysql2)
    add_template("databases/mysql.yml.dice", save_as: "database.yml.dice")
  elsif defined?(PG)
    add_template("databases/postgres.yml.dice", save_as: "database.yml.dice")
  end

  add_template("aws.yml.dice") if defined?(AWS)

  add_template("google_analytics.yml.dice") if configured.google_analytics_id

  @needed_templates
end