the_role 2.1.1 → 2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +27 -3
  3. data/.ruby-gemset.example +1 -0
  4. data/.ruby-version.example +1 -0
  5. data/.rvmrc.example +1 -1
  6. data/.travis.yml +2 -2
  7. data/README.md +46 -47
  8. data/app/assets/javascripts/the_role_editinplace.js.coffee +32 -0
  9. data/app/controllers/admin/role_sections_controller.rb +2 -2
  10. data/app/controllers/admin/roles_controller.rb +2 -2
  11. data/app/controllers/concerns/controller.rb +23 -0
  12. data/{lib/generators/the_role/templates → app/models/_templates_}/role.rb +1 -1
  13. data/app/models/concerns/base.rb +37 -0
  14. data/app/models/concerns/role.rb +134 -0
  15. data/app/models/concerns/user.rb +57 -0
  16. data/app/views/admin/roles/_role.html.haml +90 -69
  17. data/app/views/admin/roles/_sidebar.html.haml +16 -9
  18. data/app/views/admin/roles/new.html.haml +11 -10
  19. data/config/locales/en.yml +1 -0
  20. data/config/locales/es.yml +28 -28
  21. data/config/locales/ru.yml +1 -1
  22. data/db/migrate/20111025025129_create_roles.rb +7 -1
  23. data/docs/2.1.1.png +0 -0
  24. data/lib/generators/the_role/USAGE +1 -1
  25. data/lib/generators/the_role/templates/the_role.rb +7 -2
  26. data/lib/generators/the_role/the_role_generator.rb +8 -5
  27. data/lib/tasks/roles.rake +1 -1
  28. data/lib/the_role/activerecord.rb +11 -0
  29. data/lib/the_role/config.rb +7 -0
  30. data/lib/the_role/version.rb +1 -1
  31. data/lib/the_role.rb +19 -5
  32. data/spec/dummy_app/.gitignore +18 -0
  33. data/spec/dummy_app/.rspec +1 -0
  34. data/spec/dummy_app/Gemfile +32 -0
  35. data/spec/dummy_app/README.md +39 -0
  36. data/spec/dummy_app/Rakefile +6 -0
  37. data/spec/dummy_app/app/assets/images/.keep +0 -0
  38. data/spec/dummy_app/app/assets/javascripts/application.js +17 -0
  39. data/spec/dummy_app/app/assets/stylesheets/app/style.css.scss +23 -0
  40. data/spec/dummy_app/app/assets/stylesheets/application.css +3 -0
  41. data/spec/dummy_app/app/controllers/application_controller.rb +38 -0
  42. data/spec/dummy_app/app/controllers/concerns/.keep +0 -0
  43. data/spec/dummy_app/app/controllers/pages_controller.rb +75 -0
  44. data/spec/dummy_app/app/controllers/users_controller.rb +32 -0
  45. data/spec/dummy_app/app/controllers/welcome_controller.rb +13 -0
  46. data/spec/dummy_app/app/helpers/application_helper.rb +2 -0
  47. data/spec/dummy_app/app/mailers/.keep +0 -0
  48. data/spec/dummy_app/app/models/.keep +0 -0
  49. data/spec/dummy_app/app/models/concerns/.keep +0 -0
  50. data/spec/dummy_app/app/models/page.rb +24 -0
  51. data/spec/dummy_app/app/models/role.rb +4 -0
  52. data/spec/dummy_app/app/models/user.rb +21 -0
  53. data/spec/dummy_app/app/views/layouts/_current_user_info.html.haml +17 -0
  54. data/spec/dummy_app/app/views/layouts/application.html.haml +68 -0
  55. data/spec/dummy_app/app/views/pages/_form.html.haml +19 -0
  56. data/spec/dummy_app/app/views/pages/edit.html.haml +7 -0
  57. data/spec/dummy_app/app/views/pages/index.html.haml +27 -0
  58. data/spec/dummy_app/app/views/pages/manage.html.haml +23 -0
  59. data/spec/dummy_app/app/views/pages/my.html.haml +10 -0
  60. data/spec/dummy_app/app/views/pages/new.html.haml +5 -0
  61. data/spec/dummy_app/app/views/pages/show.html.haml +15 -0
  62. data/spec/dummy_app/app/views/users/edit.html.haml +34 -0
  63. data/spec/dummy_app/app/views/welcome/index.html.haml +38 -0
  64. data/spec/dummy_app/app/views/welcome/profile.html.haml +2 -0
  65. data/spec/dummy_app/bin/bundle +3 -0
  66. data/spec/dummy_app/bin/rails +4 -0
  67. data/spec/dummy_app/bin/rake +4 -0
  68. data/spec/dummy_app/config/application.rb +23 -0
  69. data/spec/dummy_app/config/boot.rb +4 -0
  70. data/spec/dummy_app/config/database.yml +17 -0
  71. data/spec/dummy_app/config/environment.rb +5 -0
  72. data/spec/dummy_app/config/environments/development.rb +29 -0
  73. data/spec/dummy_app/config/environments/production.rb +80 -0
  74. data/spec/dummy_app/config/environments/test.rb +36 -0
  75. data/spec/dummy_app/config/initializers/backtrace_silencers.rb +7 -0
  76. data/spec/dummy_app/config/initializers/devise.rb +227 -0
  77. data/spec/dummy_app/config/initializers/filter_parameter_logging.rb +4 -0
  78. data/spec/dummy_app/config/initializers/inflections.rb +16 -0
  79. data/spec/dummy_app/config/initializers/mime_types.rb +5 -0
  80. data/spec/dummy_app/config/initializers/secret_token.rb +12 -0
  81. data/spec/dummy_app/config/initializers/session_store.rb +3 -0
  82. data/spec/dummy_app/config/initializers/the_role.rb +6 -0
  83. data/spec/dummy_app/config/initializers/wrap_parameters.rb +14 -0
  84. data/spec/dummy_app/config/locales/devise.en.yml +57 -0
  85. data/spec/dummy_app/config/locales/en.yml +7 -0
  86. data/spec/dummy_app/config/locales/ru.yml +4 -0
  87. data/spec/dummy_app/config/routes.rb +20 -0
  88. data/spec/dummy_app/config.ru +4 -0
  89. data/spec/dummy_app/db/migrate/20120212061952_devise_create_users.rb +63 -0
  90. data/spec/dummy_app/db/migrate/20120212063249_create_roles.rb +18 -0
  91. data/spec/dummy_app/db/migrate/20120314061307_create_pages.rb +14 -0
  92. data/spec/dummy_app/db/schema.rb +59 -0
  93. data/spec/dummy_app/db/seeds.rb +85 -0
  94. data/spec/dummy_app/lib/assets/.keep +0 -0
  95. data/spec/dummy_app/lib/tasks/.keep +0 -0
  96. data/spec/dummy_app/lib/tasks/assets.rake +15 -0
  97. data/spec/dummy_app/lib/tasks/db_bootstrap.rake +16 -0
  98. data/spec/dummy_app/log/.keep +0 -0
  99. data/spec/dummy_app/public/404.html +58 -0
  100. data/spec/dummy_app/public/422.html +58 -0
  101. data/spec/dummy_app/public/500.html +57 -0
  102. data/spec/dummy_app/public/favicon.ico +0 -0
  103. data/spec/dummy_app/public/robots.txt +5 -0
  104. data/spec/dummy_app/spec/controllers/admin_roles_controller_spec.rb +52 -0
  105. data/spec/dummy_app/spec/controllers/pages_controller_spec.rb +141 -0
  106. data/spec/dummy_app/spec/controllers/welcome_controller_spec.rb +66 -0
  107. data/spec/dummy_app/spec/factories/page.rb +6 -0
  108. data/spec/dummy_app/spec/factories/role.rb +55 -0
  109. data/spec/dummy_app/spec/factories/user.rb +11 -0
  110. data/spec/dummy_app/spec/models/hash_spec.rb +272 -0
  111. data/spec/dummy_app/spec/models/param_process_spec.rb +44 -0
  112. data/spec/dummy_app/spec/models/role_spec.rb +218 -0
  113. data/spec/dummy_app/spec/models/user_spec.rb +164 -0
  114. data/spec/dummy_app/spec/routing/admin_roles_routing_spec.rb +41 -0
  115. data/spec/dummy_app/spec/routing/pages_routing_spec.rb +35 -0
  116. data/spec/dummy_app/spec/spec_helper.rb +68 -0
  117. data/spec/dummy_app/vendor/assets/javascripts/.keep +0 -0
  118. data/spec/dummy_app/vendor/assets/stylesheets/.keep +0 -0
  119. data/the_role.gemspec +2 -1
  120. data/the_role.yml.teamocil.example +11 -0
  121. metadata +213 -16
  122. data/app/assets/javascripts/the_role.js.coffee +0 -31
  123. data/app/assets/stylesheets/the_role/bootstrap_sass.css.scss +0 -20
  124. data/app/assets/stylesheets/the_role.css.scss +0 -47
  125. data/app/controllers/the_role_controller.rb +0 -18
  126. data/app/models/concerns/role_model.rb +0 -125
  127. data/app/models/concerns/the_role_base.rb +0 -35
  128. data/app/models/concerns/the_role_user_model.rb +0 -54
