curupira 0.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of curupira might be problematic. Click here for more details.

Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +19 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +17 -0
  6. data/Gemfile.lock +202 -0
  7. data/README.md +72 -0
  8. data/Rakefile +31 -0
  9. data/app/controllers/curupira/authorized_controller.rb +9 -0
  10. data/app/controllers/curupira/groups_controller.rb +43 -0
  11. data/app/controllers/curupira/passwords_controller.rb +46 -0
  12. data/app/controllers/curupira/roles_controller.rb +43 -0
  13. data/app/controllers/curupira/sessions_controller.rb +30 -0
  14. data/app/controllers/curupira/users_controller.rb +47 -0
  15. data/app/helpers/curupira/authorize_helper.rb +21 -0
  16. data/app/helpers/curupira/relationship_select_options_helper.rb +17 -0
  17. data/app/mailers/curupira/reset_password_mailer.rb +13 -0
  18. data/app/views/curupira/groups/_form.html.erb +28 -0
  19. data/app/views/curupira/groups/_role_group_fields.html.erb +9 -0
  20. data/app/views/curupira/groups/edit.html.erb +3 -0
  21. data/app/views/curupira/groups/index.html.erb +24 -0
  22. data/app/views/curupira/groups/new.html.erb +3 -0
  23. data/app/views/curupira/groups/show.html.erb +32 -0
  24. data/app/views/curupira/passwords/edit.html.erb +14 -0
  25. data/app/views/curupira/passwords/new.html.erb +14 -0
  26. data/app/views/curupira/reset_password_mailer/instructions.html.erb +19 -0
  27. data/app/views/curupira/reset_password_mailer/reseted.html.erb +7 -0
  28. data/app/views/curupira/roles/_authorization_fields.html.erb +10 -0
  29. data/app/views/curupira/roles/_form.html.erb +23 -0
  30. data/app/views/curupira/roles/edit.html.erb +3 -0
  31. data/app/views/curupira/roles/index.html.erb +24 -0
  32. data/app/views/curupira/roles/new.html.erb +3 -0
  33. data/app/views/curupira/roles/show.html.erb +37 -0
  34. data/app/views/curupira/sessions/new.html.erb +17 -0
  35. data/app/views/curupira/shared/_model_links.html.erb +7 -0
  36. data/app/views/curupira/shared/_session_links.html.erb +7 -0
  37. data/app/views/curupira/users/_form.html.erb +43 -0
  38. data/app/views/curupira/users/_group_user_fields.html.erb +20 -0
  39. data/app/views/curupira/users/_role_group_user_fields.html.erb +10 -0
  40. data/app/views/curupira/users/edit.html.erb +3 -0
  41. data/app/views/curupira/users/index.html.erb +28 -0
  42. data/app/views/curupira/users/new.html.erb +3 -0
  43. data/app/views/curupira/users/show.html.erb +28 -0
  44. data/curupira.gemspec +28 -0
  45. data/lib/curupira.rb +16 -0
  46. data/lib/curupira/authorizer.rb +43 -0
  47. data/lib/curupira/rails.rb +30 -0
  48. data/lib/curupira/rails/routes.rb +15 -0
  49. data/lib/curupira/version.rb +3 -0
  50. data/lib/generators/curupira/controllers/controllers_generator.rb +27 -0
  51. data/lib/generators/curupira/install/install_generator.rb +80 -0
  52. data/lib/generators/curupira/install/model_generators_helper.rb +266 -0
  53. data/lib/generators/curupira/routes/routes_generator.rb +21 -0
  54. data/lib/generators/curupira/routes/templates/routes.rb +1 -0
  55. data/lib/generators/curupira/templates/db/migrate/add_curupira_to_users.rb +20 -0
  56. data/lib/generators/curupira/templates/db/migrate/create_action_labels.rb +12 -0
  57. data/lib/generators/curupira/templates/db/migrate/create_authorizations.rb +12 -0
  58. data/lib/generators/curupira/templates/db/migrate/create_features.rb +11 -0
  59. data/lib/generators/curupira/templates/db/migrate/create_group_users.rb +13 -0
  60. data/lib/generators/curupira/templates/db/migrate/create_groups.rb +10 -0
  61. data/lib/generators/curupira/templates/db/migrate/create_role_group_users.rb +12 -0
  62. data/lib/generators/curupira/templates/db/migrate/create_role_groups.rb +13 -0
  63. data/lib/generators/curupira/templates/db/migrate/create_roles.rb +8 -0
  64. data/lib/generators/curupira/templates/db/migrate/sorcery_core.rb +27 -0
  65. data/lib/generators/curupira/templates/models/action_label.rb +2 -0
  66. data/lib/generators/curupira/templates/models/authorization.rb +2 -0
  67. data/lib/generators/curupira/templates/models/feature.rb +2 -0
  68. data/lib/generators/curupira/templates/models/feature_service.rb +4 -0
  69. data/lib/generators/curupira/templates/models/group.rb +2 -0
  70. data/lib/generators/curupira/templates/models/group_user.rb +2 -0
  71. data/lib/generators/curupira/templates/models/role.rb +2 -0
  72. data/lib/generators/curupira/templates/models/role_group.rb +2 -0
  73. data/lib/generators/curupira/templates/models/role_group_user.rb +2 -0
  74. data/lib/generators/curupira/templates/models/service.rb +2 -0
  75. data/lib/generators/curupira/templates/models/user.rb +2 -0
  76. data/lib/generators/curupira/templates/sorcery.rb +462 -0
  77. data/lib/generators/curupira/views/views_generator.rb +27 -0
  78. data/lib/tasks/curupira_tasks.rake +4 -0
  79. data/spec/app_templates/app/models/action_label.rb +2 -0
  80. data/spec/app_templates/app/models/authorization.rb +2 -0
  81. data/spec/app_templates/app/models/feature.rb +2 -0
  82. data/spec/app_templates/app/models/feature_service.rb +2 -0
  83. data/spec/app_templates/app/models/group.rb +4 -0
  84. data/spec/app_templates/app/models/group_user.rb +2 -0
  85. data/spec/app_templates/app/models/role.rb +2 -0
  86. data/spec/app_templates/app/models/role_group.rb +2 -0
  87. data/spec/app_templates/app/models/role_group_user.rb +2 -0
  88. data/spec/app_templates/app/models/service.rb +2 -0
  89. data/spec/app_templates/app/models/user.rb +2 -0
  90. data/spec/app_templates/config/routes.rb +3 -0
  91. data/spec/controllers/controller_spec.rb +40 -0
  92. data/spec/controllers/groups_controller_spec.rb +162 -0
  93. data/spec/controllers/passwords_controller_spec.rb +171 -0
  94. data/spec/controllers/roles_controller_spec.rb +168 -0
  95. data/spec/controllers/sessions_controller_spec.rb +112 -0
  96. data/spec/controllers/users_controller_spec.rb +182 -0
  97. data/spec/curupira/authorization_spec.rb +67 -0
  98. data/spec/dummy/README.rdoc +28 -0
  99. data/spec/dummy/Rakefile +6 -0
  100. data/spec/dummy/app/assets/images/.keep +0 -0
  101. data/spec/dummy/app/assets/javascripts/application.js +15 -0
  102. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  103. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  104. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  105. data/spec/dummy/app/controllers/home_controller.rb +4 -0
  106. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  107. data/spec/dummy/app/mailers/.keep +0 -0
  108. data/spec/dummy/app/models/.keep +0 -0
  109. data/spec/dummy/app/models/action_label.rb +3 -0
  110. data/spec/dummy/app/models/authorization.rb +4 -0
  111. data/spec/dummy/app/models/feature.rb +3 -0
  112. data/spec/dummy/app/models/group.rb +9 -0
  113. data/spec/dummy/app/models/group_user.rb +7 -0
  114. data/spec/dummy/app/models/role.rb +10 -0
  115. data/spec/dummy/app/models/role_group.rb +4 -0
  116. data/spec/dummy/app/models/role_group_user.rb +4 -0
  117. data/spec/dummy/app/models/user.rb +10 -0
  118. data/spec/dummy/app/views/home/index.html.erb +5 -0
  119. data/spec/dummy/app/views/home/test.html.erb +1 -0
  120. data/spec/dummy/app/views/layouts/application.html.erb +19 -0
  121. data/spec/dummy/bin/bundle +3 -0
  122. data/spec/dummy/bin/rails +4 -0
  123. data/spec/dummy/bin/rake +4 -0
  124. data/spec/dummy/bin/setup +29 -0
  125. data/spec/dummy/config.ru +4 -0
  126. data/spec/dummy/config/application.rb +25 -0
  127. data/spec/dummy/config/boot.rb +5 -0
  128. data/spec/dummy/config/database.yml +25 -0
  129. data/spec/dummy/config/environment.rb +5 -0
  130. data/spec/dummy/config/environments/development.rb +46 -0
  131. data/spec/dummy/config/environments/production.rb +79 -0
  132. data/spec/dummy/config/environments/test.rb +44 -0
  133. data/spec/dummy/config/initializers/assets.rb +11 -0
  134. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  135. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  136. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  137. data/spec/dummy/config/initializers/inflections.rb +16 -0
  138. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  139. data/spec/dummy/config/initializers/session_store.rb +3 -0
  140. data/spec/dummy/config/initializers/sorcery.rb +462 -0
  141. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  142. data/spec/dummy/config/locales/en.yml +23 -0
  143. data/spec/dummy/config/routes.rb +6 -0
  144. data/spec/dummy/config/secrets.yml +22 -0
  145. data/spec/dummy/db/migrate/20150305011941_create_role_group_users.rb +12 -0
  146. data/spec/dummy/db/migrate/20150305011942_create_authorizations.rb +12 -0
  147. data/spec/dummy/db/migrate/20150305011944_create_groups.rb +10 -0
  148. data/spec/dummy/db/migrate/20150305011945_create_roles.rb +8 -0
  149. data/spec/dummy/db/migrate/20150305011946_sorcery_core.rb +27 -0
  150. data/spec/dummy/db/migrate/20150305011947_create_group_users.rb +13 -0
  151. data/spec/dummy/db/migrate/20150305011948_create_role_groups.rb +13 -0
  152. data/spec/dummy/db/migrate/20150312181229_create_action_labels.rb +12 -0
  153. data/spec/dummy/db/migrate/20150312181747_create_features.rb +11 -0
  154. data/spec/dummy/db/schema.rb +112 -0
  155. data/spec/dummy/db/seeds.rb +137 -0
  156. data/spec/dummy/lib/assets/.keep +0 -0
  157. data/spec/dummy/log/.keep +0 -0
  158. data/spec/dummy/public/404.html +67 -0
  159. data/spec/dummy/public/422.html +67 -0
  160. data/spec/dummy/public/500.html +66 -0
  161. data/spec/dummy/public/favicon.ico +0 -0
  162. data/spec/features/link_authorize_spec.rb +25 -0
  163. data/spec/features/list_users_spec.rb +38 -0
  164. data/spec/features/log_in_spec.rb +15 -0
  165. data/spec/generators/curupira/install/action_label_spec.rb +53 -0
  166. data/spec/generators/curupira/install/authorization_generator_spec.rb +51 -0
  167. data/spec/generators/curupira/install/feature_generator_spec.rb +52 -0
  168. data/spec/generators/curupira/install/group_user_generator_spec.rb +51 -0
  169. data/spec/generators/curupira/install/install_generators_spec.rb +159 -0
  170. data/spec/generators/curupira/install/role_generator_spec.rb +38 -0
  171. data/spec/generators/curupira/install/role_group_generator_spec.rb +51 -0
  172. data/spec/generators/curupira/install/role_group_user_generator_spec.rb +52 -0
  173. data/spec/helpers/relationship_select_options_helper_spec.rb +18 -0
  174. data/spec/rails_helper.rb +55 -0
  175. data/spec/spec_helper.rb +87 -0
  176. data/spec/support/factories.rb +64 -0
  177. data/spec/support/generator_spec_helpers.rb +42 -0
  178. data/spec/support/helpers_spec.rb +23 -0
  179. data/spec/support/shared_examples/role_generator_shared_example_spec.rb +13 -0
  180. data/spec/support/sorcery.rb +4 -0
  181. metadata +539 -0
