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



34
35
36
37
# File 'lib/dice_bag/templates/gems_checker.rb', line 34

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

#templatesObject



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

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

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

  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

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

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

  @needed_templates
end