sal-engine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +88 -0
  4. data/Rakefile +21 -0
  5. data/app/helpers/sal/application_helper.rb +32 -0
  6. data/app/views/layouts/sal/application.html.erb +14 -0
  7. data/config/initializers/error_span.rb +9 -0
  8. data/config/routes.rb +2 -0
  9. data/lib/generators/rails/helperless_scaffold_controller/helperless_scaffold_controller_generator.rb +24 -0
  10. data/lib/generators/rails/helperless_scaffold_controller/templates/controller.rb +62 -0
  11. data/lib/generators/rails/showless_scaffold/showless_scaffold_generator.rb +33 -0
  12. data/lib/generators/rails/showless_scaffold/templates/_form.html.erb +32 -0
  13. data/lib/generators/rails/showless_scaffold/templates/edit.html.erb +3 -0
  14. data/lib/generators/rails/showless_scaffold/templates/index.html.erb +28 -0
  15. data/lib/generators/rails/showless_scaffold/templates/new.html.erb +3 -0
  16. data/lib/sal/engine.rb +13 -0
  17. data/lib/sal/version.rb +3 -0
  18. data/lib/sal.rb +4 -0
  19. data/spec/dummy/README.rdoc +28 -0
  20. data/spec/dummy/Rakefile +6 -0
  21. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  22. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  23. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  24. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  25. data/spec/dummy/app/models/tableless.rb +19 -0
  26. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/dummy/bin/bundle +3 -0
  28. data/spec/dummy/bin/rails +4 -0
  29. data/spec/dummy/bin/rake +4 -0
  30. data/spec/dummy/config/application.rb +29 -0
  31. data/spec/dummy/config/boot.rb +5 -0
  32. data/spec/dummy/config/database.yml +25 -0
  33. data/spec/dummy/config/environment.rb +5 -0
  34. data/spec/dummy/config/environments/development.rb +37 -0
  35. data/spec/dummy/config/environments/production.rb +82 -0
  36. data/spec/dummy/config/environments/test.rb +39 -0
  37. data/spec/dummy/config/initializers/assets.rb +8 -0
  38. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  39. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  40. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  41. data/spec/dummy/config/initializers/inflections.rb +16 -0
  42. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  43. data/spec/dummy/config/initializers/session_store.rb +3 -0
  44. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  45. data/spec/dummy/config/locales/en.yml +23 -0
  46. data/spec/dummy/config/routes.rb +4 -0
  47. data/spec/dummy/config/secrets.yml +22 -0
  48. data/spec/dummy/config.ru +4 -0
  49. data/spec/dummy/log/test.log +4 -0
  50. data/spec/dummy/public/404.html +67 -0
  51. data/spec/dummy/public/422.html +67 -0
  52. data/spec/dummy/public/500.html +66 -0
  53. data/spec/dummy/public/favicon.ico +0 -0
  54. data/spec/helpers/application_helper_spec.rb +71 -0
  55. data/spec/helpers/error_span_spec.rb +33 -0
  56. data/spec/helpers/error_span_view.html.erb +3 -0
  57. data/spec/rails_helper.rb +32 -0
  58. data/spec/spec_helper.rb +74 -0
  59. metadata +225 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bda48f13aeda94fe4fbcb7ff504a4dc7eff8176e
