Class: GGem::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/ggem/template.rb

Instance Method Summary collapse

Constructor Details

#initialize(ggem) ⇒ Template

Returns a new instance of Template.



9
10
11
# File 'lib/ggem/template.rb', line 9

def initialize(ggem)
  @ggem = ggem
end

Instance Method Details

#saveObject



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
# File 'lib/ggem/template.rb', line 13

def save
  save_folder # (gem root path)
  save_folder "lib/#{@ggem.ruby_name}"
  save_folder "test/support"
  save_folder "test/system"
  save_folder "test/unit"
  save_folder "log"
  save_folder "tmp"

  save_file("l.yml.erb",        ".l.yml")
  save_file("t.yml.erb",        ".t.yml")
  save_file("rubocop.yml.erb",  ".rubocop.yml")
  save_file("ruby-version.erb", ".ruby-version")
  save_file("gitignore.erb",    ".gitignore")
  save_file("Gemfile.erb",      "Gemfile")
  save_file("gemspec.erb",      "#{@ggem.name}.gemspec")
  save_file("README.md.erb",    "README.md")
  save_file("LICENSE.erb",      "LICENSE")

  save_file("lib.rb.erb",         "lib/#{@ggem.ruby_name}.rb")
  save_file("lib_version.rb.erb", "lib/#{@ggem.ruby_name}/version.rb")

  save_file("test_helper.rb.erb",          "test/helper.rb")
  save_file("test_support_factory.rb.erb", "test/support/factory.rb")

  save_empty_file("log/.keep")
  save_empty_file("test/system/.keep")
  save_empty_file("test/unit/.keep")
  save_empty_file("tmp/.keep")
end