Module: Embryo::GeneratorHelpers::Files
- Included in:
- ApplicationGenerator, PostgresGenerator
- Defined in:
- lib/rails-embryo/generator_helpers/files.rb
Instance Method Summary collapse
- #append_file(path, *args) ⇒ Object
- #application_name ⇒ Object
- #duplicate_file(source, destination) ⇒ Object
- #gitignore(path) ⇒ Object
Instance Method Details
#append_file(path, *args) ⇒ Object
8 9 10 |
# File 'lib/rails-embryo/generator_helpers/files.rb', line 8 def append_file(path, *args) File.exist?(path) ? super : create_file(path, *args) end |
#application_name ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/rails-embryo/generator_helpers/files.rb', line 16 def application_name if Rails.respond_to? :application Rails.application.class.parent_name.underscore else "unknown" end end |
#duplicate_file(source, destination) ⇒ Object
4 5 6 |
# File 'lib/rails-embryo/generator_helpers/files.rb', line 4 def duplicate_file(source, destination) create_file source, File.read(destination) if File.exist? destination end |
#gitignore(path) ⇒ Object
12 13 14 |
# File 'lib/rails-embryo/generator_helpers/files.rb', line 12 def gitignore(path) append_file ".gitignore", "/#{path}\n" end |