kadmin 0.3.1 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +44 -44
  3. data/Rakefile +146 -146
  4. data/app/assets/javascripts/modular/app.js +1388 -1388
  5. data/app/assets/javascripts/modular/application.js +3 -3
  6. data/app/assets/javascripts/modular/vendor.js +57671 -57671
  7. data/app/assets/stylesheets/kadmin/typeahead-select.scss +2 -0
  8. data/app/assets/stylesheets/modular/app-blue.css +2795 -2795
  9. data/app/assets/stylesheets/modular/app-custom.css +2795 -2795
  10. data/app/assets/stylesheets/modular/app-green.css +2795 -2795
  11. data/app/assets/stylesheets/modular/app-orange.css +2795 -2795
  12. data/app/assets/stylesheets/modular/app-purple.css +2795 -2795
  13. data/app/assets/stylesheets/modular/app-red.css +2795 -2795
  14. data/app/assets/stylesheets/modular/app-seagreen.css +2795 -2795
  15. data/app/assets/stylesheets/modular/app.css +2795 -2795
  16. data/app/assets/stylesheets/modular/custom.css +51 -19
  17. data/app/assets/stylesheets/modular/vendor.css +12999 -12999
  18. data/app/controllers/kadmin/application_controller.rb +64 -64
  19. data/app/controllers/kadmin/auth_controller.rb +98 -98
  20. data/app/controllers/kadmin/concerns/authorized_user.rb +67 -67
  21. data/app/controllers/kadmin/dash_controller.rb +19 -19
  22. data/app/decorators/kadmin/finder_decorator.rb +50 -50
  23. data/app/decorators/kadmin/pager_decorator.rb +33 -33
  24. data/app/helpers/kadmin/alert_helper.rb +59 -59
  25. data/app/helpers/kadmin/application_helper.rb +4 -4
  26. data/app/helpers/kadmin/bootstrap_helper.rb +23 -23
  27. data/app/helpers/kadmin/form_builder.rb +9 -9
  28. data/app/helpers/kadmin/forms/inverted_check_box.rb +10 -10
  29. data/app/helpers/kadmin/navigation_helper.rb +28 -28
  30. data/app/helpers/kadmin/pagination_helper.rb +95 -95
  31. data/app/views/kadmin/auth/login.html.erb +4 -4
  32. data/app/views/kadmin/components/_finder.html.erb +14 -18
  33. data/app/views/kadmin/components/finder/_empty.html.erb +3 -3
  34. data/app/views/kadmin/components/finder/_form.erb +10 -10
  35. data/app/views/kadmin/components/finder/_header.html.erb +14 -11
  36. data/app/views/kadmin/dash/index.html.erb +5 -5
  37. data/app/views/kadmin/error.html.erb +5 -5
  38. data/app/views/kadmin/helpers/_alerts.html.erb +4 -4
  39. data/app/views/kadmin/helpers/_form_errors.html.erb +10 -10
  40. data/app/views/layouts/modular/application.html.erb +134 -132
  41. data/config/initializers/action_view.rb +2 -2
  42. data/config/initializers/assets.rb +5 -5
  43. data/config/locales/de.yml +25 -25
  44. data/config/locales/en.yml +24 -24
  45. data/config/routes.rb +12 -12
  46. data/lib/kadmin.rb +22 -22
  47. data/lib/kadmin/auth.rb +31 -31
  48. data/lib/kadmin/auth/configuration.rb +66 -66
  49. data/lib/kadmin/auth/unauthorized_error.rb +14 -14
  50. data/lib/kadmin/auth/user.rb +15 -15
  51. data/lib/kadmin/auth/user_store.rb +21 -21
  52. data/lib/kadmin/configuration.rb +18 -18
  53. data/lib/kadmin/engine.rb +15 -15
  54. data/lib/kadmin/error.rb +7 -7
  55. data/lib/kadmin/errors/authorization.rb +15 -15
  56. data/lib/kadmin/finder.rb +66 -66
  57. data/lib/kadmin/form.rb +179 -179
  58. data/lib/kadmin/pager.rb +93 -93
  59. data/lib/kadmin/version.rb +3 -3
  60. data/test/dummy/README.rdoc +28 -28
  61. data/test/dummy/Rakefile +6 -6
  62. data/test/dummy/app/assets/javascripts/application.js +13 -13
  63. data/test/dummy/app/assets/stylesheets/application.css +15 -15
  64. data/test/dummy/app/controllers/admin/application_controller.rb +11 -11
  65. data/test/dummy/app/controllers/admin/people_controller.rb +89 -89
  66. data/test/dummy/app/controllers/admin_controller.rb +4 -4
  67. data/test/dummy/app/controllers/application_controller.rb +5 -5
  68. data/test/dummy/app/controllers/authorized_controller.rb +8 -8
  69. data/test/dummy/app/helpers/application_helper.rb +2 -2
  70. data/test/dummy/app/models/group.rb +8 -8
  71. data/test/dummy/app/models/group_person.rb +6 -6
  72. data/test/dummy/app/models/person.rb +20 -20
  73. data/test/dummy/app/views/admin/index.html.erb +1 -1
  74. data/test/dummy/app/views/admin/people/_form.html.erb +34 -34
  75. data/test/dummy/app/views/admin/people/_table.html.erb +33 -33
  76. data/test/dummy/app/views/admin/people/edit.html.erb +4 -4
  77. data/test/dummy/app/views/admin/people/index.html.erb +3 -3
  78. data/test/dummy/app/views/admin/people/new.html.erb +5 -5
  79. data/test/dummy/app/views/admin/people/show.html.erb +3 -3
  80. data/test/dummy/app/views/authorized/index.html.erb +1 -1
  81. data/test/dummy/app/views/layouts/application.html.erb +14 -14
  82. data/test/dummy/bin/bundle +3 -3
  83. data/test/dummy/bin/rails +4 -4
  84. data/test/dummy/bin/rake +4 -4
  85. data/test/dummy/bin/setup +29 -29
  86. data/test/dummy/config.ru +4 -4
  87. data/test/dummy/config/application.rb +39 -39
  88. data/test/dummy/config/boot.rb +5 -5
  89. data/test/dummy/config/database.yml +22 -22
  90. data/test/dummy/config/environment.rb +5 -5
  91. data/test/dummy/config/environments/development.rb +41 -41
  92. data/test/dummy/config/environments/production.rb +79 -79
  93. data/test/dummy/config/environments/test.rb +42 -42
  94. data/test/dummy/config/initializers/assets.rb +10 -10
  95. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -7
  96. data/test/dummy/config/initializers/cookies_serializer.rb +3 -3
  97. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -4
  98. data/test/dummy/config/initializers/inflections.rb +16 -16
  99. data/test/dummy/config/initializers/kadmin.rb +24 -24
  100. data/test/dummy/config/initializers/mime_types.rb +4 -4
  101. data/test/dummy/config/initializers/session_store.rb +3 -3
  102. data/test/dummy/config/initializers/wrap_parameters.rb +14 -14
  103. data/test/dummy/config/locales/en.yml +17 -17
  104. data/test/dummy/config/routes.rb +13 -13
  105. data/test/dummy/config/secrets.yml +22 -22
  106. data/test/dummy/db/migrate/20161006114509_create_people.rb +11 -11
  107. data/test/dummy/db/migrate/20161006134459_create_groups.rb +11 -11
  108. data/test/dummy/db/migrate/20161006134746_create_group_people.rb +11 -11
  109. data/test/dummy/db/schema.rb +43 -43
  110. data/test/dummy/lib/forms/group_form.rb +16 -16
  111. data/test/dummy/lib/forms/person_form.rb +19 -19
  112. data/test/dummy/public/404.html +67 -67
  113. data/test/dummy/public/422.html +67 -67
  114. data/test/dummy/public/500.html +66 -66
  115. data/test/dummy/test/fixtures/children.yml +11 -11
  116. data/test/dummy/test/fixtures/group_people.yml +11 -11
  117. data/test/dummy/test/fixtures/groups.yml +11 -11
  118. data/test/dummy/test/fixtures/people.yml +11 -11
  119. data/test/dummy/test/models/group_person_test.rb +7 -7
  120. data/test/dummy/test/models/group_test.rb +7 -7
  121. data/test/kadmin/form_test.rb +6 -6
  122. data/test/test_helper.rb +32 -32
  123. metadata +54 -53
