Module: Cuprum::Cli::Commands::File::Templates

Defined in:
lib/cuprum/cli/commands/file/templates.rb

Overview

Namespace for defining templates for generated files.

Constant Summary collapse

DEFAULT_TEMPLATES =

Default templates used to generate Ruby and RSpec files.

[
  {
    name:      'RSpec File',
    pattern:   RSPEC_PATTERN,
    templates: {
      file_path: '%<root_path>s%<relative_path>s%<base_name>s_spec.rb',
      template:  File.join(TEMPLATES_PATH, 'rspec.rb.erb'),
      types:     %i[ruby rspec spec test]
    }
  },
  {
    name:      'Ruby File (With Spec)',
    pattern:   RUBY_PATTERN,
    templates: [
      {
        file_path: '%<root_path>s%<relative_path>s%<base_name>s.rb',
        template:  File.join(TEMPLATES_PATH, 'ruby.rb.erb'),
        type:      :ruby
      },
      {
        file_path: 'spec/%<relative_path>s%<base_name>s_spec.rb',
        template:  File.join(TEMPLATES_PATH, 'rspec.rb.erb'),
        types:     %i[ruby rspec spec test]
      }
    ]
  }
].then do |ary|
  SleepingKingStudios::Tools::Toolbelt.instance.array_tools.deep_freeze(ary)
end