Module: FileContents::Sinatra
- Included in:
- SinStruct::Base
- Defined in:
- lib/prestruct/contents.rb
Class Method Summary collapse
- .config ⇒ Object
- .controller(project_name) ⇒ Object
- .gemfile ⇒ Object
- .helpers ⇒ Object
- .layout ⇒ Object
- .model ⇒ Object
- .spec(project_name) ⇒ Object
- .view ⇒ Object
Class Method Details
.config ⇒ Object
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 = " require 'sinatra'\n # view controller\n # routes go here\n FILE\n [\"\#{project_name}.rb\", contents]\nend\n" |
.gemfile ⇒ Object
14 15 16 |
# File 'lib/prestruct/contents.rb', line 14 def gemfile ["Gemfile", "source 'https://rubygems.org'"] end |
.helpers ⇒ Object
57 58 59 |
# File 'lib/prestruct/contents.rb', line 57 def helpers ["helpers.rb", "# helper methods go here"] end |
.layout ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/prestruct/contents.rb', line 29 def layout contents = " <!doctype html>\n <html lang=\"en-US\">\n <head>\n <title>Rec Analyzer</title>\n <meta charset=\"UTF-8\">\n <link rel=\"stylesheet\" type=\"text/css\" href=\"<%= url('/stylesheets/styles.css') %>\"> \n </head>\n <body></body>\n </html>\n FILE\n ['layout.erb', contents]\nend\n" |
.model ⇒ Object
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 |
.view ⇒ Object
22 23 24 25 26 27 |
# File 'lib/prestruct/contents.rb', line 22 def view contents = " <!--view content here-->\n FILE\n [\"view.erb\", contents]\nend\n" |