enju_seed 0.2.3 → 0.3.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +17 -8
- data/app/assets/config/enju_seed_manifest.js +0 -0
- data/app/controllers/my_accounts_controller.rb +14 -13
- data/app/controllers/profiles_controller.rb +30 -29
- data/app/controllers/roles_controller.rb +2 -1
- data/app/models/concerns/enju_seed/enju_user.rb +22 -26
- data/app/models/concerns/master_model.rb +5 -6
- data/app/models/identity.rb +1 -1
- data/app/models/profile.rb +3 -3
- data/app/models/role.rb +2 -1
- data/app/models/user_has_role.rb +2 -2
- data/app/views/my_accounts/_edit_credential.html.slim +63 -0
- data/app/views/my_accounts/_form.html.slim +20 -0
- data/app/views/my_accounts/_show.html.slim +1 -0
- data/app/views/my_accounts/edit.html.slim +30 -0
- data/app/views/my_accounts/show.html+phone.slim +1 -0
- data/app/views/my_accounts/show.html.slim +57 -0
- data/app/views/profiles/_edit_credential.html.slim +67 -0
- data/app/views/profiles/_edit_profile.html.slim +40 -0
- data/app/views/profiles/_form.html.slim +12 -0
- data/app/views/profiles/_show.html.slim +1 -0
- data/app/views/profiles/edit.html.slim +30 -0
- data/app/views/profiles/index.html.slim +61 -0
- data/app/views/profiles/new.html.slim +65 -0
- data/app/views/profiles/show.html+phone.slim +1 -0
- data/app/views/profiles/show.html.slim +67 -0
- data/app/views/roles/_form.html.slim +16 -0
- data/app/views/roles/edit.html.slim +15 -0
- data/app/views/roles/index.html.slim +27 -0
- data/app/views/roles/new.html.slim +13 -0
- data/app/views/roles/show.html.slim +46 -0
- data/db/migrate/041_create_roles.rb +3 -3
- data/db/migrate/20130221154434_add_additional_attributes_to_user.rb +3 -3
- data/lib/enju_seed.rb +2 -3
- data/lib/enju_seed/engine.rb +1 -2
- data/lib/enju_seed/localized_name.rb +1 -3
- data/lib/enju_seed/version.rb +1 -1
- data/spec/controllers/my_accounts_controller_spec.rb +79 -79
- data/spec/controllers/profiles_controller_spec.rb +210 -210
- data/spec/controllers/roles_controller_spec.rb +47 -47
- data/spec/dummy/app/helpers/application_helper.rb +1 -1
- data/spec/dummy/app/models/user.rb +2 -2
- data/spec/dummy/bin/setup +8 -8
- data/spec/dummy/config/application.rb +2 -18
- data/spec/dummy/config/database.yml +70 -10
- data/spec/dummy/config/environment.rb +1 -1
- data/spec/dummy/config/environments/development.rb +24 -11
- data/spec/dummy/config/environments/production.rb +24 -17
- data/spec/dummy/config/environments/test.rb +6 -6
- data/spec/dummy/config/initializers/assets.rb +1 -1
- data/spec/dummy/config/initializers/friendly_id.rb +75 -75
- data/spec/dummy/db/migrate/001_create_agents.rb +6 -6
- data/spec/dummy/db/migrate/002_devise_create_users.rb +5 -6
- data/spec/dummy/db/migrate/005_create_manifestations.rb +12 -12
- data/spec/dummy/db/migrate/006_create_items.rb +5 -5
- data/spec/dummy/db/migrate/012_create_owns.rb +2 -2
- data/spec/dummy/db/migrate/015_create_creates.rb +2 -2
- data/spec/dummy/db/migrate/032_create_checkins.rb +1 -1
- data/spec/dummy/db/migrate/033_create_checkouts.rb +4 -4
- data/spec/dummy/db/migrate/035_create_reserves.rb +5 -5
- data/spec/dummy/db/migrate/047_create_produces.rb +2 -2
- data/spec/dummy/db/migrate/059_create_libraries.rb +6 -4
- data/spec/dummy/db/migrate/069_create_shelves.rb +2 -1
- data/spec/dummy/db/migrate/073_create_carrier_types.rb +1 -1
- data/spec/dummy/db/migrate/077_create_user_groups.rb +1 -1
- data/spec/dummy/db/migrate/080_create_library_groups.rb +2 -1
- data/spec/dummy/db/migrate/112_create_frequencies.rb +1 -1
- data/spec/dummy/db/migrate/117_create_form_of_works.rb +1 -1
- data/spec/dummy/db/migrate/120_create_baskets.rb +2 -1
- data/spec/dummy/db/migrate/121_create_checked_items.rb +3 -3
- data/spec/dummy/db/migrate/124_create_bookstores.rb +1 -1
- data/spec/dummy/db/migrate/125_create_donates.rb +2 -2
- data/spec/dummy/db/migrate/127_create_use_restrictions.rb +1 -1
- data/spec/dummy/db/migrate/129_create_item_has_use_restrictions.rb +2 -2
- data/spec/dummy/db/migrate/130_create_request_status_types.rb +1 -1
- data/spec/dummy/db/migrate/131_create_request_types.rb +1 -1
- data/spec/dummy/db/migrate/132_create_circulation_statuses.rb +1 -1
- data/spec/dummy/db/migrate/133_create_agent_merges.rb +1 -1
- data/spec/dummy/db/migrate/149_create_message_templates.rb +5 -5
- data/spec/dummy/db/migrate/154_create_messages.rb +2 -2
- data/spec/dummy/db/migrate/20080830154109_create_realizes.rb +2 -2
- data/spec/dummy/db/migrate/20080830172106_create_exemplifies.rb +13 -0
- data/spec/dummy/db/migrate/20080905191442_create_agent_types.rb +1 -1
- data/spec/dummy/db/migrate/20081006090811_create_subscriptions.rb +5 -2
- data/spec/dummy/db/migrate/20081006093246_create_subscribes.rb +2 -1
- data/spec/dummy/db/migrate/20081023092436_create_search_engines.rb +5 -5
- data/spec/dummy/db/migrate/20081025083323_create_countries.rb +8 -9
- data/spec/dummy/db/migrate/20081025083905_create_languages.rb +5 -6
- data/spec/dummy/db/migrate/20081027150907_create_picture_files.rb +1 -1
- data/spec/dummy/db/migrate/20081030023412_create_checkout_types.rb +1 -1
- data/spec/dummy/db/migrate/20081030023518_create_user_group_has_checkout_types.rb +8 -8
- data/spec/dummy/db/migrate/20081030023615_create_carrier_type_has_checkout_types.rb +3 -3
- data/spec/dummy/db/migrate/20081212075554_create_checkout_stat_has_manifestations.rb +4 -4
- data/spec/dummy/db/migrate/20081215094955_create_checkout_stat_has_users.rb +3 -3
- data/spec/dummy/db/migrate/20081216190517_create_reserve_stat_has_manifestations.rb +3 -3
- data/spec/dummy/db/migrate/20081220034117_create_reserve_stat_has_users.rb +2 -2
- data/spec/dummy/db/migrate/20090720091106_create_medium_of_performances.rb +1 -1
- data/spec/dummy/db/migrate/20090720091429_create_content_types.rb +1 -1
- data/spec/dummy/db/migrate/20090812151902_create_agent_relationship_types.rb +1 -1
- data/spec/dummy/db/migrate/20090831220301_create_lending_policies.rb +6 -6
- data/spec/dummy/db/migrate/20091025080447_create_licenses.rb +1 -1
- data/spec/dummy/db/migrate/20100607044753_create_manifestation_relationship_types.rb +1 -1
- data/spec/dummy/db/migrate/20110222073537_add_url_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20110318183304_add_valid_period_for_new_user_to_user_group.rb +1 -1
- data/spec/dummy/db/migrate/20110627035057_create_series_statement_merges.rb +3 -3
- data/spec/dummy/db/migrate/20110627122938_add_number_of_day_to_notify_overdue_to_user_group.rb +3 -3
- data/spec/dummy/db/migrate/20120125050502_add_depth_to_message.rb +0 -1
- data/spec/dummy/db/migrate/20120125152919_add_title_subseries_transcription_to_series_statement.rb +0 -1
- data/spec/dummy/db/migrate/20120129020544_add_budget_type_id_to_item.rb +0 -1
- data/spec/dummy/db/migrate/20120319120638_add_content_type_id_to_manifestation.rb +1 -2
- data/spec/dummy/db/migrate/20120319173203_create_accepts.rb +6 -3
- data/spec/dummy/db/migrate/20120510140958_add_closed_to_shelf.rb +1 -1
- data/spec/dummy/db/migrate/20130416054135_add_circulation_status_id_to_item.rb +2 -2
- data/spec/dummy/db/migrate/20130506175834_create_identifiers.rb +2 -2
- data/spec/dummy/db/migrate/20130519065638_add_lock_version_to_reserve.rb +1 -1
- data/spec/dummy/db/migrate/20130519065837_add_lock_version_to_checkin.rb +1 -1
- data/spec/dummy/db/migrate/20140518050147_create_reserve_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140518111006_create_message_transitions.rb +2 -2
- data/spec/dummy/db/migrate/20140518135713_create_message_request_transitions.rb +3 -3
- data/spec/dummy/db/migrate/20140519170214_create_resource_import_file_transitions.rb +4 -4
- data/spec/dummy/db/migrate/20140519171220_create_import_request_transitions.rb +3 -3
- data/spec/dummy/db/migrate/20140524020735_create_agent_import_file_transitions.rb +3 -3
- data/spec/dummy/db/migrate/20140524074813_create_user_import_file_transitions.rb +3 -3
- data/spec/dummy/db/migrate/20140528045518_create_user_checkout_stat_transitions.rb +3 -3
- data/spec/dummy/db/migrate/20140528045539_create_user_reserve_stat_transitions.rb +3 -3
- data/spec/dummy/db/migrate/20140528045600_create_manifestation_checkout_stat_transitions.rb +4 -4
- data/spec/dummy/db/migrate/20140528045617_create_manifestation_reserve_stat_transitions.rb +4 -4
- data/spec/dummy/db/migrate/20140614065404_create_resource_export_files.rb +0 -1
- data/spec/dummy/db/migrate/20140614141500_create_resource_export_file_transitions.rb +4 -4
- data/spec/dummy/db/migrate/20140709113413_create_user_export_files.rb +0 -1
- data/spec/dummy/db/migrate/20140709113905_create_user_export_file_transitions.rb +4 -4
- data/spec/dummy/db/migrate/20140810091231_add_checkout_icalendar_token_to_profile.rb +1 -1
- data/spec/dummy/db/migrate/20140810091417_add_save_checkout_history_to_profile.rb +1 -1
- data/spec/dummy/db/migrate/20140821151023_create_colors.rb +3 -1
- data/spec/dummy/db/migrate/20141029131633_create_periodicals.rb +11 -0
- data/spec/dummy/db/migrate/20150124152756_add_foreign_key_to_shelves_referencing_libraries.rb +6 -0
- data/spec/dummy/db/migrate/20150221063719_add_settings_to_library_group.rb +1 -1
- data/spec/dummy/db/migrate/20150302110310_add_attachment_id_to_manifestation.rb +7 -0
- data/spec/dummy/db/migrate/20150304183215_add_picture_id_to_picture_file.rb +7 -0
- data/spec/dummy/db/migrate/20150305025906_add_resource_import_id_to_resource_import_file.rb +7 -0
- data/spec/dummy/db/migrate/20150305030046_add_resource_export_id_to_resource_export_file.rb +8 -0
- data/spec/dummy/db/migrate/20150305031709_add_agent_import_id_to_agent_import_file.rb +7 -0
- data/spec/dummy/db/migrate/20150305105231_add_attachment_fingerprint_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20150420145354_add_attachment_to_carrier_type.rb +8 -0
- data/spec/dummy/db/migrate/20150420145420_add_attachment_to_content_type.rb +8 -0
- data/spec/dummy/db/migrate/20150924115059_create_withdraws.rb +5 -3
- data/spec/dummy/db/migrate/20151213070943_add_translation_table_to_library_group.rb +2 -4
- data/spec/dummy/db/migrate/20151213072705_add_footer_banner_to_library_group.rb +2 -19
- data/spec/dummy/db/migrate/20151216123621_create_doi_records.rb +12 -0
- data/spec/dummy/db/migrate/20160319144230_create_issn_records.rb +12 -0
- data/spec/dummy/db/migrate/20160506144040_create_isbn_records.rb +12 -0
- data/spec/dummy/db/migrate/20160513000929_create_agent_names.rb +18 -0
- data/spec/dummy/db/migrate/20160801080612_add_most_recent_to_import_request_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160801080619_add_most_recent_to_resource_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160801080637_add_most_recent_to_resource_export_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20160801080643_add_most_recent_to_agent_import_file_transitions.rb +9 -0
- data/spec/dummy/db/migrate/20161111175127_add_attachment_data_to_manifestation.rb +5 -0
- data/spec/dummy/db/migrate/20161111193255_add_attachment_data_to_carrier_type.rb +5 -0
- data/spec/dummy/db/migrate/20161111193346_add_attachment_data_to_content_type.rb +5 -0
- data/spec/dummy/db/migrate/20161112122706_add_attachment_data_to_resource_import_file.rb +5 -0
- data/spec/dummy/db/migrate/20161112122750_add_attachment_data_to_resource_export_file.rb +5 -0
- data/spec/dummy/db/migrate/20161112122814_add_attachment_data_to_agent_import_file.rb +5 -0
- data/spec/dummy/db/schema.rb +1418 -1402
- data/spec/factories/profile.rb +10 -10
- data/spec/factories/user.rb +10 -10
- data/spec/factories/user_group.rb +2 -2
- data/spec/fixtures/library_groups.yml +1 -0
- data/spec/models/profile_spec.rb +20 -19
- data/spec/models/role_spec.rb +7 -7
- data/spec/models/user_has_role_spec.rb +1 -2
- data/spec/models/user_spec.rb +25 -26
- data/spec/rails_helper.rb +7 -6
- data/spec/requests/profiles_spec.rb +3 -3
- data/spec/routing/profiles_routing_spec.rb +16 -18
- data/spec/routing/roles_routing_spec.rb +16 -18
- data/spec/routing/users_spec.rb +6 -7
- data/spec/spec_helper.rb +47 -49
- data/spec/support/controller_macros.rb +9 -9
- data/spec/views/my_accounts/show.html.erb_spec.rb +6 -6
- data/spec/views/profiles/edit.html.erb_spec.rb +7 -7
- data/spec/views/profiles/index.html.erb_spec.rb +3 -3
- data/spec/views/profiles/new.html.erb_spec.rb +5 -6
- data/spec/views/profiles/show.html.erb_spec.rb +3 -3
- metadata +323 -323
- data/app/views/my_accounts/_edit_credential.html.erb +0 -99
- data/app/views/my_accounts/_form.html.erb +0 -24
- data/app/views/my_accounts/_show.html.erb +0 -1
- data/app/views/my_accounts/edit.html.erb +0 -32
- data/app/views/my_accounts/show.html.erb +0 -49
- data/app/views/profiles/_edit_profile.html.erb +0 -42
- data/app/views/profiles/_form.html.erb +0 -15
- data/app/views/profiles/_show.html.erb +0 -1
- data/app/views/profiles/edit.html.erb +0 -33
- data/app/views/profiles/index.html.erb +0 -70
- data/app/views/profiles/new.html.erb +0 -88
- data/app/views/profiles/show.html+phone.erb +0 -1
- data/app/views/profiles/show.html.erb +0 -67
- data/app/views/roles/_form.html.erb +0 -19
- data/app/views/roles/edit.html.erb +0 -13
- data/app/views/roles/index.html.erb +0 -32
- data/app/views/roles/new.html.erb +0 -12
- data/app/views/roles/show.html.erb +0 -46
- data/lib/generators/enju_seed/update/update_generator.rb +0 -9
- data/spec/dummy/db/migrate/20170305064014_add_csv_charset_conversion_to_library_group.rb +0 -5
- data/spec/dummy/db/migrate/20171014084528_add_header_logo_to_library_group.rb +0 -5
- data/spec/dummy/db/migrate/20171126133835_rename_login_banner_to_old_login_banner.rb +0 -5
- data/spec/dummy/db/migrate/20171126135238_add_foreign_key_to_library_group_id_on_library.rb +0 -5
- data/spec/dummy/db/migrate/20180102162311_add_header_logo_meta_to_library_group.rb +0 -5
@@ -3,131 +3,131 @@ require 'spec_helper'
|
|
3
3
|
describe RolesController do
|
4
4
|
fixtures :all
|
5
5
|
|
6
|
-
describe
|
7
|
-
describe
|
6
|
+
describe 'GET index' do
|
7
|
+
describe 'When logged in as Administrator' do
|
8
8
|
login_fixture_admin
|
9
9
|
|
10
|
-
it
|
10
|
+
it 'assigns all roles as @roles' do
|
11
11
|
get :index
|
12
12
|
expect(assigns(:roles)).to eq(Role.order(:position))
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
describe
|
16
|
+
describe 'When logged in as Librarian' do
|
17
17
|
login_fixture_librarian
|
18
18
|
|
19
|
-
it
|
19
|
+
it 'assigns all roles as @roles' do
|
20
20
|
get :index
|
21
21
|
expect(assigns(:roles)).to eq(Role.order(:position))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
describe
|
25
|
+
describe 'When logged in as User' do
|
26
26
|
login_fixture_user
|
27
27
|
|
28
|
-
it
|
28
|
+
it 'assigns all roles as @roles' do
|
29
29
|
get :index
|
30
30
|
expect(assigns(:roles)).to be_nil
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe
|
35
|
-
it
|
34
|
+
describe 'When not logged in' do
|
35
|
+
it 'assigns all roles as @roles' do
|
36
36
|
get :index
|
37
37
|
expect(assigns(:roles)).to be_nil
|
38
38
|
end
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
describe
|
43
|
-
describe
|
42
|
+
describe 'GET show' do
|
43
|
+
describe 'When logged in as Administrator' do
|
44
44
|
login_fixture_admin
|
45
45
|
|
46
|
-
it
|
46
|
+
it 'assigns the requested role as @role' do
|
47
47
|
role = Role.find(1)
|
48
|
-
get :show, id: role.id
|
48
|
+
get :show, params: { id: role.id }
|
49
49
|
expect(assigns(:role)).to eq(role)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
describe
|
54
|
-
it
|
53
|
+
describe 'When not logged in' do
|
54
|
+
it 'assigns the requested role as @role' do
|
55
55
|
role = Role.find(1)
|
56
|
-
get :show, id: role.id
|
56
|
+
get :show, params: { id: role.id }
|
57
57
|
expect(assigns(:role)).to eq(role)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
describe
|
63
|
-
describe
|
62
|
+
describe 'GET edit' do
|
63
|
+
describe 'When logged in as Administrator' do
|
64
64
|
login_fixture_admin
|
65
65
|
|
66
|
-
it
|
66
|
+
it 'assigns the requested role as @role' do
|
67
67
|
role = Role.find(1)
|
68
|
-
get :edit, id: role.id
|
68
|
+
get :edit, params: { id: role.id }
|
69
69
|
expect(assigns(:role)).to eq(role)
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
-
describe
|
74
|
-
it
|
73
|
+
describe 'When not logged in' do
|
74
|
+
it 'should not assign the requested role as @role' do
|
75
75
|
role = Role.find(1)
|
76
|
-
get :edit, id: role.id
|
76
|
+
get :edit, params: { id: role.id }
|
77
77
|
expect(response).to redirect_to(new_user_session_url)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
describe
|
82
|
+
describe 'PUT update' do
|
83
83
|
before(:each) do
|
84
84
|
@role = Role.find(1)
|
85
|
-
@attrs = {:
|
86
|
-
@invalid_attrs = {name: ''}
|
85
|
+
@attrs = { display_name: 'guest user' }
|
86
|
+
@invalid_attrs = { name: '' }
|
87
87
|
end
|
88
88
|
|
89
|
-
describe
|
89
|
+
describe 'When logged in as Administrator' do
|
90
90
|
login_fixture_admin
|
91
91
|
|
92
|
-
describe
|
93
|
-
it
|
94
|
-
put :update, id: @role.id, :
|
92
|
+
describe 'with valid params' do
|
93
|
+
it 'updates the requested role' do
|
94
|
+
put :update, params: { id: @role.id, role: @attrs }
|
95
95
|
end
|
96
96
|
|
97
|
-
it
|
98
|
-
put :update, id: @role.id, :
|
97
|
+
it 'assigns the requested role as @role' do
|
98
|
+
put :update, params: { id: @role.id, role: @attrs }
|
99
99
|
expect(assigns(:role)).to eq(@role)
|
100
100
|
end
|
101
101
|
|
102
|
-
it
|
103
|
-
put :update, id: @role.id, :
|
102
|
+
it 'moves its position when specified' do
|
103
|
+
put :update, params: { id: @role.id, role: @attrs, move: 'lower' }
|
104
104
|
expect(response).to redirect_to(roles_url)
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
|
-
describe
|
109
|
-
it
|
110
|
-
put :update, id: @role.id, :
|
111
|
-
expect(response).to render_template(
|
108
|
+
describe 'with invalid params' do
|
109
|
+
it 'assigns the requested role as @role' do
|
110
|
+
put :update, params: { id: @role.id, role: @invalid_attrs }
|
111
|
+
expect(response).to render_template('edit')
|
112
112
|
end
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
116
|
-
describe
|
117
|
-
describe
|
118
|
-
it
|
119
|
-
put :update, id: @role.id, :
|
116
|
+
describe 'When not logged in' do
|
117
|
+
describe 'with valid params' do
|
118
|
+
it 'updates the requested role' do
|
119
|
+
put :update, params: { id: @role.id, role: @attrs }
|
120
120
|
end
|
121
121
|
|
122
|
-
it
|
123
|
-
put :update, id: @role.id, :
|
122
|
+
it 'should be forbidden' do
|
123
|
+
put :update, params: { id: @role.id, role: @attrs }
|
124
124
|
expect(response).to redirect_to(new_user_session_url)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
-
describe
|
129
|
-
it
|
130
|
-
put :update, id: @role.id, :
|
128
|
+
describe 'with invalid params' do
|
129
|
+
it 'assigns the requested role as @role' do
|
130
|
+
put :update, params: { id: @role.id, role: @invalid_attrs }
|
131
131
|
expect(response).to redirect_to(new_user_session_url)
|
132
132
|
end
|
133
133
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class User < ActiveRecord::Base
|
2
2
|
devise :database_authenticatable, #:registerable,
|
3
|
-
|
4
|
-
|
3
|
+
:recoverable, :rememberable, :trackable, # , :validatable
|
4
|
+
:lockable, lock_strategy: :none, unlock_strategy: :none
|
5
5
|
|
6
6
|
include EnjuSeed::EnjuUser
|
7
7
|
end
|
data/spec/dummy/bin/setup
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
require 'pathname'
|
3
3
|
|
4
4
|
# path to your application root.
|
5
|
-
APP_ROOT = Pathname.new File.expand_path('../../',
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
6
|
|
7
7
|
Dir.chdir APP_ROOT do
|
8
8
|
# This script is a starting point to setup your application.
|
9
9
|
# Add necessary setup steps to this file:
|
10
10
|
|
11
|
-
puts
|
12
|
-
system
|
13
|
-
system
|
11
|
+
puts '== Installing dependencies =='
|
12
|
+
system 'gem install bundler --conservative'
|
13
|
+
system 'bundle check || bundle install'
|
14
14
|
|
15
15
|
# puts "\n== Copying sample files =="
|
16
16
|
# unless File.exist?("config/database.yml")
|
@@ -18,12 +18,12 @@ Dir.chdir APP_ROOT do
|
|
18
18
|
# end
|
19
19
|
|
20
20
|
puts "\n== Preparing database =="
|
21
|
-
system
|
21
|
+
system 'bin/rake db:setup'
|
22
22
|
|
23
23
|
puts "\n== Removing old logs and tempfiles =="
|
24
|
-
system
|
25
|
-
system
|
24
|
+
system 'rm -f log/*'
|
25
|
+
system 'rm -rf tmp/cache'
|
26
26
|
|
27
27
|
puts "\n== Restarting application server =="
|
28
|
-
system
|
28
|
+
system 'touch tmp/restart.txt'
|
29
29
|
end
|
@@ -1,30 +1,14 @@
|
|
1
|
-
|
1
|
+
require_relative 'boot'
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
5
|
Bundler.require(*Rails.groups)
|
6
|
-
require
|
7
|
-
require "enju_leaf"
|
8
|
-
require 'globalize'
|
9
|
-
require 'globalize-accessors'
|
6
|
+
require 'enju_seed'
|
10
7
|
|
11
8
|
module Dummy
|
12
9
|
class Application < Rails::Application
|
13
10
|
# Settings in config/environments/* take precedence over those specified here.
|
14
11
|
# Application configuration should go into files in config/initializers
|
15
12
|
# -- all .rb files in that directory are automatically loaded.
|
16
|
-
|
17
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
18
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
19
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
20
|
-
|
21
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
22
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
23
|
-
# config.i18n.default_locale = :de
|
24
|
-
|
25
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
26
|
-
config.active_record.raise_in_transactional_callbacks = true
|
27
|
-
config.action_mailer.default_url_options = {host: 'localhost:3000'}
|
28
13
|
end
|
29
14
|
end
|
30
|
-
|
@@ -1,25 +1,85 @@
|
|
1
|
-
#
|
2
|
-
# gem install sqlite3
|
1
|
+
# PostgreSQL. Versions 9.1 and up are supported.
|
3
2
|
#
|
4
|
-
#
|
5
|
-
# gem
|
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'
|
6
16
|
#
|
7
17
|
default: &default
|
8
|
-
adapter:
|
9
|
-
|
10
|
-
|
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: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
11
23
|
|
12
24
|
development:
|
13
25
|
<<: *default
|
14
|
-
database:
|
26
|
+
database: enju_seed_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
|
15
54
|
|
16
55
|
# Warning: The database defined as "test" will be erased and
|
17
56
|
# re-generated from your development database when you run "rake".
|
18
57
|
# Do not set this db to the same as development or production.
|
19
58
|
test:
|
20
59
|
<<: *default
|
21
|
-
database:
|
60
|
+
database: enju_seed_dummy_test
|
22
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
|
+
#
|
23
81
|
production:
|
24
82
|
<<: *default
|
25
|
-
database:
|
83
|
+
database: enju_seed_dummy_production
|
84
|
+
username: dummy
|
85
|
+
password: <%= ENV['DUMMY_DATABASE_PASSWORD'] %>
|
@@ -9,13 +9,28 @@ Rails.application.configure do
|
|
9
9
|
# Do not eager load code on boot.
|
10
10
|
config.eager_load = false
|
11
11
|
|
12
|
-
# Show full error reports
|
13
|
-
config.consider_all_requests_local
|
14
|
-
|
12
|
+
# Show full error reports.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
|
15
|
+
# Enable/disable caching. By default caching is disabled.
|
16
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
17
|
+
config.action_controller.perform_caching = true
|
18
|
+
|
19
|
+
config.cache_store = :memory_store
|
20
|
+
config.public_file_server.headers = {
|
21
|
+
'Cache-Control' => 'public, max-age=172800'
|
22
|
+
}
|
23
|
+
else
|
24
|
+
config.action_controller.perform_caching = false
|
25
|
+
|
26
|
+
config.cache_store = :null_store
|
27
|
+
end
|
15
28
|
|
16
29
|
# Don't care if the mailer can't send.
|
17
30
|
config.action_mailer.raise_delivery_errors = false
|
18
31
|
|
32
|
+
config.action_mailer.perform_caching = false
|
33
|
+
|
19
34
|
# Print deprecation notices to the Rails logger.
|
20
35
|
config.active_support.deprecation = :log
|
21
36
|
|
@@ -27,15 +42,13 @@ Rails.application.configure do
|
|
27
42
|
# number of complex assets.
|
28
43
|
config.assets.debug = true
|
29
44
|
|
30
|
-
#
|
31
|
-
|
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
|
45
|
+
# Suppress logger output for asset requests.
|
46
|
+
config.assets.quiet = true
|
38
47
|
|
39
48
|
# Raises error for missing translations
|
40
49
|
# config.action_view.raise_on_missing_translations = true
|
50
|
+
|
51
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
52
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
53
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
41
54
|
end
|
@@ -14,15 +14,9 @@ Rails.application.configure do
|
|
14
14
|
config.consider_all_requests_local = false
|
15
15
|
config.action_controller.perform_caching = true
|
16
16
|
|
17
|
-
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
-
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
-
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
-
# NGINX, varnish or squid.
|
21
|
-
# config.action_dispatch.rack_cache = true
|
22
|
-
|
23
17
|
# Disable serving static files from the `/public` folder by default since
|
24
18
|
# Apache or NGINX already handles this.
|
25
|
-
config.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
26
20
|
|
27
21
|
# Compress JavaScripts and CSS.
|
28
22
|
config.assets.js_compressor = :uglifier
|
@@ -31,16 +25,20 @@ Rails.application.configure do
|
|
31
25
|
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
32
26
|
config.assets.compile = false
|
33
27
|
|
34
|
-
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
35
|
-
# yet still be able to expire them through the digest params.
|
36
|
-
config.assets.digest = true
|
37
|
-
|
38
28
|
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
39
29
|
|
30
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
31
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
32
|
+
|
40
33
|
# Specifies the header that your server uses for sending files.
|
41
34
|
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
42
35
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
43
36
|
|
37
|
+
# Mount Action Cable outside main process or domain
|
38
|
+
# config.action_cable.mount_path = nil
|
39
|
+
# config.action_cable.url = 'wss://example.com/cable'
|
40
|
+
# config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
|
41
|
+
|
44
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
45
43
|
# config.force_ssl = true
|
46
44
|
|
@@ -49,16 +47,15 @@ Rails.application.configure do
|
|
49
47
|
config.log_level = :debug
|
50
48
|
|
51
49
|
# Prepend all log lines with the following tags.
|
52
|
-
|
53
|
-
|
54
|
-
# Use a different logger for distributed setups.
|
55
|
-
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
50
|
+
config.log_tags = [:request_id]
|
56
51
|
|
57
52
|
# Use a different cache store in production.
|
58
53
|
# config.cache_store = :mem_cache_store
|
59
54
|
|
60
|
-
#
|
61
|
-
# config.
|
55
|
+
# Use a real queuing backend for Active Job (and separate queues per environment)
|
56
|
+
# config.active_job.queue_adapter = :resque
|
57
|
+
# config.active_job.queue_name_prefix = "dummy_#{Rails.env}"
|
58
|
+
config.action_mailer.perform_caching = false
|
62
59
|
|
63
60
|
# Ignore bad email addresses and do not raise email delivery errors.
|
64
61
|
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
@@ -74,6 +71,16 @@ Rails.application.configure do
|
|
74
71
|
# Use default logging formatter so that PID and timestamp are not suppressed.
|
75
72
|
config.log_formatter = ::Logger::Formatter.new
|
76
73
|
|
74
|
+
# Use a different logger for distributed setups.
|
75
|
+
# require 'syslog/logger'
|
76
|
+
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
77
|
+
|
78
|
+
if ENV['RAILS_LOG_TO_STDOUT'].present?
|
79
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
80
|
+
logger.formatter = config.log_formatter
|
81
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
82
|
+
end
|
83
|
+
|
77
84
|
# Do not dump schema after migrations.
|
78
85
|
config.active_record.dump_schema_after_migration = false
|
79
86
|
end
|