@@ -0,0 +1,67 @@
1
+ require 'rails_helper'
2
+ require "curupira/authorizer"
3
+
4
+ describe Curupira::Authorizer do
5
+ include Curupira::Authorizer
6
+
7
+ describe "#has_authorization?" do
8
+
9
+ describe "user is admin" do
10
+ let(:params) do
11
+ {
12
+ controller: "users",
13
+ action: "create"
14
+ }
15
+ end
16
+
17
+ let!(:current_user) { FactoryGirl.create(:user, admin: true) }
18
+
19
+ it { expect(has_authorization?).to be true }
20
+ end
21
+
22
+ describe "user have role_a and belongs to group_a" do
23
+ subject!(:current_user) { FactoryGirl.create(:user) }
24
+
25
+ before do
26
+ setup_authorization(current_user, "users", "create")
27
+ end
28
+
29
+ context "when role_a belongs to group_a" do
30
+
31
+ let(:params) do
32
+ {
33
+ controller: "users",
34
+ action: "create"
35
+ }
36
+ end
37
+
38
+ it "have authorization to access the feature_a" do
39
+ expect(has_authorization?).to be true
40
+ end
41
+ end
42
+
43
+ context "when role_a belongs to group_b" do
44
+ let(:params) do
45
+ {
46
+ controller: "users",
47
+ action: "report"
48
+ }
49
+ end
50
+
51
+ let!(:group_b) { FactoryGirl.create(:group, name: "Group B") }
52
+ let!(:role_b) { FactoryGirl.create(:role, name: "Role B") }
53
+
54
+ before do
55
+ role_a = Role.first
56
+ FactoryGirl.create(:role_group, role: role_a, group: group_b)
57
+ group_user = FactoryGirl.create(:group_user, user: current_user, group: group_b)
58
+ FactoryGirl.create(:role_group_user, role: role_b, group_user: group_user)
59
+ end
60
+
61
+ it "don't have authorization to access the feature_a" do
62
+ expect(has_authorization?).to be false
63
+ end
64
+ end
65
+ end
66
+ end
67
+ 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
File without changes
@@ -0,0 +1,15 @@
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 any plugin's vendor/assets/javascripts directory 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 jquery
14
+ //= require cocoon
15
+ //= 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 any plugin's vendor/assets/stylesheets directory 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
File without changes
@@ -0,0 +1,4 @@
1
+ class HomeController < ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ class ActionLabel < ActiveRecord::Base
2
+ belongs_to :feature
3
+ end
@@ -0,0 +1,4 @@
1
+ class Authorization < ActiveRecord::Base
2
+ belongs_to :feature
3
+ belongs_to :role
4
+ end
@@ -0,0 +1,3 @@
1
+ class Feature < ActiveRecord::Base
2
+ has_many :action_labels
3
+ end
@@ -0,0 +1,9 @@
1
+ class Group < ActiveRecord::Base
2
+ validates_presence_of :name
3
+ has_many :group_users
4
+ has_many :role_groups
5
+ has_many :roles, through: :role_groups
6
+ has_many :users, through: :group_users
7
+ accepts_nested_attributes_for :role_groups, reject_if: :all_blank, allow_destroy: :true
8
+ scope :active, -> { where active: true }
9
+ end
@@ -0,0 +1,7 @@
1
+ class GroupUser < ActiveRecord::Base
2
+ belongs_to :group
3
+ belongs_to :user
4
+ has_many :role_group_users
5
+ accepts_nested_attributes_for :role_group_users, reject_if: :all_blank, allow_destroy: :true
6
+ scope :active, -> { where active: true }
7
+ end
@@ -0,0 +1,10 @@
1
+ class Role < ActiveRecord::Base
2
+ has_many :authorizations
3
+ has_many :features, through: :authorizations
4
+ has_many :role_group_users
5
+ has_many :group_users, through: :role_group_users
6
+ has_many :role_groups
7
+ has_many :groups, through: :role_groups
8
+ accepts_nested_attributes_for :authorizations, reject_if: :all_blank, allow_destroy: :true
9
+ validates_presence_of :name
10
+ end
@@ -0,0 +1,4 @@
1
+ class RoleGroup < ActiveRecord::Base
2
+ belongs_to :role
3
+ belongs_to :group
4
+ end
@@ -0,0 +1,4 @@
1
+ class RoleGroupUser < ActiveRecord::Base
2
+ belongs_to :role
3
+ belongs_to :group_user
4
+ end
@@ -0,0 +1,10 @@
1
+ class User < ActiveRecord::Base
2
+ authenticates_with_sorcery!
3
+ validates_presence_of :email
4
+ has_many :group_users
5
+ has_many :groups, through: :group_users
6
+ has_many :role_group_users, through: :group_users
7
+ accepts_nested_attributes_for :group_users, reject_if: :all_blank, allow_destroy: :true
8
+
9
+ scope :all_belonging_to, -> (user) { includes(group_users: :group).where(groups: { id: user.groups }) }
10
+ end
@@ -0,0 +1,5 @@
1
+ <h1>Curupira Dummy Application</h1>
2
+
3
+ <p>Você está em home#index</p>
4
+
5
+ <%= link_to_authorize("Test", "home/test") %>
@@ -0,0 +1 @@
1
+ Sucess!
@@ -0,0 +1,19 @@
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
+ <%- flash.each do |name, msg| -%>
11
+ <%= content_tag :div, msg, id: "flash_#{name}" %>
12
+ <%- end -%>
13
+
14
+ <%= render "curupira/shared/session_links" %>
15
+ <%= render "curupira/shared/model_links" %>
16
+ <%= yield %>
17
+
18
+ </body>
19
+ </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
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
6
+
7
+ Dir.chdir APP_ROOT do
8
+ # This script is a starting point to setup your application.
9
+ # Add necessary setup steps to this file:
10
+
11
+ puts "== Installing dependencies =="
12
+ system "gem install bundler --conservative"
13
+ system "bundle check || bundle install"
14
+
15
+ # puts "\n== Copying sample files =="
16
+ # unless File.exist?("config/database.yml")
17
+ # system "cp config/database.yml.sample config/database.yml"
18
+ # end
19
+
20
+ puts "\n== Preparing database =="
21
+ system "bin/rake db:setup"
22
+
23
+ puts "\n== Removing old logs and tempfiles =="
24
+ system "rm -f log/*"
25
+ system "rm -rf tmp/cache"
26
+
27
+ puts "\n== Restarting application server =="
28
+ system "touch tmp/restart.txt"
29
+ end
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Rails.application
@@ -0,0 +1,25 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+
7
+ module Dummy
8
+ class Application < Rails::Application
9
+ # Settings in config/environments/* take precedence over those specified here.
10
+ # Application configuration should go into files in config/initializers
11
+ # -- all .rb files in that directory are automatically loaded.
12
+
13
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
14
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
15
+ # config.time_zone = 'Central Time (US & Canada)'
16
+
17
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
18
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
19
+ # config.i18n.default_locale = :de
20
+
21
+ # Do not swallow errors in after_commit/after_rollback callbacks.
22
+ # config.active_record.raise_in_transactional_callbacks = true
23
+ end
24
+ end
25
+
@@ -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,46 @@
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
+ # Asset digests allow you to set far-future HTTP expiration dates on all assets,
31
+ # yet still be able to expire them through the digest params.
32
+ config.assets.digest = true
33
+
34
+ # Adds additional error checking when serving assets at runtime.
35
+ # Checks for improperly declared sprockets dependencies.
36
+ # Raises helpful error messages.
37
+ config.assets.raise_runtime_errors = true
38
+
39
+ # Raises error for missing translations
40
+ # config.action_view.raise_on_missing_translations = true
41
+
42
+ config.action_mailer.delivery_method = :smtp
43
+ config.action_mailer.smtp_settings = { :address => "localhost", :port => 1025 }
44
+
45
+ default_url_options[:host] = "localhost:3000"
46
+ end