@@ -1,4 +1,4 @@
1
- class AdminController < Kadmin::ApplicationController
2
- def index
3
- end
4
- end
1
+ class AdminController < Kadmin::ApplicationController
2
+ def index
3
+ end
4
+ end
@@ -1,5 +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
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
@@ -1,8 +1,8 @@
1
- class AuthorizedController < ApplicationController
2
- include Kadmin::Concerns::AuthorizedUser
3
-
4
- before_action :authorize
5
-
6
- def index
7
- end
8
- end
1
+ class AuthorizedController < ApplicationController
2
+ include Kadmin::Concerns::AuthorizedUser
3
+
4
+ before_action :authorize
5
+
6
+ def index
7
+ end
8
+ end
@@ -1,2 +1,2 @@
1
- module ApplicationHelper
2
- end
1
+ module ApplicationHelper
2
+ end
@@ -1,8 +1,8 @@
1
- class Group < ActiveRecord::Base
2
- has_many :group_people, dependent: :destroy, autosave: true
3
- has_many :people, through: :group_people
4
- belongs_to :owner, class_name: 'Person'
5
-
6
- validates :name, presence: true, length: { in: 1..254 },
7
- format: { with: /[a-zA-Z0-9\-_\s]+/, message: 'only alphanumerics, dashes, underscores, and spaces' }
8
- end
1
+ class Group < ActiveRecord::Base
2
+ has_many :group_people, dependent: :destroy, autosave: true
3
+ has_many :people, through: :group_people
4
+ belongs_to :owner, class_name: 'Person'
5
+
6
+ validates :name, presence: true, length: { in: 1..254 },
7
+ format: { with: /[a-zA-Z0-9\-_\s]+/, message: 'only alphanumerics, dashes, underscores, and spaces' }
8
+ end
@@ -1,6 +1,6 @@
1
- class GroupPerson < ActiveRecord::Base
2
- belongs_to :group
3
- belongs_to :person
4
-
5
- validates :person_id, uniqueness: { scope: :group_id, message: 'can only be part once of the same group' }
6
- end
1
+ class GroupPerson < ActiveRecord::Base
2
+ belongs_to :group
3
+ belongs_to :person
4
+
5
+ validates :person_id, uniqueness: { scope: :group_id, message: 'can only be part once of the same group' }
6
+ end
@@ -1,20 +1,20 @@
1
- class Person < ActiveRecord::Base
2
- has_many :group_people, dependent: :destroy, autosave: true
3
- has_many :groups, through: :group_people
4
- has_many :owned_groups, class_name: 'Group', foreign_key: 'owner_id', dependent: :nullify, autosave: true
5
-
6
- validates :first_name, presence: true, length: { in: 2..254 }
7
- validates :last_name, presence: true, length: { in: 2..254 }
8
- validates :gender, presence: true, length: { is: 1 }, inclusion: { in: %w(m f o), message: 'one of m (male), f (female), or o (other)' }
9
- validate :valid_date_of_birth?
10
-
11
- def valid_date_of_birth?
12
- return date_of_birth.nil? || (date_of_birth.is_a?(Date) && date_of_birth < Date.current)
13
- end
14
- private :valid_date_of_birth?
15
-
16
- def full_name(inversed: false)
17
- parts = [first_name, last_name]
18
- return inversed ? parts.reverse.join(', ') : parts.join(' ')
19
- end
20
- end
1
+ class Person < ActiveRecord::Base
2
+ has_many :group_people, dependent: :destroy, autosave: true
3
+ has_many :groups, through: :group_people
4
+ has_many :owned_groups, class_name: 'Group', foreign_key: 'owner_id', dependent: :nullify, autosave: true
5
+
6
+ validates :first_name, presence: true, length: { in: 2..254 }
7
+ validates :last_name, presence: true, length: { in: 2..254 }
8
+ validates :gender, presence: true, length: { is: 1 }, inclusion: { in: %w(m f o), message: 'one of m (male), f (female), or o (other)' }
9
+ validate :valid_date_of_birth?
10
+
11
+ def valid_date_of_birth?
12
+ return date_of_birth.nil? || (date_of_birth.is_a?(Date) && date_of_birth < Date.current)
13
+ end
14
+ private :valid_date_of_birth?
15
+
16
+ def full_name(inversed: false)
17
+ parts = [first_name, last_name]
18
+ return inversed ? parts.reverse.join(', ') : parts.join(' ')
19
+ end
20
+ end
@@ -1 +1 @@
1
- <h1>You are authorized my dude!</h1>
1
+ <h1>You are authorized my dude!</h1>
@@ -1,34 +1,34 @@
1
- <div class='container-fluid'>
2
- <div class="row">
3
- <%= form.hidden_field :id %>
4
- <div class='col-xs-12 col-sm-8 col-md-4'>
5
- <div class="form-group">
6
- <%= form.label :first_name, class: 'control-label' %>
7
- <%= form.text_field :first_name, class: 'form-control' %>
8
- </div>
9
- <div class="form-group">
10
- <%= form.label :last_name, class: 'control-label' %>
11
- <%= form.text_field :last_name, class: 'form-control' %>
12
- </div>
13
- </div>
14
- <div class='col-xs-12 col-sm-8 col-md-4'>
15
- <div class="form-group">
16
- <%= form.label :date_of_birth, class: 'control-label' %>
17
- <div class="form-group form-inline">
18
- <%= form.date_select :date_of_birth, { start_year: 100.years.ago.year, end_year: Date.today.year }, class: 'form-control' %>
19
- </div>
20
- </div>
21
- <div class="form-group">
22
- <%= form.label :gender, class: 'control-label' %>
23
- <%= form.select :gender, [['Male', 'm'], ['Female', 'f'], ['Other', 'o']], { prompt: 'Select one of...' }, class: 'form-control' %>
24
- </div>
25
- </div>
26
- </div>
27
-
28
- <div class="row">
29
- <%= form.button(type: 'submit', data: { 'disable-with': 'Saving...' }, class: 'btn btn-primary btn-lg') do %>
30
- <%= glyphicon('floppy-save') %>
31
- Save
32
- <% end %>
33
- </div>
34
- </div>
1
+ <div class='container-fluid'>
2
+ <div class="row">
3
+ <%= form.hidden_field :id %>
4
+ <div class='col-xs-12 col-sm-8 col-md-4'>
5
+ <div class="form-group">
6
+ <%= form.label :first_name, class: 'control-label' %>
7
+ <%= form.text_field :first_name, class: 'form-control' %>
8
+ </div>
9
+ <div class="form-group">
10
+ <%= form.label :last_name, class: 'control-label' %>
11
+ <%= form.text_field :last_name, class: 'form-control' %>
12
+ </div>
13
+ </div>
14
+ <div class='col-xs-12 col-sm-8 col-md-4'>
15
+ <div class="form-group">
16
+ <%= form.label :date_of_birth, class: 'control-label' %>
17
+ <div class="form-group form-inline">
18
+ <%= form.date_select :date_of_birth, { start_year: 100.years.ago.year, end_year: Date.today.year }, class: 'form-control' %>
19
+ </div>
20
+ </div>
21
+ <div class="form-group">
22
+ <%= form.label :gender, class: 'control-label' %>
23
+ <%= form.select :gender, [['Male', 'm'], ['Female', 'f'], ['Other', 'o']], { prompt: 'Select one of...' }, class: 'form-control' %>
24
+ </div>
25
+ </div>
26
+ </div>
27
+
28
+ <div class="row">
29
+ <%= form.button(type: 'submit', data: { 'disable-with': 'Saving...' }, class: 'btn btn-primary btn-lg') do %>
30
+ <%= glyphicon('floppy-save') %>
31
+ Save
32
+ <% end %>
33
+ </div>
34
+ </div>
@@ -1,33 +1,33 @@
1
- <table class='table table-hover table-striped'>
2
- <thead>
3
- <tr>
4
- <th style='width: 1%'>ID</th>
5
- <th style='width: 15%'>First name</th>
6
- <th style='width: 15%'>Last name</th>
7
- <th style='width: 20%'>Date of birth</th>
8
- <th style='width: 5%'>Gender</th>
9
- <th style='width: 9%'>Registered</th>
10
- <th style='width: 1%'>Actions</th>
11
- </tr>
12
- </thead>
13
- <tbody>
14
- <% people.each do |person| %>
15
- <tr>
16
- <td><%= link_to(person.id, admin_people_path(person.id)) %></td>
17
- <td><%= link_to(person.first_name, admin_person_path(person.id)) %></td>
18
- <td><%= link_to(person.last_name, admin_person_path(person.id)) %></td>
19
- <td><%= person.date_of_birth %></td>
20
- <td><%= t("person.genders.#{person.gender}") %></td>
21
- <td><%= person.created_at %></td>
22
- <td class="text-center">
23
- <%=
24
- dropdown('Actions...', [
25
- link_to('Edit', edit_admin_person_path(person.id)),
26
- link_to('Delete', admin_person_path(person.id), method: :delete, data: { confirm: "Are you sure you want to delete [#{person.full_name}]" })
27
- ])
28
- %>
29
- </td>
30
- </tr>
31
- <% end %>
32
- </tbody>
33
- </table>
1
+ <table class='table table-hover table-striped'>
2
+ <thead>
3
+ <tr>
4
+ <th style='width: 1%'>ID</th>
5
+ <th style='width: 15%'>First name</th>
6
+ <th style='width: 15%'>Last name</th>
7
+ <th style='width: 20%'>Date of birth</th>
8
+ <th style='width: 5%'>Gender</th>
9
+ <th style='width: 9%'>Registered</th>
10
+ <th style='width: 1%'>Actions</th>
11
+ </tr>
12
+ </thead>
13
+ <tbody>
14
+ <% people.each do |person| %>
15
+ <tr>
16
+ <td><%= link_to(person.id, admin_people_path(person.id)) %></td>
17
+ <td><%= link_to(person.first_name, admin_person_path(person.id)) %></td>
18
+ <td><%= link_to(person.last_name, admin_person_path(person.id)) %></td>
19
+ <td><%= person.date_of_birth %></td>
20
+ <td><%= t("person.genders.#{person.gender}") %></td>
21
+ <td><%= person.created_at %></td>
22
+ <td class="text-center">
23
+ <%=
24
+ dropdown('Actions...', [
25
+ link_to('Edit', edit_admin_person_path(person.id)),
26
+ link_to('Delete', admin_person_path(person.id), method: :delete, data: { confirm: "Are you sure you want to delete [#{person.full_name}]" })
27
+ ])
28
+ %>
29
+ </td>
30
+ </tr>
31
+ <% end %>
32
+ </tbody>
33
+ </table>
@@ -1,4 +1,4 @@
1
- <h2>Editing <%= @person.full_name(inversed: true) %></h2>
2
- <%= form_for [:admin, @person_form] do |form| %>
3
- <%= render partial: 'admin/people/form', locals: { form: form } %>
4
- <% end %>
1
+ <h2>Editing <%= @person.full_name(inversed: true) %></h2>
2
+ <%= form_for [:admin, @person_form] do |form| %>
3
+ <%= render partial: 'admin/people/form', locals: { form: form } %>
4
+ <% end %>
@@ -1,3 +1,3 @@
1
- <%= render layout: 'kadmin/components/finder', locals: { finder: @finder } do %>
2
- <%= render partial: 'admin/people/table', locals: { people: @finder.results } %>
3
- <% end %>
1
+ <%= render layout: 'kadmin/components/finder', locals: { finder: @finder } do %>
2
+ <%= render partial: 'admin/people/table', locals: { people: @finder.results } %>
3
+ <% end %>
@@ -1,5 +1,5 @@
1
- <h2>Register a new person</h2>
2
- <%= render partial: 'kadmin/helpers/form_errors', locals: { model: @person_form } %>
3
- <%= form_for [:admin, @person_form] do |form| %>
4
- <%= render partial: 'admin/people/form', locals: { form: form, model: @person_form } %>
5
- <% end %>
1
+ <h2>Register a new person</h2>
2
+ <%= render partial: 'kadmin/helpers/form_errors', locals: { model: @person_form } %>
3
+ <%= form_for [:admin, @person_form] do |form| %>
4
+ <%= render partial: 'admin/people/form', locals: { form: form, model: @person_form } %>
5
+ <% end %>
@@ -1,3 +1,3 @@
1
- <h1><%= @person.full_name %></h1>
2
- <p>Date of birth: <%= @person.date_of_birth %></p>
3
- <p>Gender: <%= t("person.genders.#{@person.gender}") %>
1
+ <h1><%= @person.full_name %></h1>
2
+ <p>Date of birth: <%= @person.date_of_birth %></p>
3
+ <p>Gender: <%= t("person.genders.#{@person.gender}") %>
@@ -1 +1 @@
1
- <h1>You are authorized, but not within an admin controller!</h1>
1
+ <h1>You are authorized, but not within an admin controller!</h1>
@@ -1,14 +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>
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>
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -1,4 +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'
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -1,29 +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
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
@@ -1,4 +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
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
@@ -1,39 +1,39 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'active_record/railtie'
4
- require 'action_controller/railtie'
5
- require 'action_mailer/railtie'
6
- require 'action_view/railtie'
7
- require 'sprockets/railtie'
8
- require 'rails/test_unit/railtie'
9
-
10
- Kernel.silence_warnings do
11
- Bundler.require(*Rails.groups)
12
- end
13
-
14
- require 'kadmin'
15
-
16
- module Dummy
17
- class Application < Rails::Application
18
- # Settings in config/environments/* take precedence over those specified here.
19
- # Application configuration should go into files in config/initializers
20
- # -- all .rb files in that directory are automatically loaded.
21
-
22
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
23
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
24
- config.time_zone = 'Europe/Berlin'
25
-
26
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
27
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
28
- # config.i18n.default_locale = :de
29
-
30
- # Do not swallow errors in after_commit/after_rollback callbacks.
31
- config.active_record.raise_in_transactional_callbacks = true
32
-
33
- config.autoload_paths += %W(#{config.root}/lib)
34
-
35
- config.watchable_dirs['lib'] = [:rb, :erb]
36
- config.watchable_dirs['../../lib'] = [:rb, :erb]
37
- config.watchable_dirs['../../app'] = [:rb, :erb]
38
- end
39
- end
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'active_record/railtie'
4
+ require 'action_controller/railtie'
5
+ require 'action_mailer/railtie'
6
+ require 'action_view/railtie'
7
+ require 'sprockets/railtie'
8
+ require 'rails/test_unit/railtie'
9
+
10
+ Kernel.silence_warnings do
11
+ Bundler.require(*Rails.groups)
12
+ end
13
+
14
+ require 'kadmin'
15
+
16
+ module Dummy
17
+ class Application < Rails::Application
18
+ # Settings in config/environments/* take precedence over those specified here.
19
+ # Application configuration should go into files in config/initializers
20
+ # -- all .rb files in that directory are automatically loaded.
21
+
22
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
23
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
24
+ config.time_zone = 'Europe/Berlin'
25
+
26
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
27
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
28
+ # config.i18n.default_locale = :de
29
+
30
+ # Do not swallow errors in after_commit/after_rollback callbacks.
31
+ config.active_record.raise_in_transactional_callbacks = true
32
+
33
+ config.autoload_paths += %W(#{config.root}/lib)
34
+
35
+ config.watchable_dirs['lib'] = [:rb, :erb]
36
+ config.watchable_dirs['../../lib'] = [:rb, :erb]
37
+ config.watchable_dirs['../../app'] = [:rb, :erb]
38
+ end
39
+ end