@@ -0,0 +1,38 @@
1
+ class ApplicationController < ActionController::Base
2
+ include TheRole::Controller
3
+
4
+ # Prevent CSRF attacks by raising an exception.
5
+ # For APIs, you may want to use :null_session instead.
6
+ protect_from_forgery with: :exception
7
+
8
+ protect_from_forgery
9
+ before_filter :set_locale
10
+
11
+ def access_denied
12
+ flash[:error] = t('the_role.access_denied')
13
+ redirect_to(:back)
14
+ end
15
+
16
+ private
17
+
18
+ def set_locale
19
+ locale = 'en'
20
+ langs = %w{ en ru es pl zh_CN }
21
+
22
+ if params[:locale]
23
+ lang = params[:locale]
24
+ if langs.include? lang
25
+ locale = lang
26
+ cookies[:locale] = lang
27
+ end
28
+ else
29
+ if cookies[:locale]
30
+ lang = cookies[:locale]
31
+ locale = lang if langs.include? lang
32
+ end
33
+ end
34
+
35
+ I18n.locale = locale
36
+ redirect_to(:back) if params[:locale]
37
+ end
38
+ end
File without changes
@@ -0,0 +1,75 @@
1
+ class PagesController < ApplicationController
2
+ # Devise2 and TheRole before_actions
3
+ before_action :login_required, except: [:index, :show]
4
+ before_action :role_required, except: [:index, :show]
5
+
6
+ before_action :set_page, only: [:edit, :update, :destroy]
7
+ before_action :owner_required, only: [:edit, :update, :destroy]
8
+
9
+ # Public
10
+
11
+ def index
12
+ @pages = Page.with_state(:published).all
13
+ end
14
+
15
+ def show
16
+ @page = Page.with_state(:published).find params[:id]
17
+ end
18
+
19
+ # Login && role
20
+
21
+ def new
22
+ @page = Page.new
23
+ end
24
+
25
+ def create
26
+ @page = Page.new page_params
27
+
28
+ if @page.save
29
+ redirect_to @page, notice: 'Page was successfully created.'
30
+ else
31
+ render action: 'new'
32
+ end
33
+ end
34
+
35
+ def my
36
+ @pages = current_user.pages
37
+ end
38
+
39
+ # login && role && ownership
40
+
41
+ def edit; end
42
+
43
+ def update
44
+ if @page.update_attributes page_params
45
+ redirect_to @page, notice: 'Page was successfully updated.'
46
+ else
47
+ render action: :edit
48
+ end
49
+ end
50
+
51
+ def destroy
52
+ @page.destroy
53
+ redirect_to pages_url
54
+ end
55
+
56
+ # Admin or Pages Moderator Role require
57
+
58
+ def manage
59
+ @pages = Page.all
60
+ end
61
+
62
+ private
63
+
64
+ def set_page
65
+ @page = Page.find params[:id]
66
+
67
+ # TheRole: You should define OWNER CHECK OBJECT
68
+ # When editable object was found
69
+ @owner_check_object = @page
70
+ end
71
+
72
+ def page_params
73
+ params.require(:page).permit(:user_id, :title, :content, :state)
74
+ end
75
+ end
@@ -0,0 +1,32 @@
1
+ class UsersController < ApplicationController
2
+ before_filter :login_required
3
+ before_filter :role_required
4
+
5
+ before_filter :find_user, :only => [:edit, :update]
6
+ before_filter :owner_required, :only => [:edit, :update]
7
+
8
+ def edit; end
9
+
10
+ def update
11
+ @user.update_attributes params[:user]
12
+ flash[:notice] = 'User was successfully updated.'
13
+ redirect_to edit_user_path @user
14
+ end
15
+
16
+ def change_role
17
+ @user = User.find params[:user_id]
18
+ @role = Role.find params[:role_id]
19
+ @user.update_attribute(:role, @role)
20
+ redirect_to edit_user_path @user
21
+ end
22
+
23
+ private
24
+
25
+ def find_user
26
+ @user = User.find params[:id]
27
+
28
+ # TheRole: You should define OWNER CHECK OBJECT
29
+ # When editable object was found
30
+ @owner_check_object = @user
31
+ end
32
+ end
@@ -0,0 +1,13 @@
1
+ class WelcomeController < ApplicationController
2
+ before_filter :authenticate_user!, :except => [:index, :autologin]
3
+
4
+ def index; end
5
+ def profile; end
6
+
7
+ def autologin
8
+ user = User.find_by_email params[:email]
9
+ sign_in user if user
10
+ redirect_to request.referrer || root_path
11
+ end
12
+
13
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
File without changes
File without changes
File without changes
@@ -0,0 +1,24 @@
1
+ class Page < ActiveRecord::Base
2
+ # RELATIONS
3
+ belongs_to :user
4
+
5
+ # VALIDATIONS
6
+ validates :user, presence: true
7
+ validates :title, presence: true, uniqueness: true
8
+ validates :content, presence: true
9
+
10
+ state_machine :state, :initial => :draft do
11
+ # events
12
+ event :to_draft do
13
+ transition all => :draft
14
+ end
15
+
16
+ event :to_published do
17
+ transition all => :published
18
+ end
19
+
20
+ event :to_deleted do
21
+ transition all => :deleted
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,4 @@
1
+ class Role < ActiveRecord::Base
2
+ include TheRole::Role
3
+ # acts_as_role
4
+ end
@@ -0,0 +1,21 @@
1
+ class User < ActiveRecord::Base
2
+ # Include default devise modules. Others available are:
3
+ # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
4
+ devise :database_authenticatable, :registerable,
5
+ :recoverable, :rememberable, :trackable, :validatable
6
+
7
+ include TheRole::User
8
+ # has_role
9
+
10
+ # Setup accessible (or protected) attributes for your model
11
+ # attr_accessible :email, :password, :password_confirmation, :remember_me
12
+ # User accessible fields
13
+ # attr_accessible :name, :company, :address
14
+
15
+ # When we uncomment this string - test should give fail
16
+ # just for example, do not uncomment it
17
+ # attr_accessible :some_protected_field
18
+
19
+ # RELATIONS
20
+ has_many :pages
21
+ end
@@ -0,0 +1,17 @@
1
+ %h2 Current user
2
+
3
+ %p
4
+ - if user_signed_in?
5
+ %p
6
+ %b{ style: "color:green" }= current_user.name
7
+ %p
8
+ %i role: #{current_user.role.name}
9
+ \|
10
+ = link_to "Sign out", destroy_user_session_path, :method => :delete
11
+ - else
12
+ %p
13
+ %i Guest
14
+ %p
15
+ = link_to "Sign in", new_user_session_path
16
+ \|
17
+ = link_to "Sign up", new_user_registration_path
@@ -0,0 +1,68 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title TheRoleTestcase
5
+ = stylesheet_link_tag :application
6
+ = javascript_include_tag :application
7
+ = stylesheet_link_tag "http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css"
8
+
9
+ = csrf_meta_tags
10
+
11
+ = yield :js
12
+ = yield :css
13
+
14
+ %body
15
+ .container
16
+ .row
17
+ .col-md-12.header
18
+ %h2 TheRole - Authorization Gem for Ruby on Rails with administrative interface.
19
+ %h3 Semantic, Flexible, Lightweight
20
+
21
+ .row
22
+ .col-md-3.manage_panel
23
+ = yield :role_sidebar
24
+
25
+ %h4 Basic links
26
+
27
+ %ul
28
+ %li= link_to 'Home', root_path
29
+ %li= link_to 'pages/index', pages_path
30
+ %li= link_to 'pages/manage', manage_pages_path
31
+ %li= link_to 'pages/my', my_pages_path
32
+ %li= link_to 'admin/roles', admin_roles_path
33
+
34
+ = render :partial => 'layouts/current_user_info'
35
+
36
+ .col-md-9.main_content
37
+ - if flash[:notice]
38
+ .alert.alert-success
39
+ %a.close{:href => '#', 'data-dismiss' => :alert } &times;
40
+ = flash[:notice]
41
+
42
+ - if flash[:error]
43
+ .alert.alert-danger
44
+ %a.close{:href => '#', 'data-dismiss' => :alert } &times;
45
+ = flash[:error]
46
+
47
+ = yield
48
+ = yield :role_main
49
+
50
+ .row
51
+ .col-md-3
52
+ %p
53
+ = link_to 'TheRole 2', 'https://github.com/the-teacher/the_role'
54
+ .col-md-9
55
+ %p
56
+ = link_to 'en', '/?locale=en'
57
+ \|
58
+ = link_to 'ru', '/?locale=ru'
59
+ \|
60
+ = link_to 'es', '/?locale=es'
61
+ \|
62
+ = link_to 'zh_CN', '/?locale=zh_CN'
63
+ \|
64
+ = link_to 'pl', '/?locale=pl'
65
+ \|
66
+ %b
67
+ = t '.current_locale'
68
+ = I18n.locale
@@ -0,0 +1,19 @@
1
+ = form_for @page do |f|
2
+ -if @page.errors.any?
3
+ #error_explanation
4
+ %h2= "#{pluralize(@page.errors.count, "error")} prohibited this page from being saved:"
5
+ %ul
6
+ - @page.errors.full_messages.each do |msg|
7
+ %li= msg
8
+
9
+ .field
10
+ = f.label :user_id
11
+ = f.number_field :user_id
12
+ .field
13
+ = f.label :title
14
+ = f.text_field :title
15
+ .field
16
+ = f.label :content
17
+ = f.text_area :content
18
+ .actions
19
+ = f.submit 'Save'
@@ -0,0 +1,7 @@
1
+ %h1 Editing page
2
+
3
+ = render 'form'
4
+
5
+ = link_to 'Show', @page
6
+ \|
7
+ = link_to 'Back', pages_path
@@ -0,0 +1,27 @@
1
+ %p= link_to 'Back', root_path
2
+
3
+ %h1 Listing of #{@pages.count} pages
4
+
5
+ %table
6
+ %tr
7
+ %th Num
8
+ %th User
9
+ %th Title
10
+ %th State
11
+ %th
12
+ %th
13
+ %th
14
+
15
+ - @pages.each_with_index do |page, index|
16
+ %tr
17
+ %td
18
+ - if current_user and current_user.owner?(page)
19
+ %span{ style: "color:red" }= index.next
20
+ - else
21
+ = index.next
22
+ %td= page.user_id
23
+ %td= page.title
24
+ %td= page.state
25
+ %td= link_to 'Show', page
26
+ %td= link_to 'Edit', edit_page_path(page)
27
+ %td= link_to 'Destroy', page, :data => { :confirm => 'Are you sure?' }, :method => :delete
@@ -0,0 +1,23 @@
1
+ %p= link_to 'Back', root_path
2
+
3
+ %h1 Listing of #{@pages.count} pages
4
+
5
+ %table
6
+ %tr
7
+ %th Num
8
+ %th User
9
+ %th Title
10
+ %th State
11
+ %th
12
+ %th
13
+ %th
14
+
15
+ - @pages.each_with_index do |page, index|
16
+ %tr
17
+ %td= index.next
18
+ %td= page.user_id
19
+ %td= page.title
20
+ %td= page.state
21
+ %td= link_to 'Show', page
22
+ %td= link_to 'Edit', edit_page_path(page)
23
+ %td= link_to 'Destroy', page, :data => { :confirm => 'Are you sure?' }, :method => :delete
@@ -0,0 +1,10 @@
1
+ %p= link_to 'Back', root_path
2
+ %h1 Current user: #{current_user.name}
3
+
4
+ %h2 User's pages
5
+
6
+ %ol
7
+ - @pages.each do |page|
8
+ %li
9
+ %i user_id: #{page.user_id}
10
+ %b= page.title
@@ -0,0 +1,5 @@
1
+ %h1 New page
2
+
3
+ = render 'form'
4
+
5
+ = link_to 'Back', pages_path
@@ -0,0 +1,15 @@
1
+ %p#notice= notice
2
+
3
+ %p
4
+ %b User:
5
+ = @page.user_id
6
+ %p
7
+ %b Title:
8
+ = @page.title
9
+ %p
10
+ %b Content:
11
+ = @page.content
12
+
13
+ = link_to 'Edit', edit_page_path(@page)
14
+ \|
15
+ = link_to 'Back', pages_path
@@ -0,0 +1,34 @@
1
+ - if flash[:notice]
2
+ %p{ :style => 'background: LightGreen; padding: 10px;' }= flash[:notice]
3
+
4
+ %h2{ :style => 'color: gray' } Editable User: #{@user.name} | Role: #{@user.role.name}
5
+ %h3{ :style => 'color: lightGray' } Current User: #{current_user.name} | Role: #{current_user.role.name}
6
+
7
+ %p= link_to 'To index page', '/'
8
+
9
+ = form_for @user, :method => :put do |f|
10
+ .field
11
+ %p= f.label :name
12
+ %p= f.text_field :name
13
+
14
+ .field
15
+ %p= f.label :email
16
+ %p= f.text_field :email
17
+
18
+ .field
19
+ %p= f.label :role_id, 'Protected field'
20
+ %p= f.text_field :role_id
21
+
22
+ .field
23
+ %p= f.label :some_protected_field, 'Protected field'
24
+ %p= f.text_field :some_protected_field
25
+
26
+ .field
27
+ %p= f.submit
28
+
29
+
30
+ - if current_user.admin?
31
+ = form_tag change_role_path, :method => :put do
32
+ = hidden_field_tag :user_id, @user.id
33
+ = select_tag :role_id, options_for_select(Role.all.collect{ |r| [r.name, r.id] })
34
+ = submit_tag
@@ -0,0 +1,38 @@
1
+ %h1 Users info
2
+
3
+ %ol
4
+ - User.all.each do |user|
5
+ %li
6
+ %b= user.name
7
+ \-
8
+ - if user.role
9
+ %b role: #{user.role.name}
10
+ - else
11
+ %b User has not role
12
+ \-
13
+ |
14
+ = link_to 'Login now!', autologin_path(:email => user.email)
15
+ %p
16
+ %b password:
17
+ %i qwerty
18
+
19
+ %h1 Edit Users
20
+
21
+ %ol
22
+ - User.all.each do |user|
23
+ - if user.role
24
+ %li= link_to "Edit user: #{user.name} [#{user.role.name}]", edit_user_path(user)
25
+ - else
26
+ %li User #{user.name} has not role
27
+
28
+ %h1 Roles info
29
+
30
+ %ol
31
+ - Role.all.each do |role|
32
+ %li
33
+ %b= role.name
34
+ \-
35
+ %i= role.description
36
+ \-
37
+ - users_list = role.users.map(&:name).join(', ')
38
+ %b users: [#{users_list}]
@@ -0,0 +1,2 @@
1
+ %h1 Welcome#profile
2
+ %p Find me in app/views/welcome/profile.html.haml
@@ -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,23 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # Require the gems listed in Gemfile, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env)
8
+
9
+ module RailsApp
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
16
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
17
+ # config.time_zone = 'Central Time (US & Canada)'
18
+
19
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
20
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
21
+ # config.i18n.default_locale = :de
22
+ end
23
+ end
@@ -0,0 +1,4 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -0,0 +1,17 @@
1
+ production:
2
+ adapter: sqlite3
3
+ database: db/the_role_prod.db
4
+ pool: 5
5
+ timeout: 5000
6
+
7
+ development:
8
+ adapter: sqlite3
9
+ database: db/the_role_dev.db
10
+ pool: 5
11
+ timeout: 5000
12
+
13
+ test:
14
+ adapter: sqlite3
15
+ database: db/the_role_test.db
16
+ pool: 5
17
+ timeout: 5000
@@ -0,0 +1,5 @@
1
+ # Load the rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application.
5
+ RailsApp::Application.initialize!
@@ -0,0 +1,29 @@
1
+ RailsApp::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
+ end