cookbook 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.rspec +1 -0
  4. data/.rubocop.yml +10 -0
  5. data/Gemfile +39 -0
  6. data/Gemfile.lock +367 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +105 -0
  9. data/Rakefile +52 -0
  10. data/VERSION +1 -0
  11. data/app/assets/stylesheets/cookbook/application.scss +180 -0
  12. data/app/controllers/concerns/cookbook/params.rb +27 -0
  13. data/app/helpers/cookbook/application_helper.rb +38 -0
  14. data/app/models/cookbook/use.rb +26 -0
  15. data/app/views/cookbook/_fields.html.haml +11 -0
  16. data/app/views/cookbook/_used_in.html.haml +15 -0
  17. data/app/views/cookbook/_uses_of.html.haml +11 -0
  18. data/app/views/cookbook/uses/_fields.html.haml +17 -0
  19. data/bin/rails +16 -0
  20. data/config/initializers/simple_form.rb +180 -0
  21. data/config/locales/simple_form.en.yml +31 -0
  22. data/cookbook.gemspec +249 -0
  23. data/db/migrate/20210909141929_create_uses.cookbook.rb +21 -0
  24. data/lib/cookbook/configuration.rb +28 -0
  25. data/lib/cookbook/engine.rb +34 -0
  26. data/lib/cookbook/extensions/float.rb +10 -0
  27. data/lib/cookbook/mixins/acts_as_use_of.rb +45 -0
  28. data/lib/cookbook/mixins/acts_as_used_in.rb +43 -0
  29. data/lib/cookbook/railtie.rb +6 -0
  30. data/lib/cookbook/version.rb +9 -0
  31. data/lib/cookbook.rb +27 -0
  32. data/lib/tasks/cookbook_tasks.rake +5 -0
  33. data/lib/templates/haml/scaffold/_form.html.haml +12 -0
  34. data/spec/cookbook_spec.rb +9 -0
  35. data/spec/dummy/Rakefile +8 -0
  36. data/spec/dummy/app/assets/config/manifest.js +2 -0
  37. data/spec/dummy/app/assets/images/.keep +0 -0
  38. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  39. data/spec/dummy/app/assets/stylesheets/scaffolds.scss +65 -0
  40. data/spec/dummy/app/channels/application_cable/channel.rb +6 -0
  41. data/spec/dummy/app/channels/application_cable/connection.rb +6 -0
  42. data/spec/dummy/app/controllers/application_controller.rb +4 -0
  43. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  44. data/spec/dummy/app/controllers/how_tos_controller.rb +61 -0
  45. data/spec/dummy/app/controllers/ingredients_controller.rb +60 -0
  46. data/spec/dummy/app/controllers/recipes_controller.rb +61 -0
  47. data/spec/dummy/app/controllers/supplies_controller.rb +60 -0
  48. data/spec/dummy/app/controllers/tools_controller.rb +60 -0
  49. data/spec/dummy/app/javascript/packs/application.js +16 -0
  50. data/spec/dummy/app/jobs/application_job.rb +9 -0
  51. data/spec/dummy/app/mailers/application_mailer.rb +6 -0
  52. data/spec/dummy/app/models/ability.rb +21 -0
  53. data/spec/dummy/app/models/application_record.rb +7 -0
  54. data/spec/dummy/app/models/concerns/.keep +0 -0
  55. data/spec/dummy/app/models/how_to.rb +5 -0
  56. data/spec/dummy/app/models/ingredient.rb +5 -0
  57. data/spec/dummy/app/models/recipe.rb +5 -0
  58. data/spec/dummy/app/models/supply.rb +5 -0
  59. data/spec/dummy/app/models/tool.rb +5 -0
  60. data/spec/dummy/app/models/user.rb +8 -0
  61. data/spec/dummy/app/views/how_tos/_form.html.haml +7 -0
  62. data/spec/dummy/app/views/how_tos/edit.html.haml +7 -0
  63. data/spec/dummy/app/views/how_tos/index.html.haml +25 -0
  64. data/spec/dummy/app/views/how_tos/new.html.haml +5 -0
  65. data/spec/dummy/app/views/how_tos/show.html.haml +17 -0
  66. data/spec/dummy/app/views/ingredients/_form.html.haml +8 -0
  67. data/spec/dummy/app/views/ingredients/edit.html.haml +7 -0
  68. data/spec/dummy/app/views/ingredients/index.html.haml +29 -0
  69. data/spec/dummy/app/views/ingredients/new.html.haml +5 -0
  70. data/spec/dummy/app/views/ingredients/show.html.haml +23 -0
  71. data/spec/dummy/app/views/layouts/application.html.erb +15 -0
  72. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  73. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  74. data/spec/dummy/app/views/recipes/_form.html.haml +9 -0
  75. data/spec/dummy/app/views/recipes/edit.html.haml +7 -0
  76. data/spec/dummy/app/views/recipes/index.html.haml +29 -0
  77. data/spec/dummy/app/views/recipes/new.html.haml +5 -0
  78. data/spec/dummy/app/views/recipes/show.html.haml +23 -0
  79. data/spec/dummy/app/views/supplies/_form.html.haml +6 -0
  80. data/spec/dummy/app/views/supplies/edit.html.haml +7 -0
  81. data/spec/dummy/app/views/supplies/index.html.haml +25 -0
  82. data/spec/dummy/app/views/supplies/new.html.haml +5 -0
  83. data/spec/dummy/app/views/supplies/show.html.haml +17 -0
  84. data/spec/dummy/app/views/tools/_form.html.haml +6 -0
  85. data/spec/dummy/app/views/tools/edit.html.haml +7 -0
  86. data/spec/dummy/app/views/tools/index.html.haml +25 -0
  87. data/spec/dummy/app/views/tools/new.html.haml +5 -0
  88. data/spec/dummy/app/views/tools/show.html.haml +17 -0
  89. data/spec/dummy/bin/rails +6 -0
  90. data/spec/dummy/bin/rake +6 -0
  91. data/spec/dummy/bin/setup +35 -0
  92. data/spec/dummy/config/application.rb +28 -0
  93. data/spec/dummy/config/boot.rb +7 -0
  94. data/spec/dummy/config/cable.yml +10 -0
  95. data/spec/dummy/config/database.yml +25 -0
  96. data/spec/dummy/config/environment.rb +7 -0
  97. data/spec/dummy/config/environments/development.rb +80 -0
  98. data/spec/dummy/config/environments/production.rb +122 -0
  99. data/spec/dummy/config/environments/test.rb +61 -0
  100. data/spec/dummy/config/initializers/application_controller_renderer.rb +9 -0
  101. data/spec/dummy/config/initializers/assets.rb +14 -0
  102. data/spec/dummy/config/initializers/backtrace_silencers.rb +10 -0
  103. data/spec/dummy/config/initializers/content_security_policy.rb +29 -0
  104. data/spec/dummy/config/initializers/cookbook.rb +6 -0
  105. data/spec/dummy/config/initializers/cookies_serializer.rb +7 -0
  106. data/spec/dummy/config/initializers/devise.rb +313 -0
  107. data/spec/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  108. data/spec/dummy/config/initializers/inflections.rb +17 -0
  109. data/spec/dummy/config/initializers/json.rb +20 -0
  110. data/spec/dummy/config/initializers/mime_types.rb +5 -0
  111. data/spec/dummy/config/initializers/permissions_policy.rb +12 -0
  112. data/spec/dummy/config/initializers/wrap_parameters.rb +16 -0
  113. data/spec/dummy/config/locales/devise.en.yml +65 -0
  114. data/spec/dummy/config/locales/en.yml +33 -0
  115. data/spec/dummy/config/puma.rb +45 -0
  116. data/spec/dummy/config/routes.rb +13 -0
  117. data/spec/dummy/config/storage.yml +34 -0
  118. data/spec/dummy/config.ru +8 -0
  119. data/spec/dummy/db/development.sqlite3 +0 -0
  120. data/spec/dummy/db/migrate/20210909175711_create_how_tos.rb +16 -0
  121. data/spec/dummy/db/migrate/20210909181442_create_ingredients.rb +16 -0
  122. data/spec/dummy/db/migrate/20210909181455_create_supplies.rb +14 -0
  123. data/spec/dummy/db/migrate/20210909181516_create_tools.rb +14 -0
  124. data/spec/dummy/db/migrate/20210909181533_create_recipes.rb +16 -0
  125. data/spec/dummy/db/migrate/20210909185303_create_uses.cookbook.rb +23 -0
  126. data/spec/dummy/db/migrate/20210910142322_create_users.rb +11 -0
  127. data/spec/dummy/db/migrate/20210910142323_add_devise_to_users.rb +50 -0
  128. data/spec/dummy/db/schema.rb +92 -0
  129. data/spec/dummy/db/seeds.rb +10 -0
  130. data/spec/dummy/db/test.sqlite3 +0 -0
  131. data/spec/dummy/lib/assets/.keep +0 -0
  132. data/spec/dummy/lib/templates/haml/scaffold/_form.html.haml +6 -0
  133. data/spec/dummy/log/.keep +0 -0
  134. data/spec/dummy/log/development.log +6643 -0
  135. data/spec/dummy/log/test.log +25990 -0
  136. data/spec/dummy/public/404.html +67 -0
  137. data/spec/dummy/public/422.html +67 -0
  138. data/spec/dummy/public/500.html +66 -0
  139. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  140. data/spec/dummy/public/apple-touch-icon.png +0 -0
  141. data/spec/dummy/public/favicon.ico +0 -0
  142. data/spec/dummy/storage/.keep +0 -0
  143. data/spec/factories/how_tos.rb +9 -0
  144. data/spec/factories/ingredients.rb +11 -0
  145. data/spec/factories/recipes.rb +11 -0
  146. data/spec/factories/supplies.rb +9 -0
  147. data/spec/factories/tools.rb +9 -0
  148. data/spec/factories/users.rb +9 -0
  149. data/spec/factories/uses.rb +24 -0
  150. data/spec/helpers/cookbook/application_helper_spec.rb +47 -0
  151. data/spec/models/cookbook/use_spec.rb +82 -0
  152. data/spec/models/how_to_spec.rb +18 -0
  153. data/spec/models/ingredient_spec.rb +15 -0
  154. data/spec/models/recipe_spec.rb +18 -0
  155. data/spec/models/supply_spec.rb +15 -0
  156. data/spec/models/tool_spec.rb +15 -0
  157. data/spec/rails_helper.rb +92 -0
  158. data/spec/requests/how_tos_spec.rb +114 -0
  159. data/spec/requests/recipes_spec.rb +116 -0
  160. data/spec/spec_helper.rb +44 -0
  161. metadata +517 -0
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative 'application'
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # In the development environment your application's code is reloaded any time
9
+ # it changes. This slows down response time but is perfect for development
10
+ # since you don't have to restart the web server when you make code changes.
11
+ config.cache_classes = false
12
+
13
+ # Do not eager load code on boot.
14
+ config.eager_load = false
15
+
16
+ # Show full error reports.
17
+ config.consider_all_requests_local = true
18
+
19
+ # Enable/disable caching. By default caching is disabled.
20
+ # Run rails dev:cache to toggle caching.
21
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
22
+ config.action_controller.perform_caching = true
23
+ config.action_controller.enable_fragment_cache_logging = true
24
+
25
+ config.cache_store = :memory_store
26
+ config.public_file_server.headers = {
27
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
28
+ }
29
+ else
30
+ config.action_controller.perform_caching = false
31
+
32
+ config.cache_store = :null_store
33
+ end
34
+
35
+ # Store uploaded files on the local file system (see config/storage.yml for options).
36
+ config.active_storage.service = :local
37
+
38
+ # Don't care if the mailer can't send.
39
+ config.action_mailer.raise_delivery_errors = false
40
+
41
+ config.action_mailer.perform_caching = false
42
+
43
+ config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
44
+
45
+ # Print deprecation notices to the Rails logger.
46
+ config.active_support.deprecation = :log
47
+
48
+ # Raise exceptions for disallowed deprecations.
49
+ config.active_support.disallowed_deprecation = :raise
50
+
51
+ # Tell Active Support which deprecation messages to disallow.
52
+ config.active_support.disallowed_deprecation_warnings = []
53
+
54
+ # Raise an error on page load if there are pending migrations.
55
+ config.active_record.migration_error = :page_load
56
+
57
+ # Highlight code that triggered database queries in logs.
58
+ config.active_record.verbose_query_logs = true
59
+
60
+ # Debug mode disables concatenation and preprocessing of assets.
61
+ # This option may cause significant delays in view rendering with a large
62
+ # number of complex assets.
63
+ config.assets.debug = true
64
+
65
+ # Suppress logger output for asset requests.
66
+ config.assets.quiet = true
67
+
68
+ # Raises error for missing translations.
69
+ # config.i18n.raise_on_missing_translations = true
70
+
71
+ # Annotate rendered view with file names.
72
+ # config.action_view.annotate_rendered_view_with_filenames = true
73
+
74
+ # Use an evented file watcher to asynchronously detect changes in source code,
75
+ # routes, locales, etc. This feature depends on the listen gem.
76
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
77
+
78
+ # Uncomment if you wish to allow Action Cable access from any origin.
79
+ # config.action_cable.disable_request_forgery_protection = true
80
+ end
@@ -0,0 +1,122 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ Rails.application.configure do
6
+ # Settings specified here will take precedence over those in config/application.rb.
7
+
8
+ # Code is not reloaded between requests.
9
+ config.cache_classes = true
10
+
11
+ # Eager load code on boot. This eager loads most of Rails and
12
+ # your application in memory, allowing both threaded web servers
13
+ # and those relying on copy on write to perform better.
14
+ # Rake tasks automatically ignore this option for performance.
15
+ config.eager_load = true
16
+
17
+ # Full error reports are disabled and caching is turned on.
18
+ config.consider_all_requests_local = false
19
+ config.action_controller.perform_caching = true
20
+
21
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
22
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
23
+ # config.require_master_key = true
24
+
25
+ # Disable serving static files from the `/public` folder by default since
26
+ # Apache or NGINX already handles this.
27
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
28
+
29
+ # Compress CSS using a preprocessor.
30
+ # config.assets.css_compressor = :sass
31
+
32
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
33
+ config.assets.compile = false
34
+
35
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
36
+ # config.asset_host = 'http://assets.example.com'
37
+
38
+ # Specifies the header that your server cookbook for sending files.
39
+ # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
40
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
41
+
42
+ # Store uploaded files on the local file system (see config/storage.yml for options).
43
+ config.active_storage.service = :local
44
+
45
+ # Mount Action Cable outside main process or domain.
46
+ # config.action_cable.mount_path = nil
47
+ # config.action_cable.url = 'wss://example.com/cable'
48
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
49
+
50
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
51
+ # config.force_ssl = true
52
+
53
+ # Include generic and useful information about system operation, but avoid logging too much
54
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
55
+ config.log_level = :info
56
+
57
+ # Prepend all log lines with the following tags.
58
+ config.log_tags = [:request_id]
59
+
60
+ # Use a different cache store in production.
61
+ # config.cache_store = :mem_cache_store
62
+
63
+ # Use a real queuing backend for Active Job (and separate queues per environment).
64
+ # config.active_job.queue_adapter = :resque
65
+ # config.active_job.queue_name_prefix = "dummy_production"
66
+
67
+ config.action_mailer.perform_caching = false
68
+
69
+ # Ignore bad email addresses and do not raise email delivery errors.
70
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
71
+ # config.action_mailer.raise_delivery_errors = false
72
+
73
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
74
+ # the I18n.default_locale when a translation cannot be found).
75
+ config.i18n.fallbacks = true
76
+
77
+ # Send deprecation notices to registered listeners.
78
+ config.active_support.deprecation = :notify
79
+
80
+ # Log disallowed deprecations.
81
+ config.active_support.disallowed_deprecation = :log
82
+
83
+ # Tell Active Support which deprecation messages to disallow.
84
+ config.active_support.disallowed_deprecation_warnings = []
85
+
86
+ # Use default logging formatter so that PID and timestamp are not suppressed.
87
+ config.log_formatter = ::Logger::Formatter.new
88
+
89
+ # Use a different logger for distributed setups.
90
+ # require "syslog/logger"
91
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
92
+
93
+ if ENV['RAILS_LOG_TO_STDOUT'].present?
94
+ logger = ActiveSupport::Logger.new($stdout)
95
+ logger.formatter = config.log_formatter
96
+ config.logger = ActiveSupport::TaggedLogging.new(logger)
97
+ end
98
+
99
+ # Do not dump schema after migrations.
100
+ config.active_record.dump_schema_after_migration = false
101
+
102
+ # Inserts middleware to perform automatic connection switching.
103
+ # The `database_selector` hash is used to pass options to the DatabaseSelector
104
+ # middleware. The `delay` is used to determine how long to wait after a write
105
+ # to send a subsequent read to the primary.
106
+ #
107
+ # The `database_resolver` class is used by the middleware to determine which
108
+ # database is appropriate to use based on the time delay.
109
+ #
110
+ # The `database_resolver_context` class is used by the middleware to set
111
+ # timestamps for the last write to the primary. The resolver cookbook the context
112
+ # class timestamps to determine how long to wait before reading from the
113
+ # replica.
114
+ #
115
+ # By default Rails will store a last write timestamp in the session. The
116
+ # DatabaseSelector middleware is designed as such you can define your own
117
+ # strategy for connection switching and pass that into the middleware through
118
+ # these configuration options.
119
+ # config.active_record.database_selector = { delay: 2.seconds }
120
+ # config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
121
+ # config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
122
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/integer/time'
4
+
5
+ # The test environment is used exclusively to run your application's
6
+ # test suite. You never need to work with it otherwise. Remember that
7
+ # your test database is "scratch space" for the test suite and is wiped
8
+ # and recreated between test runs. Don't rely on the data there!
9
+
10
+ Rails.application.configure do
11
+ # Settings specified here will take precedence over those in config/application.rb.
12
+
13
+ config.cache_classes = true
14
+
15
+ # Do not eager load code on boot. This avoids loading your whole application
16
+ # just for the purpose of running a single test. If you are using a tool that
17
+ # preloads Rails for running tests, you may have to set it to true.
18
+ config.eager_load = false
19
+
20
+ # Configure public file server for tests with Cache-Control for performance.
21
+ config.public_file_server.enabled = true
22
+ config.public_file_server.headers = {
23
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
24
+ }
25
+
26
+ # Show full error reports and disable caching.
27
+ config.consider_all_requests_local = true
28
+ config.action_controller.perform_caching = false
29
+ config.cache_store = :null_store
30
+
31
+ # Raise exceptions instead of rendering exception templates.
32
+ config.action_dispatch.show_exceptions = false
33
+
34
+ # Disable request forgery protection in test environment.
35
+ config.action_controller.allow_forgery_protection = false
36
+
37
+ # Store uploaded files on the local file system in a temporary directory.
38
+ config.active_storage.service = :test
39
+
40
+ config.action_mailer.perform_caching = false
41
+
42
+ # Tell Action Mailer not to deliver emails to the real world.
43
+ # The :test delivery method accumulates sent emails in the
44
+ # ActionMailer::Base.deliveries array.
45
+ config.action_mailer.delivery_method = :test
46
+
47
+ # Print deprecation notices to the stderr.
48
+ config.active_support.deprecation = :stderr
49
+
50
+ # Raise exceptions for disallowed deprecations.
51
+ config.active_support.disallowed_deprecation = :raise
52
+
53
+ # Tell Active Support which deprecation messages to disallow.
54
+ config.active_support.disallowed_deprecation_warnings = []
55
+
56
+ # Raises error for missing translations.
57
+ # config.i18n.raise_on_missing_translations = true
58
+
59
+ # Annotate rendered view with file names.
60
+ # config.action_view.annotate_rendered_view_with_filenames = true
61
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # ActiveSupport::Reloader.to_prepare do
5
+ # ApplicationController.renderer.defaults.merge!(
6
+ # http_host: 'example.org',
7
+ # https: false
8
+ # )
9
+ # end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Version of your assets, change this if you want to expire all your assets.
6
+ Rails.application.config.assets.version = '1.0'
7
+
8
+ # Add additional assets to the asset load path.
9
+ # Rails.application.config.assets.paths << Emoji.images_path
10
+
11
+ # Precompile additional assets.
12
+ # application.js, application.css, and all non-JS/CSS in the app/assets
13
+ # folder are already added.
14
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
6
+ # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
7
+
8
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
9
+ # by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
10
+ Rails.backtrace_cleaner.remove_silencers! if ENV['BACKTRACE']
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+ # Be sure to restart your server when you modify this file.
3
+
4
+ # Define an application-wide content security policy
5
+ # For further information see the following documentation
6
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
7
+
8
+ # Rails.application.config.content_security_policy do |policy|
9
+ # policy.default_src :self, :https
10
+ # policy.font_src :self, :https, :data
11
+ # policy.img_src :self, :https, :data
12
+ # policy.object_src :none
13
+ # policy.script_src :self, :https
14
+ # policy.style_src :self, :https
15
+
16
+ # # Specify URI for violation reports
17
+ # # policy.report_uri "/csp-violation-report-endpoint"
18
+ # end
19
+
20
+ # If you are using UJS then enable automatic nonce generation
21
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
22
+
23
+ # Set the nonce only to specific directives
24
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
25
+
26
+ # Report CSP violations to a specified URI
27
+ # For further information see the following documentation:
28
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
29
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ Cookbook.configure do |config|
4
+ config.include_cookbook_css = true
5
+ config.authorize_with = :cancancan
6
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Be sure to restart your server when you modify this file.
4
+
5
+ # Specify a serializer for the signed and encrypted cookie jars.
6
+ # Valid options are :json, :marshal, and :hybrid.
7
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,313 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Assuming you have not yet modified this file, each configuration option below
4
+ # is set to its default value. Note that some are commented out while others
5
+ # are not: uncommented lines are intended to protect your configuration from
6
+ # breaking changes in upgrades (i.e., in the event that future versions of
7
+ # Devise change the default values for those options).
8
+ #
9
+ # Use this hook to configure devise mailer, warden hooks and so forth.
10
+ # Many of these configuration options can be set straight in your model.
11
+ Devise.setup do |config|
12
+ # The secret key used by Devise. Devise cookbook this key to generate
13
+ # random tokens. Changing this key will render invalid all existing
14
+ # confirmation, reset password and unlock tokens in the database.
15
+ # Devise will use the `secret_key_base` as its `secret_key`
16
+ # by default. You can change it below and use your own secret key.
17
+ # config.secret_key = '41fc583e58752aa998ca55f8076cc514c9c83e89c44183e48'\
18
+ # '209534982c229d6ed6670cab55d4991f3349d6516e4073b010b9fa62d111aa243ce80091b2b1913'
19
+
20
+ # ==> Controller configuration
21
+ # Configure the parent class to the devise controllers.
22
+ # config.parent_controller = 'DeviseController'
23
+
24
+ # ==> Mailer Configuration
25
+ # Configure the e-mail address which will be shown in Devise::Mailer,
26
+ # note that it will be overwritten if you use your own mailer class
27
+ # with default "from" parameter.
28
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
29
+
30
+ # Configure the class responsible to send e-mails.
31
+ # config.mailer = 'Devise::Mailer'
32
+
33
+ # Configure the parent class responsible to send e-mails.
34
+ # config.parent_mailer = 'ActionMailer::Base'
35
+
36
+ # ==> ORM configuration
37
+ # Load and configure the ORM. Supports :active_record (default) and
38
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
39
+ # available as additional gems.
40
+ require 'devise/orm/active_record'
41
+
42
+ # ==> Configuration for any authentication mechanism
43
+ # Configure which keys are used when authenticating a user. The default is
44
+ # just :email. You can configure it to use [:username, :subdomain], so for
45
+ # authenticating a user, both parameters are required. Remember that those
46
+ # parameters are used only when authenticating and not when retrieving from
47
+ # session. If you need permissions, you should implement that in a before filter.
48
+ # You can also supply a hash where the value is a boolean determining whether
49
+ # or not authentication should be aborted when the value is not present.
50
+ # config.authentication_keys = [:email]
51
+
52
+ # Configure parameters from the request object used for authentication. Each entry
53
+ # given should be a request method and it will automatically be passed to the
54
+ # find_for_authentication method and considered in your model lookup. For instance,
55
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
56
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
57
+ # config.request_keys = []
58
+
59
+ # Configure which authentication keys should be case-insensitive.
60
+ # These keys will be downcased upon creating or modifying a user and when used
61
+ # to authenticate or find a user. Default is :email.
62
+ config.case_insensitive_keys = [:email]
63
+
64
+ # Configure which authentication keys should have whitespace stripped.
65
+ # These keys will have whitespace before and after removed upon creating or
66
+ # modifying a user and when used to authenticate or find a user. Default is :email.
67
+ config.strip_whitespace_keys = [:email]
68
+
69
+ # Tell if authentication through request.params is enabled. True by default.
70
+ # It can be set to an array that will enable params authentication only for the
71
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
72
+ # enable it only for database (email + password) authentication.
73
+ # config.params_authenticatable = true
74
+
75
+ # Tell if authentication through HTTP Auth is enabled. False by default.
76
+ # It can be set to an array that will enable http authentication only for the
77
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
78
+ # enable it only for database authentication.
79
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
80
+ # enable this with :database unless you are using a custom strategy.
81
+ # The supported strategies are:
82
+ # :database = Support basic authentication with authentication key + password
83
+ # config.http_authenticatable = false
84
+
85
+ # If 401 status code should be returned for AJAX requests. True by default.
86
+ # config.http_authenticatable_on_xhr = true
87
+
88
+ # The realm used in Http Basic Authentication. 'Application' by default.
89
+ # config.http_authentication_realm = 'Application'
90
+
91
+ # It will change confirmation, password recovery and other workflows
92
+ # to behave the same regardless if the e-mail provided was right or wrong.
93
+ # Does not affect registerable.
94
+ # config.paranoid = true
95
+
96
+ # By default Devise will store the user in session. You can skip storage for
97
+ # particular strategies by setting this option.
98
+ # Notice that if you are skipping storage for all authentication paths, you
99
+ # may want to disable generating routes to Devise's sessions controller by
100
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
101
+ config.skip_session_storage = [:http_auth]
102
+
103
+ # By default, Devise cleans up the CSRF token on authentication to
104
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
105
+ # requests for sign in and sign up, you need to get a new CSRF token
106
+ # from the server. You can disable this option at your own risk.
107
+ # config.clean_up_csrf_token_on_authentication = true
108
+
109
+ # When false, Devise will not attempt to reload routes on eager load.
110
+ # This can reduce the time taken to boot the app but if your application
111
+ # requires the Devise mappings to be loaded during boot time the application
112
+ # won't boot properly.
113
+ # config.reload_routes = true
114
+
115
+ # ==> Configuration for :database_authenticatable
116
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
117
+ # using other algorithms, it sets how many times you want the password to be hashed.
118
+ # The number of stretches used for generating the hashed password are stored
119
+ # with the hashed password. This allows you to change the stretches without
120
+ # invalidating existing passwords.
121
+ #
122
+ # Limiting the stretches to just one in testing will increase the performance of
123
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
124
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
125
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
126
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
127
+ config.stretches = Rails.env.test? ? 1 : 12
128
+
129
+ # Set up a pepper to generate the hashed password.
130
+ # config.pepper = 'e6b63d7345edb1699b45e47ad0eab24928685ce9cd094a98b9461ae76bf2'\
131
+ # '990179a8e5c5d005dffcc98f276b58f12d9754aec35bb44e6715e6bac7cef5b61fdd'
132
+
133
+ # Send a notification to the original email when the user's email is changed.
134
+ # config.send_email_changed_notification = false
135
+
136
+ # Send a notification email when the user's password is changed.
137
+ # config.send_password_change_notification = false
138
+
139
+ # ==> Configuration for :confirmable
140
+ # A period that the user is allowed to access the website even without
141
+ # confirming their account. For instance, if set to 2.days, the user will be
142
+ # able to access the website for two days without confirming their account,
143
+ # access will be blocked just in the third day.
144
+ # You can also set it to nil, which will allow the user to access the website
145
+ # without confirming their account.
146
+ # Default is 0.days, meaning the user cannot access the website without
147
+ # confirming their account.
148
+ # config.allow_unconfirmed_access_for = 2.days
149
+
150
+ # A period that the user is allowed to confirm their account before their
151
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
152
+ # their account within 3 days after the mail was sent, but on the fourth day
153
+ # their account can't be confirmed with the token any more.
154
+ # Default is nil, meaning there is no restriction on how long a user can take
155
+ # before confirming their account.
156
+ # config.confirm_within = 3.days
157
+
158
+ # If true, requires any email changes to be confirmed (exactly the same way as
159
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
160
+ # db field (see migrations). Until confirmed, new email is stored in
161
+ # unconfirmed_email column, and copied to email column on successful confirmation.
162
+ config.reconfirmable = true
163
+
164
+ # Defines which key will be used when confirming an account
165
+ # config.confirmation_keys = [:email]
166
+
167
+ # ==> Configuration for :rememberable
168
+ # The time the user will be remembered without asking for credentials again.
169
+ # config.remember_for = 2.weeks
170
+
171
+ # Invalidates all the remember me tokens when the user signs out.
172
+ config.expire_all_remember_me_on_sign_out = true
173
+
174
+ # If true, extends the user's remember period when remembered via cookie.
175
+ # config.extend_remember_period = false
176
+
177
+ # Options to be passed to the created cookie. For instance, you can set
178
+ # secure: true in order to force SSL only cookies.
179
+ # config.rememberable_options = {}
180
+
181
+ # ==> Configuration for :validatable
182
+ # Range for password length.
183
+ config.password_length = 6..128
184
+
185
+ # Email regex used to validate email formats. It simply asserts that
186
+ # one (and only one) @ exists in the given string. This is mainly
187
+ # to give user feedback and not to assert the e-mail validity.
188
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
189
+
190
+ # ==> Configuration for :timeoutable
191
+ # The time you want to timeout the user session without activity. After this
192
+ # time the user will be asked for credentials again. Default is 30 minutes.
193
+ # config.timeout_in = 30.minutes
194
+
195
+ # ==> Configuration for :lockable
196
+ # Defines which strategy will be used to lock an account.
197
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
198
+ # :none = No lock strategy. You should handle locking by yourself.
199
+ # config.lock_strategy = :failed_attempts
200
+
201
+ # Defines which key will be used when locking and unlocking an account
202
+ # config.unlock_keys = [:email]
203
+
204
+ # Defines which strategy will be used to unlock an account.
205
+ # :email = Sends an unlock link to the user email
206
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
207
+ # :both = Enables both strategies
208
+ # :none = No unlock strategy. You should handle unlocking by yourself.
209
+ # config.unlock_strategy = :both
210
+
211
+ # Number of authentication tries before locking an account if lock_strategy
212
+ # is failed attempts.
213
+ # config.maximum_attempts = 20
214
+
215
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
216
+ # config.unlock_in = 1.hour
217
+
218
+ # Warn on the last attempt before the account is locked.
219
+ # config.last_attempt_warning = true
220
+
221
+ # ==> Configuration for :recoverable
222
+ #
223
+ # Defines which key will be used when recovering the password for an account
224
+ # config.reset_password_keys = [:email]
225
+
226
+ # Time interval you can reset your password with a reset password key.
227
+ # Don't put a too small interval or your users won't have the time to
228
+ # change their passwords.
229
+ config.reset_password_within = 6.hours
230
+
231
+ # When set to false, does not sign a user in automatically after their password is
232
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
233
+ # config.sign_in_after_reset_password = true
234
+
235
+ # ==> Configuration for :encryptable
236
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
237
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
238
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
239
+ # for default behavior) and :restful_authentication_sha1 (then you should set
240
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
241
+ #
242
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
243
+ # config.encryptor = :sha512
244
+
245
+ # ==> Scopes configuration
246
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
247
+ # "users/sessions/new". It's turned off by default because it's slower if you
248
+ # are using only default views.
249
+ # config.scoped_views = false
250
+
251
+ # Configure the default scope given to Warden. By default it's the first
252
+ # devise role declared in your routes (usually :user).
253
+ # config.default_scope = :user
254
+
255
+ # Set this configuration to false if you want /users/sign_out to sign out
256
+ # only the current scope. By default, Devise signs out all scopes.
257
+ # config.sign_out_all_scopes = true
258
+
259
+ # ==> Navigation configuration
260
+ # Lists the formats that should be treated as navigational. Formats like
261
+ # :html, should redirect to the sign in page when the user does not have
262
+ # access, but formats like :xml or :json, should return 401.
263
+ #
264
+ # If you have any extra navigational formats, like :iphone or :mobile, you
265
+ # should add them to the navigational formats lists.
266
+ #
267
+ # The "*/*" below is required to match Internet Explorer requests.
268
+ # config.navigational_formats = ['*/*', :html]
269
+
270
+ # The default HTTP method used to sign out a resource. Default is :delete.
271
+ config.sign_out_via = :delete
272
+
273
+ # ==> OmniAuth
274
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
275
+ # up on your models and hooks.
276
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
277
+
278
+ # ==> Warden configuration
279
+ # If you want to use other strategies, that are not supported by Devise, or
280
+ # change the failure app, you can configure them inside the config.warden block.
281
+ #
282
+ # config.warden do |manager|
283
+ # manager.intercept_401 = false
284
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
285
+ # end
286
+
287
+ # ==> Mountable engine configurations
288
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
289
+ # is mountable, there are some extra configurations to be taken into account.
290
+ # The following options are available, assuming the engine is mounted as:
291
+ #
292
+ # mount MyEngine, at: '/my_engine'
293
+ #
294
+ # The router that invoked `devise_for`, in the example above, would be:
295
+ # config.router_name = :my_engine
296
+ #
297
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
298
+ # so you need to do it manually. For the users scope, it would be:
299
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
300
+
301
+ # ==> Turbolinks configuration
302
+ # If your app is using Turbolinks, Turbolinks::Controller needs to be included to make redirection work correctly:
303
+ #
304
+ # ActiveSupport.on_load(:devise_failure_app) do
305
+ # include Turbolinks::Controller
306
+ # end
307
+
308
+ # ==> Configuration for :registerable
309
+
310
+ # When set to false, does not sign a user in automatically after their password is
311
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
312
+ # config.sign_in_after_change_password = true
313
+ end