Module: FileContents::Sinatra

Included in:
SinStruct::Base
Defined in:
lib/prestruct/contents.rb

Class Method Summary collapse

Class Method Details

.configObject



53
54
55
# File 'lib/prestruct/contents.rb', line 53

def config
  ["config.ru", "require 'route_to_controller'\nrun Sinatra::Application"]
end

.controller(project_name) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/prestruct/contents.rb', line 44

def controller(project_name)
  contents = <<~FILE
    require 'sinatra'
    # view controller
    # routes go here
  FILE
  ["#{project_name}.rb", contents]
end

.gemfileObject



14
15
16
# File 'lib/prestruct/contents.rb', line 14

def gemfile
  ["Gemfile", "source 'https://rubygems.org'"]
end

.helpersObject



57
58
59
# File 'lib/prestruct/contents.rb', line 57

def helpers
  ["helpers.rb", "# helper methods go here"]
end

.layoutObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/prestruct/contents.rb', line 29

def layout
  contents = <<~FILE
    <!doctype html>
    <html lang="en-US">
      <head>
        <title>Rec Analyzer</title>
        <meta charset="UTF-8">
        <link rel="stylesheet" type="text/css" href="<%= url('/stylesheets/styles.css') %>"> 
      </head>
      <body></body>
    </html>
  FILE
  ['layout.erb', contents]
end

.modelObject



18
19
20
# File 'lib/prestruct/contents.rb', line 18

def model
  ["model.rb", "# data management classes and code here"]
end

.spec(project_name) ⇒ Object



61
62
63
# File 'lib/prestruct/contents.rb', line 61

def spec(project_name)
  ["#{project_name}_test.rb", "require 'route_to_controller'\n# tests for project go here"]
end

.viewObject



22
23
24
25
26
27
# File 'lib/prestruct/contents.rb', line 22

def view
  contents = <<~FILE
    <!--view content here-->
  FILE
  ["view.erb", contents]
end