know_more 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +130 -0
- data/Rakefile +26 -0
- data/app/assets/config/know_more_manifest.js +2 -0
- data/app/assets/javascripts/know_more/application.js +13 -0
- data/app/assets/stylesheets/know_more/application.css +15 -0
- data/app/controllers/know_more/application_controller.rb +5 -0
- data/app/controllers/know_more/controller_helpers.rb +14 -0
- data/app/controllers/know_more/questionnaire_controller.rb +55 -0
- data/app/helpers/know_more/application_helper.rb +4 -0
- data/app/jobs/know_more/application_job.rb +4 -0
- data/app/mailers/know_more/application_mailer.rb +6 -0
- data/app/models/concerns/know_more/application_record.rb +5 -0
- data/app/models/concerns/know_more/questionnaire.rb +7 -0
- data/app/views/layouts/know_more/application.html.erb +14 -0
- data/config/routes.rb +7 -0
- data/lib/generators/know_more/init_generator.rb +13 -0
- data/lib/generators/know_more/install_generator.rb +45 -0
- data/lib/generators/know_more/templates/concerns.rb.erb +23 -0
- data/lib/generators/know_more/templates/erb/page_template.erb +39 -0
- data/lib/generators/know_more/templates/haml/page_template.erb +32 -0
- data/lib/generators/know_more/templates/initializer.rb.erb +4 -0
- data/lib/generators/know_more/templates/models/migration.rb.erb +9 -0
- data/lib/generators/know_more/templates/models/model.rb.erb +3 -0
- data/lib/know_more.rb +6 -0
- data/lib/know_more/base.rb +24 -0
- data/lib/know_more/configuration.rb +9 -0
- data/lib/know_more/engine.rb +16 -0
- data/lib/know_more/version.rb +3 -0
- data/lib/tasks/know_more_tasks.rake +4 -0
- data/spec/rails_helper.rb +57 -0
- data/spec/spec_helper.rb +99 -0
- data/spec/test_app/Rakefile +6 -0
- data/spec/test_app/app/assets/config/manifest.js +5 -0
- data/spec/test_app/app/assets/javascripts/application.js +15 -0
- data/spec/test_app/app/assets/javascripts/cable.js +13 -0
- data/spec/test_app/app/assets/stylesheets/application.css +15 -0
- data/spec/test_app/app/channels/application_cable/channel.rb +4 -0
- data/spec/test_app/app/channels/application_cable/connection.rb +4 -0
- data/spec/test_app/app/controllers/application_controller.rb +8 -0
- data/spec/test_app/app/controllers/concerns/know_more/questionnaire_controller_concerns.rb +42 -0
- data/spec/test_app/app/controllers/welcome_controller.rb +5 -0
- data/spec/test_app/app/helpers/application_helper.rb +2 -0
- data/spec/test_app/app/jobs/application_job.rb +2 -0
- data/spec/test_app/app/mailers/application_mailer.rb +4 -0
- data/spec/test_app/app/models/application_record.rb +3 -0
- data/spec/test_app/app/models/questionnaire.rb +3 -0
- data/spec/test_app/app/views/know_more/questionnaire/step1.html.haml +29 -0
- data/spec/test_app/app/views/know_more/questionnaire/step2.html.haml +31 -0
- data/spec/test_app/app/views/know_more/questionnaire/step3.html.haml +30 -0
- data/spec/test_app/app/views/layouts/application.html.erb +14 -0
- data/spec/test_app/app/views/layouts/mailer.html.erb +13 -0
- data/spec/test_app/app/views/layouts/mailer.text.erb +1 -0
- data/spec/test_app/app/views/welcome/hello.html.erb +1 -0
- data/spec/test_app/bin/bundle +3 -0
- data/spec/test_app/bin/rails +4 -0
- data/spec/test_app/bin/rake +4 -0
- data/spec/test_app/bin/setup +34 -0
- data/spec/test_app/bin/update +29 -0
- data/spec/test_app/config.ru +5 -0
- data/spec/test_app/config/application.rb +23 -0
- data/spec/test_app/config/boot.rb +5 -0
- data/spec/test_app/config/cable.yml +9 -0
- data/spec/test_app/config/database.yml +25 -0
- data/spec/test_app/config/environment.rb +5 -0
- data/spec/test_app/config/environments/development.rb +54 -0
- data/spec/test_app/config/environments/production.rb +86 -0
- data/spec/test_app/config/environments/test.rb +42 -0
- data/spec/test_app/config/initializers/application_controller_renderer.rb +6 -0
- data/spec/test_app/config/initializers/assets.rb +11 -0
- data/spec/test_app/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/test_app/config/initializers/cookies_serializer.rb +5 -0
- data/spec/test_app/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/test_app/config/initializers/inflections.rb +16 -0
- data/spec/test_app/config/initializers/know_more.rb +4 -0
- data/spec/test_app/config/initializers/mime_types.rb +4 -0
- data/spec/test_app/config/initializers/new_framework_defaults.rb +24 -0
- data/spec/test_app/config/initializers/session_store.rb +3 -0
- data/spec/test_app/config/initializers/wrap_parameters.rb +14 -0
- data/spec/test_app/config/locales/en.yml +23 -0
- data/spec/test_app/config/puma.rb +47 -0
- data/spec/test_app/config/routes.rb +5 -0
- data/spec/test_app/config/secrets.yml +22 -0
- data/spec/test_app/config/spring.rb +6 -0
- data/spec/test_app/db/development.sqlite3 +0 -0
- data/spec/test_app/db/migrate/20161027141359_create_questionnaire.rb +12 -0
- data/spec/test_app/db/schema.rb +24 -0
- data/spec/test_app/lib/know_more/questionnaire_controller_concerns.rb +21 -0
- data/spec/test_app/log/development.log +3813 -0
- data/spec/test_app/public/404.html +67 -0
- data/spec/test_app/public/422.html +67 -0
- data/spec/test_app/public/500.html +66 -0
- data/spec/test_app/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/test_app/public/apple-touch-icon.png +0 -0
- data/spec/test_app/public/favicon.ico +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/-M/-Mhn0x6IA3ei53dCjTNB4QapIeIWnhFjjvWlObqhWxY.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/-h/-hPQhUvmVonbzE86tGolE7GRuNFFf3NsKvt1mwHwIg0.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/0S/0SvZGDW10EU46QZko9M15Exl1RDa9Ud5osSt660CuzQ.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/24/24PpPX2bi_nuVnh3Bx8Nqj-UO3-1dbdgtFa6v7iPaLo.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/6P/6PoXC3inbHQs_iJ8sp-AEYUgrRllcZHE8stF6_FuI2s.cache +3 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/8M/8M6Y8ZU8aBj7dfklYKmqgzKWfv5nIDcx4jR-cMu9Hgc.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Ao/Ao0OdzieB2BHIS0J1OX5-CzoMHHagT-hWe_ospTLEz4.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Ca/Ca7J7u8QQVfncKxGfYDjkhl4ezOotD2PbJTwmY88R08.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/D7/D7JZQRMd7o6Oa3O8XYxxcWv4NGy5XUHEBQjbTtTIw0w.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Df/DfqHLjOcuVNA6fgR3rrM8D7q4VveBYvUn9OaxdDb2aI.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/E8/E869Vssa93t7BK-iyJUAbuMcVw65khT8ZkFTdkgPoNA.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Eu/EuUPUxyK1i0O9kRow6J2gQlEgannj8ele8bYrOH0WkE.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/F5/F5aTSXaWVMd07oSPX3KS5DuFnGw2SlYAYvIl2rt3xKU.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/F6/F69NGMZogprXR3htKJ6d0kVkFS9EgtSIrMd_Rv4lQo4.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/FW/FWd91hU2C6pptRvlqp8-fMKs0Pgd_JfiT3TPiYXBGoc.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/FW/FWlz-VvryvvUjDXSLRDM06krdCHZ6jb2HNM8n2lYvno.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Fh/FhoIJOA98Fe9tpfSEnFORkI01I9KVpmYAx_mXC4gQYo.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/G4/G4f_wqyGuSDH5PqO-cG6noP4D5EK3Kylzj3yOte-Z3E.cache +3 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Jj/Jj08SeolaHESqwfZBGZ0tcinAfB1oMbMugBODKZGtmk.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/KU/KUHCmze6iHkktV-xkd_pe8zKkrea7B0GA0AyNzPi8VI.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Ky/KyLnrp_TTwObMeq3b1zzPd9lvWbGgM05pRhE6K26DSw.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/LZ/LZodg9A2YVhhIboloe0zr_qCYE_SsB41W42B9a16AvQ.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/M6/M66hYfGZ7alPDFVsvZX20gGKa3hoXU4ZX57eWmf-8Q0.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Mb/MbA44Lqly0ejzpXgTsIIH7tnssjDcn_I4grw6t_PNFs.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Nh/Nhqfo87al4XtybNfUPjhR8idEE6eKcbsVOuQtiPqaz8.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/On/OnToO1iuSf982Y8PilnSN969yImwD-JWuEdGGU0r4SA.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Q7/Q7Dl2on4OdmHONyXUohOukBoSZQfxX7CBNaiLRxrn14.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/QC/QCkY9HlLiOM3vpgoGX8oJvozZ0Cq6p0b6WD2lcwZT5k.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/QD/QDMAHR127EpeGWrWbzn7QnNqnYZtH2UUV6ntkBhiUMQ.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Qr/QrbG3GcCwmKIApW0fC5o0iM8upyezEp0NrzhSENYwcs.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Qx/Qx8y8tq3IiNr7Ot7JGhxnFwDma3Bf6LfjWyVxcYpTzk.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/S2/S2XG29YYvgWCmY1ULahjx-TNWdzenEHf2EpX5LK_--w.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/SH/SHPuXI1rKYgLVra3KoGrRjevUg0nzNAxzNU_v_dPb6U.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Sa/Saez4IhtZGelgfIYfe8FAkCBAh9dUeKVGEmFBTITnmI.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Sx/Sx94HsfcuxHDyseiRaSVTRLw-adn2lGZ8TnytfXZhl8.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/W1/W1FyFe4zmJy2UId1DPKUFLtCO2T6Vq5RuBrUMwa5pXQ.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/WV/WVC-q51wcBaLCMfUdFscQNqh4o2O9YDD0irl3pEEHII.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/XL/XL3leJ5pQba8fRAqDA-mBiHbcBIBiHf9jeJ3xWfrlz8.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/Y2/Y2K6yjpdhJfMIKPU5YceGshr_gR1QQG8qmT6gRut14U.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/bD/bDD6X4R7ftAQlH7K_0T5HKcaToTfjQ6kSpZZRYBWQmk.cache +3 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/dA/dAosGjt-VaAhIfQVDjUoRM6eI9QUSh1E5X3gnrHu8Ww.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/dR/dRYE4MTApQWxIGfHaTh_uT0mmSKhlas_eGk6v3IjScA.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/eI/eIEIza6BGcz1akXfzNqRW2GEIb_B4zrgDemllbjKLqI.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/f3/f3IV7AH-agFherPIRg6gz-gH_q-pbMlmZYvwA-wgh28.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/hC/hCBrZ9RI110j1EhVdHOP-z9uOZwRm9UvutWo6eY1N_g.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/iT/iThi-stKgqJGA0IjU1RUrH30vN1eQNdVqLgVCK224mI.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/lx/lxV4gmPmZnPnnIMP-IREWrSMXIZM15bHONEqvOQe550.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/mS/mSro6DRbSWbZLjFnik8cEUvxGkkHnx30jmzgf90kWqw.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/n_/n_xYqQYhwEMQknb3jFQnjlxxBE9TzMNHCdJ-bEyZFIw.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/ne/neMAKY2HHX-jQtV34JCN-wAv1gZ4dBtdikwxulpNIU4.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/nx/nxTv3sKVUQZADJyM3dPaVmUA78MIsMLD_K279yN_GsI.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/oE/oELcpQtiEEZd7OlWIFZoxZmXO6i_0KQDJ9gSO8IMrAo.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/oJ/oJN9HcCgMMjADHFGldRpNYSVpaR5KCRFVjou3lEGP_o.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/qP/qPmv5snMrDw830S6hSICDcnIy7kVEWoFKXhGKT38lG4.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/rD/rDC4aip_9aDeTYE-ixXTrw4TblEowO3UGk8BhYb0UXQ.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/rG/rG5N7yI8mYTZmoFfvUWEF8AwRkSz7iwzbzjZgtyD-6Y.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/rz/rzYbqBDzAezz5y7RBSX5kN3TmuBZYZzvh4AXBe6I1OQ.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/uX/uXdmeUJXaGu-MF3ntZ6-oMn3I-G9Ub6r2UZzqMnqIyU.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/uc/uc9nNzmH9YYkXWiQWt8sLWG3L6bnPakFQd3qAj7GI8Q.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/wa/waRa6Y4GPI3rPY6lN66-DRb7GRW_AQcee1TP2qFEZzI.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/x-/x-CSdYi9brwT6G4vAolSeuvGSaszo1oumOyPyfno7Zk.cache +0 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/x7/x7PYh8DJvPykcEqpVab2vcY9-GFz-3cqtoMlRAu94Uc.cache +2 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/xB/xBNFQ5zX18WjcjNby1R4X3UlLjHy1vAKBCFGDpHMpQE.cache +1 -0
- data/spec/test_app/tmp/cache/assets/sprockets/v3.0/xp/xpdRk6Yq3nW29DONCODCnLPuF9MWzGSavMHHQSUshjQ.cache +1 -0
- metadata +408 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
%h1
|
2
|
+
Step 1
|
3
|
+
= form_for @questionnaire, url: questionnaire_step1_path do |f|
|
4
|
+
= hidden_field_tag :direction, 'next'
|
5
|
+
|
6
|
+
= f.text_field :attribute1
|
7
|
+
|
8
|
+
= link_to :next, "javascript:void(0)", id: 'knowmore-next', method: :post
|
9
|
+
|
10
|
+
|
11
|
+
:javascript
|
12
|
+
var $directionInput = $('input#direction'),
|
13
|
+
$previousLink = $('a#knowmore-previous'),
|
14
|
+
$nextLink = $('a#knowmore-next');
|
15
|
+
|
16
|
+
if($previousLink != null){
|
17
|
+
$previousLink.on('click', function(e){
|
18
|
+
e.preventDefault();
|
19
|
+
$directionInput.val('previous');
|
20
|
+
$('form').submit();
|
21
|
+
});
|
22
|
+
}
|
23
|
+
if($nextLink != null){
|
24
|
+
$nextLink.on('click', function(e){
|
25
|
+
e.preventDefault();
|
26
|
+
$directionInput.val('next');
|
27
|
+
$('form').submit();
|
28
|
+
});
|
29
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
%h1
|
2
|
+
Step 2
|
3
|
+
= form_for @questionnaire, url: questionnaire_step2_path do |f|
|
4
|
+
= hidden_field_tag :direction, 'next'
|
5
|
+
|
6
|
+
= f.text_field :attribute2
|
7
|
+
= link_to :previous, "javascript:void(0)", id: 'knowmore-previous', method: :post
|
8
|
+
|
9
|
+
|
10
|
+
= link_to :next, "javascript:void(0)", id: 'knowmore-next', method: :post
|
11
|
+
|
12
|
+
|
13
|
+
:javascript
|
14
|
+
var $directionInput = $('input#direction'),
|
15
|
+
$previousLink = $('a#knowmore-previous'),
|
16
|
+
$nextLink = $('a#knowmore-next');
|
17
|
+
|
18
|
+
if($previousLink != null){
|
19
|
+
$previousLink.on('click', function(e){
|
20
|
+
e.preventDefault();
|
21
|
+
$directionInput.val('previous');
|
22
|
+
$('form').submit();
|
23
|
+
});
|
24
|
+
}
|
25
|
+
if($nextLink != null){
|
26
|
+
$nextLink.on('click', function(e){
|
27
|
+
e.preventDefault();
|
28
|
+
$directionInput.val('next');
|
29
|
+
$('form').submit();
|
30
|
+
});
|
31
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
%h1
|
2
|
+
Step 3
|
3
|
+
= form_for @questionnaire, url: questionnaire_step3_path do |f|
|
4
|
+
= hidden_field_tag :direction, 'next'
|
5
|
+
|
6
|
+
= f.text_field :attribute3
|
7
|
+
= link_to :previous, "javascript:void(0)", id: 'knowmore-previous', method: :post
|
8
|
+
|
9
|
+
|
10
|
+
= link_to :done, "javascript:void(0)", id: 'knowmore-next', method: :post
|
11
|
+
|
12
|
+
:javascript
|
13
|
+
var $directionInput = $('input#direction'),
|
14
|
+
$previousLink = $('a#knowmore-previous'),
|
15
|
+
$nextLink = $('a#knowmore-next');
|
16
|
+
|
17
|
+
if($previousLink != null){
|
18
|
+
$previousLink.on('click', function(e){
|
19
|
+
e.preventDefault();
|
20
|
+
$directionInput.val('previous');
|
21
|
+
$('form').submit();
|
22
|
+
});
|
23
|
+
}
|
24
|
+
if($nextLink != null){
|
25
|
+
$nextLink.on('click', function(e){
|
26
|
+
e.preventDefault();
|
27
|
+
$directionInput.val('next');
|
28
|
+
$('form').submit();
|
29
|
+
});
|
30
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>TestApp</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
|
7
|
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
8
|
+
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
9
|
+
</head>
|
10
|
+
|
11
|
+
<body>
|
12
|
+
<%= yield %>
|
13
|
+
</body>
|
14
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Hello</h1>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a starting point to setup your application.
|
15
|
+
# Add necessary setup steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
# puts "\n== Copying sample files =="
|
22
|
+
# unless File.exist?('config/database.yml')
|
23
|
+
# cp 'config/database.yml.sample', 'config/database.yml'
|
24
|
+
# end
|
25
|
+
|
26
|
+
puts "\n== Preparing database =="
|
27
|
+
system! 'bin/rails db:setup'
|
28
|
+
|
29
|
+
puts "\n== Removing old logs and tempfiles =="
|
30
|
+
system! 'bin/rails log:clear tmp:clear'
|
31
|
+
|
32
|
+
puts "\n== Restarting application server =="
|
33
|
+
system! 'bin/rails restart'
|
34
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
require 'fileutils'
|
4
|
+
include FileUtils
|
5
|
+
|
6
|
+
# path to your application root.
|
7
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
8
|
+
|
9
|
+
def system!(*args)
|
10
|
+
system(*args) || abort("\n== Command #{args} failed ==")
|
11
|
+
end
|
12
|
+
|
13
|
+
chdir APP_ROOT do
|
14
|
+
# This script is a way to update your development environment automatically.
|
15
|
+
# Add necessary update steps to this file.
|
16
|
+
|
17
|
+
puts '== Installing dependencies =='
|
18
|
+
system! 'gem install bundler --conservative'
|
19
|
+
system('bundle check') || system!('bundle install')
|
20
|
+
|
21
|
+
puts "\n== Updating database =="
|
22
|
+
system! 'bin/rails db:migrate'
|
23
|
+
|
24
|
+
puts "\n== Removing old logs and tempfiles =="
|
25
|
+
system! 'bin/rails log:clear tmp:clear'
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system! 'bin/rails restart'
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'boot'
|
2
|
+
|
3
|
+
# Pick the frameworks you want:
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
require "active_job/railtie"
|
9
|
+
require "action_cable/engine"
|
10
|
+
# require "rails/test_unit/railtie"
|
11
|
+
require "sprockets/railtie"
|
12
|
+
|
13
|
+
Bundler.require(*Rails.groups)
|
14
|
+
require "know_more"
|
15
|
+
|
16
|
+
module TestApp
|
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
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,54 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports.
|
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
|
28
|
+
|
29
|
+
# Don't care if the mailer can't send.
|
30
|
+
config.action_mailer.raise_delivery_errors = false
|
31
|
+
|
32
|
+
config.action_mailer.perform_caching = false
|
33
|
+
|
34
|
+
# Print deprecation notices to the Rails logger.
|
35
|
+
config.active_support.deprecation = :log
|
36
|
+
|
37
|
+
# Raise an error on page load if there are pending migrations.
|
38
|
+
config.active_record.migration_error = :page_load
|
39
|
+
|
40
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
41
|
+
# This option may cause significant delays in view rendering with a large
|
42
|
+
# number of complex assets.
|
43
|
+
config.assets.debug = true
|
44
|
+
|
45
|
+
# Suppress logger output for asset requests.
|
46
|
+
config.assets.quiet = true
|
47
|
+
|
48
|
+
# Raises error for missing translations
|
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
|
54
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Disable serving static files from the `/public` folder by default since
|
18
|
+
# Apache or NGINX already handles this.
|
19
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
20
|
+
|
21
|
+
# Compress JavaScripts and CSS.
|
22
|
+
config.assets.js_compressor = :uglifier
|
23
|
+
# config.assets.css_compressor = :sass
|
24
|
+
|
25
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
26
|
+
config.assets.compile = false
|
27
|
+
|
28
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
29
|
+
|
30
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
31
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
32
|
+
|
33
|
+
# Specifies the header that your server uses for sending files.
|
34
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
35
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
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
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Use the lowest log level to ensure availability of diagnostic information
|
46
|
+
# when problems arise.
|
47
|
+
config.log_level = :debug
|
48
|
+
|
49
|
+
# Prepend all log lines with the following tags.
|
50
|
+
config.log_tags = [ :request_id ]
|
51
|
+
|
52
|
+
# Use a different cache store in production.
|
53
|
+
# config.cache_store = :mem_cache_store
|
54
|
+
|
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 = "test_app_#{Rails.env}"
|
58
|
+
config.action_mailer.perform_caching = false
|
59
|
+
|
60
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
61
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
62
|
+
# config.action_mailer.raise_delivery_errors = false
|
63
|
+
|
64
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
65
|
+
# the I18n.default_locale when a translation cannot be found).
|
66
|
+
config.i18n.fallbacks = true
|
67
|
+
|
68
|
+
# Send deprecation notices to registered listeners.
|
69
|
+
config.active_support.deprecation = :notify
|
70
|
+
|
71
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
72
|
+
config.log_formatter = ::Logger::Formatter.new
|
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
|
+
|
84
|
+
# Do not dump schema after migrations.
|
85
|
+
config.active_record.dump_schema_after_migration = false
|
86
|
+
end
|