Module: Rsg

Defined in:
lib/rsg.rb,
lib/rsg/version.rb,
lib/rsg/generators/base.rb,
lib/rsg/generators/actions.rb,
lib/rsg/generators/options.rb

Defined Under Namespace

Modules: Generators

Constant Summary collapse

VERSION =
"0.1.0"
RAILS_VERSION =
"~> 6.1.4"

Class Method Summary collapse

Class Method Details

.app_templates_sourcesObject



7
8
9
10
11
# File 'lib/rsg.rb', line 7

def self.app_templates_sources
  @app_templates_sources ||= [
    Pathname.new(__FILE__).dirname.join("../templates").expand_path
  ]
end

.lookup_app_template(template_name) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rsg.rb', line 13

def self.lookup_app_template(template_name)
  return if template_name =~ %r{^https?\://}
  return if File.exists?(template_name)

  app_templates_sources.each do |src|
    template = "#{src}/#{template_name}.rb"
    return template if File.exists?(template)
  end

  return nil
end