gov_uk_date_fields 0.0.1

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 +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +34 -0
  4. data/lib/gov_uk_date_fields/acts_as_gov_uk_date.rb +122 -0
  5. data/lib/gov_uk_date_fields/form_builder.rb +12 -0
  6. data/lib/gov_uk_date_fields/form_date.rb +127 -0
  7. data/lib/gov_uk_date_fields/form_fields.rb +49 -0
  8. data/lib/gov_uk_date_fields/gov_uk_date_fields.rb +2 -0
  9. data/lib/gov_uk_date_fields/version.rb +3 -0
  10. data/lib/gov_uk_date_fields.rb +7 -0
  11. data/lib/tasks/gov_uk_date_fields_tasks.rake +4 -0
  12. data/test/dummy/README.rdoc +28 -0
  13. data/test/dummy/Rakefile +6 -0
  14. data/test/dummy/app/assets/javascripts/application.js +13 -0
  15. data/test/dummy/app/assets/javascripts/employees.js +2 -0
  16. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  17. data/test/dummy/app/assets/stylesheets/employees.css +4 -0
  18. data/test/dummy/app/assets/stylesheets/scaffold.css +56 -0
  19. data/test/dummy/app/controllers/application_controller.rb +5 -0
  20. data/test/dummy/app/controllers/employees_controller.rb +58 -0
  21. data/test/dummy/app/helpers/application_helper.rb +2 -0
  22. data/test/dummy/app/helpers/employees_helper.rb +2 -0
  23. data/test/dummy/app/models/employee.rb +6 -0
  24. data/test/dummy/app/views/employees/_form.html.erb +29 -0
  25. data/test/dummy/app/views/employees/edit.html.erb +6 -0
  26. data/test/dummy/app/views/employees/index.html.erb +31 -0
  27. data/test/dummy/app/views/employees/new.html.erb +5 -0
  28. data/test/dummy/app/views/employees/show.html.erb +19 -0
  29. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  30. data/test/dummy/bin/bundle +3 -0
  31. data/test/dummy/bin/rails +4 -0
  32. data/test/dummy/bin/rake +4 -0
  33. data/test/dummy/bin/setup +29 -0
  34. data/test/dummy/config/application.rb +25 -0
  35. data/test/dummy/config/boot.rb +5 -0
  36. data/test/dummy/config/database.yml +85 -0
  37. data/test/dummy/config/environment.rb +5 -0
  38. data/test/dummy/config/environments/development.rb +41 -0
  39. data/test/dummy/config/environments/production.rb +79 -0
  40. data/test/dummy/config/environments/test.rb +42 -0
  41. data/test/dummy/config/initializers/assets.rb +11 -0
  42. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  43. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  44. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  45. data/test/dummy/config/initializers/inflections.rb +16 -0
  46. data/test/dummy/config/initializers/mime_types.rb +4 -0
  47. data/test/dummy/config/initializers/session_store.rb +3 -0
  48. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  49. data/test/dummy/config/locales/en.yml +23 -0
  50. data/test/dummy/config/routes.rb +57 -0
  51. data/test/dummy/config/secrets.yml +22 -0
  52. data/test/dummy/config.ru +4 -0
  53. data/test/dummy/db/migrate/20150901103114_create_employees.rb +11 -0
  54. data/test/dummy/db/schema.rb +27 -0
  55. data/test/dummy/log/development.log +995 -0
  56. data/test/dummy/log/test.log +15943 -0
  57. data/test/dummy/public/404.html +67 -0
  58. data/test/dummy/public/422.html +67 -0
  59. data/test/dummy/public/500.html +66 -0
  60. data/test/dummy/public/favicon.ico +0 -0
  61. data/test/dummy/test/controllers/employees_controller_test.rb +72 -0
  62. data/test/dummy/test/fixtures/employees.yml +11 -0
  63. data/test/dummy/test/models/employee_test.rb +126 -0
  64. data/test/dummy/test/models/form_date_test.rb +91 -0
  65. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/3Btcwr72V3UVSQF4sqr__CCT-XdxN0CTruFn7z9Y_XU.cache +2 -0
  66. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/4OGvKM5VGFrmfgpNVn-OVfpy9d666yTUyc-FSiWvwYo.cache +0 -0
  67. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/54EGGKsdgfn0vxxv75SqN98eDhg-ilqjdIkfD08lvrI.cache +1 -0
  68. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  69. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/AAh5PqvwSFjiY74WrVS1iZDEIaV1Esq-U2wnk7iS4us.cache +0 -0
  70. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/AUA1UWYic4L73QsfyqeOPHldlfFq_8j9hAToBfr-f1Q.cache +1 -0
  71. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/AX3L2fGpRF9VevxsOcMT3K8MFiRGjRX81JBxvrH7IIc.cache +2 -0
  72. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/DWiSprTdmJSiF4eYqRLDfLfWLyF-m0Mk3TOoLQXKKW0.cache +2 -0
  73. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +2 -0
  74. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/EQgy9RTV-4e0cBODgHM06wYW7K5ZQPT7QCEd9rw3WOM.cache +0 -0
  75. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/GeZkOF3Y0RVsr_bLJpt8e98qLe6tl2fanP3g8Au3Ki4.cache +1 -0
  76. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/MnCiEhJG594IyEZWxHbFmmj3VVVPj_s6mBDi22R6d4g.cache +0 -0
  77. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  78. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/QZXYupcseg74D7COWs8-uMvEFMzcF0D2kyZbe9TQ77s.cache +1 -0
  79. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/RLkYXASUya0cLJBhEdan7n0Pd7bxb0bB0Fisje2uDAo.cache +0 -0
  80. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/SOd3-ZZMlfAqcde7u4GC6nyLGyBlZn5GOsNbUpmTKYw.cache +1 -0
  81. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/SRehtTwxOp9802ZoUXpvNaoiTUAAop3BKwD0zbFqDtE.cache +2 -0
  82. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/X9Q9imgKEWoA7sXby5p60U-hJ2dz87Ml_BLtvx3zhic.cache +1 -0
  83. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ZIi2WsAMg6MivpM37KPVAEt0WF2kOpptOZnB8I13ypQ.cache +0 -0
  84. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/aCaKUaA2zFHYb85d3HsEaLzqqcySgu1RNprCoAsVud0.cache +1 -0
  85. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/aGW0bSYiiwQK9bzVhmWulwv3CPsg3QsaBf3OmDxJgow.cache +0 -0
  86. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  87. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/ihA_BDp1Rs5WPDQas3L0pgMqmZCcgqozdQxu48rJb68.cache +1 -0
  88. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/kTqBP8zzCc8f2JqGQTi3DXs7nGsbgDuRg0jrPG8ZNPk.cache +1 -0
  89. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/oV4rrfh_yARJFyFf415eIZDk0XSRN6pCO9JMJFhb0RI.cache +1 -0
  90. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  91. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/tYWKJ-uJLzUiu_GSiw8U9c-NoKsmluXyJoybViJqqSo.cache +1 -0
  92. data/test/dummy/tmp/cache/assets/development/sprockets/v3.0/uHgfxDUpQd144IiQx-xG6kwowy8G1sR4iyD9DNL0tC0.cache +1 -0
  93. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/1AsHbcbPJPOX9onZq50MxoxSn1pMnQpGVvG_UYQ13wo.cache +0 -0
  94. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/3Btcwr72V3UVSQF4sqr__CCT-XdxN0CTruFn7z9Y_XU.cache +2 -0
  95. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/5Lly_CA8DZvPhQV2jDQx-Y6P_y3Ygra9t5jfSlGhHDA.cache +2 -0
  96. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/67JJWCc_sYvRYPdITY7j_FNQfhBfvZo5G1sv2dZxIto.cache +1 -0
  97. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AUA1UWYic4L73QsfyqeOPHldlfFq_8j9hAToBfr-f1Q.cache +1 -0
  98. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/AX3L2fGpRF9VevxsOcMT3K8MFiRGjRX81JBxvrH7IIc.cache +2 -0
  99. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/DNMjaCc-VmsemKVl4YidF-CXIU3genqy7Al84AF5ElQ.cache +1 -0
  100. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/DWiSprTdmJSiF4eYqRLDfLfWLyF-m0Mk3TOoLQXKKW0.cache +2 -0
  101. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/DmmfrCpXtt74Hr6NO54lxyOCDv6klnDyBqeDFR7oDU8.cache +2 -0
  102. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/EkdXohJZf4lGY8JzYoG_7LRxdszy4Swv_1-52AbtQWA.cache +0 -0
  103. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/FqGh56sHucOsjlGrWDO9yNwycTG0LgUKZ16k23kduns.cache +0 -0
  104. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/GeZkOF3Y0RVsr_bLJpt8e98qLe6tl2fanP3g8Au3Ki4.cache +1 -0
  105. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/OI6uxGcnsKavdWTtwDAasU3wPx8QXhzBgV0X2n1KjMQ.cache +2 -0
  106. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/PlM8l5Qld5XuE05WoFYFeHkdTOQlgQDeWcqChn7HrHY.cache +1 -0
  107. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/SRehtTwxOp9802ZoUXpvNaoiTUAAop3BKwD0zbFqDtE.cache +2 -0
  108. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/SrsOoZyuToCzWj-6-unzyuiaqTY_AaQ6OkmF1__p2pA.cache +1 -0
  109. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/Ve3Ff6BHeMiuu3shpU83x1W5kvA_9uYsJb4QTBpa_cg.cache +0 -0
  110. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/gGf5sYnraHtF9zAKHfpmAFfXs91eHz803uWElSZo8hU.cache +1 -0
  111. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/gQ3aDX081uviJlrMPWuDlBeI9mU60eQkKBT_tdRmfHA.cache +0 -0
  112. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/hZi1k6tpxxCGYxRe7zY74ItcOI8gZrREOpGuA8JSpGg.cache +2 -0
  113. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/ihA_BDp1Rs5WPDQas3L0pgMqmZCcgqozdQxu48rJb68.cache +1 -0
  114. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/pEhaat2KBd5SrT7szC_8R1_6hK17FTpvoRFkmCRSD3M.cache +2 -0
  115. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/qw9GAqewo2ndJbMp6cn6aiyI5zrb6Dc2AnBVBmpTAO8.cache +1 -0
  116. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/sjCpIVBR5YqsLCchRCDqeG_WK3Jn7Q3nlWVKNIwerDw.cache +0 -0
  117. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/tYWKJ-uJLzUiu_GSiw8U9c-NoKsmluXyJoybViJqqSo.cache +1 -0
  118. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uHgfxDUpQd144IiQx-xG6kwowy8G1sR4iyD9DNL0tC0.cache +1 -0
  119. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/uk3t8-0_vMYlXEFPI-zH6U2ONI0NwBrJJrQM2yq_fjQ.cache +0 -0
  120. data/test/dummy/tmp/cache/assets/test/sprockets/v3.0/zwMKri38-QDk453A_5RE9PYaTcHIoT73wl79q5P0qfI.cache +1 -0
  121. data/test/gov_uk_date_fields_test.rb +7 -0
  122. data/test/test_helper.rb +31 -0
  123. metadata +306 -0