4
+ data.tar.gz: f6718d3ed2f671dcf910d64f0c1d93d86f206afd
5
+ SHA512:
6
+ metadata.gz: 269353a1b3606bc05c5ce2402cabddc81b682a03cf56942d64982508255247abe4d230d0f117ca2030ecd110016be39ed27f242a5a77c06802b15451854a3a6e
7
+ data.tar.gz: 40b706cdc7bc03fcf6474d2727519c063c849b3a7c28b92832b591f8d8a5b35e324ff51f4d3bd3d0464c9f7db4cbfbea05d2acc6170cd0e8d3770dc778a87ade
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2014 Daniel Cruz Horts
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,88 @@
1
+ [![Build Status](https://travis-ci.org/dncrht/sal.svg?branch=master)](https://travis-ci.org/dncrht/sal)
2
+
3
+ # What is this?
4
+
5
+ Sal (salt) is what you add to every meal. I add sal to my Rails projects.
6
+
7
+ I found I always add a particular set of helpers, initializers and generators.
8
+ Better if they're distributed as a Rails engine.
9
+
10
+ # How does it taste?
11
+
12
+ ## messages_bar helper
13
+ Will render:
14
+ ```html
15
+ <div class="alert alert-success">anything</div>
16
+ ```
17
+ …if f`lash[:notice]` contains anything.
18
+
19
+ Will render:
20
+ ```html
21
+ <div class="alert alert-warning">anything</div>
22
+ ```
23
+ …if `flash[:alert]` contains anything.
24
+
25
+ When providing both, `notice` will prevail.
26
+
27
+ ## menu_item helper
28
+ Very handy for navigation menus:
29
+ ```erb
30
+ <%= menu_item 'first' %>First option<% end %>
31
+ <%= menu_item 'second', :div %><%= link_to root_path, 'Second option' %><% end %>
32
+ ```
33
+
34
+ Renders:
35
+ ```html
36
+ <li class="active">First option<li>
37
+ <div><a href="/">Second option</a><div>
38
+ ```
39
+
40
+ Parameters:
41
+ `menu_item(item, tag)`
42
+ - item: item name
43
+ - tag: `:li` by default
44
+
45
+ ## errors_bar helper
46
+ Will indicate if any model in your form has an error. It supports multiple models
47
+ in case you're combining two entities in the same form (i.e. using `fields_for`):
48
+ ```erb
49
+ <%= errors_item @user %>
50
+ ```
51
+
52
+ Renders:
53
+ ```html
54
+ <div class="alert alert-danger">Please correct the highlighted fields.</div>
55
+ ```
56
+
57
+ Parameters:
58
+ `errors_item(model[, model2…])`
59
+ - model: an active record model, or tableless
60
+ - model2: you can provide more than one
61
+
62
+ ## Error messages
63
+ I like to put the error messages right after the field in the form.
64
+ An initializer will patch ActionView::Base to wrap the field with the error message.
65
+ Given a model with an error on, let's say, _title_, we'll get:
66
+ ```html
67
+ <div class="has-error">
68
+ <input type="text" name="title">
69
+ <span class="help-block">⤷ Title can't be blank.</span>
70
+ </div>
71
+ ```
72
+
73
+ ## Generators
74
+ Rails generators are very useful in the initial stages of development to create your admin interfaces.
75
+ In particular:
76
+ - I use bootstrap classes for layout
77
+ - I don't use the _show_ action/view
78
+ - I don't want to autogenerate helper files for every model
79
+
80
+ To launch this generator:
81
+ ```bash
82
+ bundle exec rails generate scaffold MyModel name:string -p --skip-test-framework
83
+ ```
84
+
85
+ ## Interesting, but…
86
+
87
+ It _fits my purposes_, which may be different from yours. You might like the idea
88
+ though: then fork it and call it **peppermint**, **curry** or whatever you prefer!
data/Rakefile ADDED
@@ -0,0 +1,21 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Sal'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('lib/**/*.rb')
14
+ end
15
+
16
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
17
+ load 'rails/tasks/engine.rake'
18
+
19
+
20
+
21
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,32 @@
1
+ module Sal
2
+ module ApplicationHelper
3
+ def errors_bar(*entities)
4
+ entities = Array(entities)
5
+
6
+ if entities.detect { |entity| entity.errors.any? }
7
+ content_tag :div, 'Please correct the highlighted fields.', class: 'alert alert-danger'
8
+ end
9
+ end
10
+
11
+ def messages_bar
12
+ if notice
13
+ content_tag :div, notice.html_safe, class: 'alert alert-success'
14
+ elsif alert
15
+ content_tag :div, alert.html_safe, class: 'alert alert-warning'
16
+ end
17
+ end
18
+
19
+ def menu_item(item, tag = :li)
20
+ options = section == item ? {class: 'active'} : {}
21
+ content_tag tag, options do
22
+ yield
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def section
29
+ content_for(:menu) ? content_for(:menu).strip.downcase : request.params[:controller]
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Sal</title>
5
+ <%= stylesheet_link_tag "sal/application", media: "all" %>
6
+ <%= javascript_include_tag "sal/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,9 @@
1
+ ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
2
+ message = Array(instance.error_message).join(', ')
3
+
4
+ if html_tag =~ /class="checkbox"/ || ((html_tag !~ /type="checkbox"/) && (html_tag !~ /label/))
5
+ %(<div class="has-error">#{html_tag}<span class="help-block">⤷ #{message}</span></div>).html_safe
6
+ else
7
+ %(<div class="has-error">#{html_tag}</div>).html_safe
8
+ end
9
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Sal::Engine.routes.draw do
2
+ end
@@ -0,0 +1,24 @@
1
+ require 'rails/generators/resource_helpers'
2
+
3
+ module Rails
4
+ class HelperlessScaffoldControllerGenerator < Rails::Generators::NamedBase
5
+ include Rails::Generators::ResourceHelpers
6
+
7
+ check_class_collision suffix: "Controller"
8
+
9
+ class_option :orm, banner: "NAME", type: :string, required: true,
10
+ desc: "ORM to generate the controller for"
11
+
12
+ argument :attributes, type: :array, default: [], banner: "field:type field:type"
13
+
14
+ def create_controller_files
15
+ template "controller.rb", File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
16
+ end
17
+
18
+ def self.source_root
19
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
20
+ end
21
+
22
+ hook_for :template_engine, :test_framework, as: :scaffold
23
+ end
24
+ end
@@ -0,0 +1,62 @@
1
+ <% if namespaced? -%>
2
+ require_dependency "<%= namespaced_file_path %>/application_controller"
3
+
4
+ <% end -%>
5
+ <% module_namespacing do -%>
6
+ class <%= controller_class_name %>Controller < ApplicationController
7
+ before_action :set_<%= singular_table_name %>, only: [:edit, :update, :destroy]
8
+
9
+ # GET <%= route_url %>
10
+ def index
11
+ @<%= plural_table_name %> = <%= orm_class.all(class_name) %>
12
+ end
13
+
14
+ # GET <%= route_url %>/new
15
+ def new
16
+ @<%= singular_table_name %> = <%= orm_class.build(class_name) %>
17
+ end
18
+
19
+ # GET <%= route_url %>/1/edit
20
+ def edit; end
21
+
22
+ # POST <%= route_url %>
23
+ def create
24
+ @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
25
+
26
+ if @<%= orm_instance.save %>
27
+ redirect_to <%= index_helper %>_path, notice: <%= "'#{human_name} was successfully created.'" %>
28
+ else
29
+ render :new
30
+ end
31
+ end
32
+
33
+ # PATCH/PUT <%= route_url %>/1
34
+ def update
35
+ if @<%= orm_instance.update("#{singular_table_name}_params") %>
36
+ redirect_to <%= index_helper %>_path, notice: <%= "'#{human_name} was successfully updated.'" %>
37
+ else
38
+ render :edit
39
+ end
40
+ end
41
+
42
+ # DELETE <%= route_url %>/1
43
+ def destroy
44
+ @<%= orm_instance.destroy %>
45
+ redirect_to <%= index_helper %>_path, notice: <%= "'#{human_name} was successfully destroyed.'" %>
46
+ end
47
+
48
+ private
49
+
50
+ def set_<%= singular_table_name %>
51
+ @<%= singular_table_name %> = <%= orm_class.find(class_name, "params[:id]") %>
52
+ end
53
+
54
+ def <%= "#{singular_table_name}_params" %>
55
+ <%- if attributes_names.empty? -%>
56
+ params[:<%= singular_table_name %>]
57
+ <%- else -%>
58
+ params.require(:<%= singular_table_name %>).permit(<%= attributes_names.map { |name| ":#{name}" }.join(', ') %>)
59
+ <%- end -%>
60
+ end
61
+ end
62
+ <% end -%>
@@ -0,0 +1,33 @@
1
+ require 'rails/generators/erb'
2
+ require 'rails/generators/resource_helpers'
3
+
4
+ module Rails
5
+ class ShowlessScaffoldGenerator < Erb::Generators::Base
6
+ include Rails::Generators::ResourceHelpers
7
+
8
+ argument :attributes, type: :array, default: [], banner: "field:type field:type"
9
+
10
+ def create_root_folder
11
+ empty_directory File.join("app/views", controller_file_path)
12
+ end
13
+
14
+ def copy_view_files
15
+ available_views.each do |view|
16
+ formats.each do |format|
17
+ filename = filename_with_extensions(view, format)
18
+ template filename, File.join("app/views", controller_file_path, filename)
19
+ end
20
+ end
21
+ end
22
+
23
+ def self.source_root
24
+ @source_root ||= File.join(File.dirname(__FILE__), 'templates')
25
+ end
26
+
27
+ protected
28
+
29
+ def available_views
30
+ %w(index edit new _form)
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ <%%= form_for(@<%= singular_table_name %>) do |f| %>
2
+ <%%= errors_bar @<%= singular_table_name %> %>
3
+ <div class="row">
4
+ <div class="col-sm-8">
5
+
6
+ <% attributes.each do |attribute| -%>
7
+ <div class="form-group">
8
+ <% if attribute.password_digest? -%>
9
+ <%%= f.label :password %>
10
+ <%%= f.password_field :password, class: 'form-control' %>
11
+ </div>
12
+ <div>
13
+ <%%= f.label :password_confirmation %>
14
+ <%%= f.password_field :password_confirmation, class: 'form-control' %>
15
+ <% else -%>
16
+ <%- if attribute.reference? -%>
17
+ <%%= f.label :<%= attribute.column_name %> %>
18
+ <%%= f.<%= attribute.field_type %> :<%= attribute.column_name %>, class: 'form-control' %>
19
+ <%- else -%>
20
+ <%%= f.label :<%= attribute.name %> %>
21
+ <%%= f.<%= attribute.field_type %> :<%= attribute.name %>, class: 'form-control' %>
22
+ <%- end -%>
23
+ <% end -%>
24
+ </div>
25
+
26
+ <% end -%>
27
+ </div>
28
+ </div>
29
+
30
+ <%%= f.submit 'Save', class: 'btn btn-primary' %>
31
+ <%%= link_to 'Cancel', <%= index_helper %>_path, class: 'btn btn-default' %>
32
+ <%% end %>
@@ -0,0 +1,3 @@
1
+ <h2>Editing <%= singular_table_name %></h2>
2
+
3
+ <%%= render 'form' %>
@@ -0,0 +1,28 @@
1
+ <%%= messages_bar %>
2
+
3
+ <p>
4
+ <%%= link_to 'New <%= singular_table_name %>', new_<%= singular_table_name %>_path, class: 'btn btn-default' %>
5
+ </p>
6
+
7
+ <table class="table table-striped table-bordered">
8
+ <thead>
9
+ <tr>
10
+ <% attributes.reject(&:password_digest?).each do |attribute| -%>
11
+ <th><%= attribute.human_name %></th>
12
+ <% end -%>
13
+ <th colspan="2"></th>
14
+ </tr>
15
+ </thead>
16
+
17
+ <tbody>
18
+ <%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
19
+ <tr>
20
+ <% attributes.reject(&:password_digest?).each do |attribute| -%>
21
+ <td><%%= <%= singular_table_name %>.<%= attribute.name %> %></td>
22
+ <% end -%>
23
+ <td><%%= link_to 'Edit', edit_<%= singular_table_name %>_path(<%= singular_table_name %>) %></td>
24
+ <td><%%= link_to 'Destroy', <%= singular_table_name %>, method: :delete, data: {confirm: 'Are you sure?'} %></td>
25
+ </tr>
26
+ <%% end %>
27
+ </tbody>
28
+ </table>
@@ -0,0 +1,3 @@
1
+ <h2>New <%= singular_table_name %></h2>
2
+
3
+ <%%= render 'form' %>
data/lib/sal/engine.rb ADDED
@@ -0,0 +1,13 @@
1
+ module Sal
2
+ class Engine < ::Rails::Engine
3
+ # We want all the helpers to be used in the app
4
+ #isolate_namespace Sal
5
+
6
+ config.app_generators do |g|
7
+ g.template_engine :showless_scaffold
8
+ g.scaffold_controller :helperless_scaffold_controller
9
+ g.stylesheets false
10
+ g.javascripts false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,3 @@
1
+ module Sal
2
+ VERSION = '0.0.1'
3
+ end
data/lib/sal.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "sal/engine"
2
+
3
+ module Sal
4
+ end
@@ -0,0 +1,28 @@
1
+ == README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
25
+
26
+
27
+ Please feel free to use a different markup language if you do not plan to run
28
+ <tt>rake doc:app</tt>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,19 @@
1
+ class Tableless
2
+ include ActiveModel::Validations
3
+ include ActiveModel::Conversion
4
+ extend ActiveModel::Naming
5
+
6
+ attr_accessor :title
7
+
8
+ validates :title, presence: true
9
+
10
+ def initialize(attributes = {})
11
+ attributes.each do |name, value|
12
+ send("#{name}=", value)
13
+ end
14
+ end
15
+
16
+ def persisted?
17
+ false
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
6
+ <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,29 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ #require 'rails/all'
4
+ require "active_model/railtie"
5
+ #require "active_record/railtie"
6
+ require "action_controller/railtie"
7
+ require "action_mailer/railtie"
8
+ require "action_view/railtie"
9
+ #require "sprockets/railtie"
10
+
11
+ Bundler.require(*Rails.groups)
12
+ require "sal"
13
+
14
+ module Dummy
15
+ class Application < Rails::Application
16
+ # Settings in config/environments/* take precedence over those specified here.
17
+ # Application configuration should go into files in config/initializers
18
+ # -- all .rb files in that directory are automatically loaded.
19
+
20
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
21
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
22
+ # config.time_zone = 'Central Time (US & Canada)'
23
+
24
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
25
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
26
+ # config.i18n.default_locale = :de
27
+ end
28
+ end
29
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,37 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports and disable caching.
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send.
17
+ config.action_mailer.raise_delivery_errors = false
18
+
19
+ # Print deprecation notices to the Rails logger.
20
+ config.active_support.deprecation = :log
21
+
22
+ # Raise an error on page load if there are pending migrations.
23
+ config.active_record.migration_error = :page_load
24
+
25
+ # Debug mode disables concatenation and preprocessing of assets.
26
+ # This option may cause significant delays in view rendering with a large
27
+ # number of complex assets.
28
+ config.assets.debug = true
29
+
30
+ # Adds additional error checking when serving assets at runtime.
31
+ # Checks for improperly declared sprockets dependencies.
32
+ # Raises helpful error messages.
33
+ config.assets.raise_runtime_errors = true
34
+
35
+ # Raises error for missing translations
36
+ # config.action_view.raise_on_missing_translations = true
37
+ end