Module: ScaffoldSinatra::Scaffolds

Included in:
Utils
Defined in:
lib/scaffold_sinatra/scaffolds.rb

Constant Summary collapse

BASIC =
1
STANDARD =
2
FULL =
3
FILE_SCAFFOLD =
{
  "app.rb.erb"                       => "basic",
  "config.ru.erb"                    => "basic",
  "public"                           => "basic",
  "public/images"                    => "basic",
  "public/images/ga-favicon.ico"     => "basic",
  "public/images/ga-logo-small.png"  => "basic", # FIXME not working... can't put images in a gem?
  "public/stylesheets"               => "basic",
  "public/stylesheets/style.css.erb" => "basic",
  "readme.md.erb"                    => "basic",
  "views"                            => "basic",
  "views/index.erb.erb"              => "basic",
  "views/layout.erb.erb"             => "basic",
  "Gemfile.erb"                      => "standard",
  "Rakefile"                         => "standard",
  "boot.rb"                          => "full",
  "helpers"                          => "full",
  ".env"                             => "full",
  ".gitignore"                       => "full"
}

Instance Method Summary collapse

Instance Method Details

#scaffold_with_value(value) ⇒ Object



40
41
42
# File 'lib/scaffold_sinatra/scaffolds.rb', line 40

def scaffold_with_value(value)
  scaffolds.key(value)
end

#scaffoldsObject



28
29
30
31
32
33
34
# File 'lib/scaffold_sinatra/scaffolds.rb', line 28

def scaffolds
  context = ScaffoldSinatra::Scaffolds
  @@scaffolds ||= context.constants.reduce({}) do |hash, constant|
    hash[constant.to_s.downcase] = context.const_get(constant)
    hash
  end
end

#value_of(scaffold) ⇒ Object



36
37
38
# File 'lib/scaffold_sinatra/scaffolds.rb', line 36

def value_of(scaffold)
  scaffolds[scaffold]
end