@@ -0,0 +1,2 @@
1
+ // Place all the behaviors and hooks related to the matching controller here.
2
+ // All this logic will automatically be available in application.js.
@@ -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,4 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
@@ -0,0 +1,56 @@
1
+ body { background-color: #fff; color: #333; }
2
+
3
+ body, p, ol, ul, td {
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px;
7
+ }
8
+
9
+ pre {
10
+ background-color: #eee;
11
+ padding: 10px;
12
+ font-size: 11px;
13
+ }
14
+
15
+ a { color: #000; }
16
+ a:visited { color: #666; }
17
+ a:hover { color: #fff; background-color:#000; }
18
+
19
+ div.field, div.actions {
20
+ margin-bottom: 10px;
21
+ }
22
+
23
+ #notice {
24
+ color: green;
25
+ }
26
+
27
+ .field_with_errors {
28
+ padding: 2px;
29
+ background-color: red;
30
+ display: table;
31
+ }
32
+
33
+ #error_explanation {
34
+ width: 450px;
35
+ border: 2px solid red;
36
+ padding: 7px;
37
+ padding-bottom: 0;
38
+ margin-bottom: 20px;
39
+ background-color: #f0f0f0;
40
+ }
41
+
42
+ #error_explanation h2 {
43
+ text-align: left;
44
+ font-weight: bold;
45
+ padding: 5px 5px 5px 15px;
46
+ font-size: 12px;
47
+ margin: -7px;
48
+ margin-bottom: 0px;
49
+ background-color: #c00;
50
+ color: #fff;
51
+ }
52
+
53
+ #error_explanation ul li {
54
+ font-size: 12px;
55
+ list-style: square;
56
+ }
@@ -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,58 @@
1
+ class EmployeesController < ApplicationController
2
+ before_action :set_employee, only: [:show, :edit, :update, :destroy]
3
+
4
+ # GET /employees
5
+ def index
6
+ @employees = Employee.all
7
+ end
8
+
9
+ # GET /employees/1
10
+ def show
11
+ end
12
+
13
+ # GET /employees/new
14
+ def new
15
+ @employee = Employee.new
16
+ end
17
+
18
+ # GET /employees/1/edit
19
+ def edit
20
+ end
21
+
22
+ # POST /employees
23
+ def create
24
+ @employee = Employee.new(employee_params)
25
+
26
+ if @employee.save
27
+ redirect_to @employee, notice: 'Employee was successfully created.'
28
+ else
29
+ render :new
30
+ end
31
+ end
32
+
33
+ # PATCH/PUT /employees/1
34
+ def update
35
+ if @employee.update(employee_params)
36
+ redirect_to @employee, notice: 'Employee was successfully updated.'
37
+ else
38
+ render :edit
39
+ end
40
+ end
41
+
42
+ # DELETE /employees/1
43
+ def destroy
44
+ @employee.destroy
45
+ redirect_to employees_url, notice: 'Employee was successfully destroyed.'
46
+ end
47
+
48
+ private
49
+ # Use callbacks to share common setup or constraints between actions.
50
+ def set_employee
51
+ @employee = Employee.find(params[:id])
52
+ end
53
+
54
+ # Only allow a trusted parameter "white list" through.
55
+ def employee_params
56
+ params.require(:employee).permit(:name, :dob_dd, :dob_mm, :dob_yyyy, :joined_dd, :joined_mm, :joined_yyyy)
57
+ end
58
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module EmployeesHelper
2
+ end
@@ -0,0 +1,6 @@
1
+ class Employee < ActiveRecord::Base
2
+
3
+ acts_as_gov_uk_date :dob, :joined
4
+
5
+
6
+ end
@@ -0,0 +1,29 @@
1
+ <%= form_for(@employee) do |f| %>
2
+ <% if @employee.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@employee.errors.count, "error") %> prohibited this employee from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @employee.errors.full_messages.each do |message| %>
8
+ <li><%= message %></li>
9
+ <% end %>
10
+ </ul>
11
+ </div>
12
+ <% end %>
13
+
14
+ <div class="field">
15
+ <%= f.label :name %><br>
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :dob %><br>
20
+ <%= f.gov_uk_date_field :dob %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :joined %><br>
24
+ <%= f.gov_uk_date_field :joined %>
25
+ </div>
26
+ <div class="actions">
27
+ <%= f.submit %>
28
+ </div>
29
+ <% end %>
@@ -0,0 +1,6 @@
1
+ <h1>Editing Employee</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Show', @employee %> |
6
+ <%= link_to 'Back', employees_path %>
@@ -0,0 +1,31 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <h1>Listing Employees</h1>
4
+
5
+ <table>
6
+ <thead>
7
+ <tr>
8
+ <th>Name</th>
9
+ <th>Dob</th>
10
+ <th>Joined</th>
11
+ <th colspan="3"></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody>
16
+ <% @employees.each do |employee| %>
17
+ <tr>
18
+ <td><%= employee.name %></td>
19
+ <td><%= employee.dob %></td>
20
+ <td><%= employee.joined %></td>
21
+ <td><%= link_to 'Show', employee %></td>
22
+ <td><%= link_to 'Edit', edit_employee_path(employee) %></td>
23
+ <td><%= link_to 'Destroy', employee, method: :delete, data: { confirm: 'Are you sure?' } %></td>
24
+ </tr>
25
+ <% end %>
26
+ </tbody>
27
+ </table>
28
+
29
+ <br>
30
+
31
+ <%= link_to 'New Employee', new_employee_path %>
@@ -0,0 +1,5 @@
1
+ <h1>New Employee</h1>
2
+
3
+ <%= render 'form' %>
4
+
5
+ <%= link_to 'Back', employees_path %>
@@ -0,0 +1,19 @@
1
+ <p id="notice"><%= notice %></p>
2
+
3
+ <p>
4
+ <strong>Name:</strong>
5
+ <%= @employee.name %>
6
+ </p>
7
+
8
+ <p>
9
+ <strong>Dob:</strong>
10
+ <%= @employee.dob %>
11
+ </p>
12
+
13
+ <p>
14
+ <strong>Joined:</strong>
15
+ <%= @employee.joined %>
16
+ </p>
17
+
18
+ <%= link_to 'Edit', edit_employee_path(@employee) %> |
19
+ <%= link_to 'Back', employees_path %>
@@ -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
+ #!/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,25 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+ require 'rails/all'
3
+
4
+ Bundler.require(*Rails.groups)
5
+ require "gov_uk_date_fields"
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,85 @@
1
+ # PostgreSQL. Versions 8.2 and up are supported.
2
+ #
3
+ # Install the pg driver:
4
+ # gem install pg
5
+ # On OS X with Homebrew:
6
+ # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7
+ # On OS X with MacPorts:
8
+ # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9
+ # On Windows:
10
+ # gem install pg
11
+ # Choose the win32 build.
12
+ # Install PostgreSQL and put its /bin directory on your path.
13
+ #
14
+ # Configure Using Gemfile
15
+ # gem 'pg'
16
+ #
17
+ default: &default
18
+ adapter: postgresql
19
+ encoding: unicode
20
+ # For details on connection pooling, see rails configuration guide
21
+ # http://guides.rubyonrails.org/configuring.html#database-pooling
22
+ pool: 5
23
+
24
+ development:
25
+ <<: *default
26
+ database: dummy_development
27
+
28
+ # The specified database role being used to connect to postgres.
29
+ # To create additional roles in postgres see `$ createuser --help`.
30
+ # When left blank, postgres will use the default role. This is
31
+ # the same name as the operating system user that initialized the database.
32
+ #username: dummy
33
+
34
+ # The password associated with the postgres role (username).
35
+ #password:
36
+
37
+ # Connect on a TCP socket. Omitted by default since the client uses a
38
+ # domain socket that doesn't need configuration. Windows does not have
39
+ # domain sockets, so uncomment these lines.
40
+ #host: localhost
41
+
42
+ # The TCP port the server listens on. Defaults to 5432.
43
+ # If your server runs on a different port number, change accordingly.
44
+ #port: 5432
45
+
46
+ # Schema search path. The server defaults to $user,public
47
+ #schema_search_path: myapp,sharedapp,public
48
+
49
+ # Minimum log levels, in increasing order:
50
+ # debug5, debug4, debug3, debug2, debug1,
51
+ # log, notice, warning, error, fatal, and panic
52
+ # Defaults to warning.
53
+ #min_messages: notice
54
+
55
+ # Warning: The database defined as "test" will be erased and
56
+ # re-generated from your development database when you run "rake".
57
+ # Do not set this db to the same as development or production.
58
+ test:
59
+ <<: *default
60
+ database: dummy_test
61
+
62
+ # As with config/secrets.yml, you never want to store sensitive information,
63
+ # like your database password, in your source code. If your source code is
64
+ # ever seen by anyone, they now have access to your database.
65
+ #
66
+ # Instead, provide the password as a unix environment variable when you boot
67
+ # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
68
+ # for a full rundown on how to provide these environment variables in a
69
+ # production deployment.
70
+ #
71
+ # On Heroku and other platform providers, you may have a full connection URL
72
+ # available as an environment variable. For example:
73
+ #
74
+ # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
75
+ #
76
+ # You can use this database configuration with:
77
+ #
78
+ # production:
79
+ # url: <%= ENV['DATABASE_URL'] %>
80
+ #
81
+ production:
82
+ <<: *default
83
+ database: dummy_production
84
+ username: dummy
85
+ password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>