journaled 4.3.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +18 -0
  3. data/app/jobs/journaled/delivery_job.rb +17 -28
  4. data/app/models/journaled/writer.rb +30 -18
  5. data/lib/journaled/connection.rb +48 -0
  6. data/lib/journaled/engine.rb +5 -0
  7. data/lib/journaled/errors.rb +3 -0
  8. data/lib/journaled/transaction_ext.rb +31 -0
  9. data/lib/journaled/version.rb +1 -1
  10. data/lib/journaled.rb +15 -11
  11. metadata +26 -84
  12. data/spec/dummy/README.rdoc +0 -28
  13. data/spec/dummy/Rakefile +0 -6
  14. data/spec/dummy/bin/bundle +0 -3
  15. data/spec/dummy/bin/rails +0 -4
  16. data/spec/dummy/bin/rake +0 -4
  17. data/spec/dummy/config/application.rb +0 -25
  18. data/spec/dummy/config/boot.rb +0 -5
  19. data/spec/dummy/config/database.yml +0 -6
  20. data/spec/dummy/config/environment.rb +0 -5
  21. data/spec/dummy/config/environments/development.rb +0 -24
  22. data/spec/dummy/config/environments/test.rb +0 -37
  23. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  24. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  25. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  26. data/spec/dummy/config/initializers/inflections.rb +0 -16
  27. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  28. data/spec/dummy/config/initializers/session_store.rb +0 -3
  29. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  30. data/spec/dummy/config/locales/en.yml +0 -23
  31. data/spec/dummy/config/routes.rb +0 -56
  32. data/spec/dummy/config/secrets.yml +0 -22
  33. data/spec/dummy/config.ru +0 -4
  34. data/spec/dummy/db/schema.rb +0 -18
  35. data/spec/dummy/public/404.html +0 -67
  36. data/spec/dummy/public/422.html +0 -67
  37. data/spec/dummy/public/500.html +0 -66
  38. data/spec/dummy/public/favicon.ico +0 -0
  39. data/spec/jobs/journaled/delivery_job_spec.rb +0 -276
  40. data/spec/lib/journaled_spec.rb +0 -89
  41. data/spec/models/concerns/journaled/actor_spec.rb +0 -47
  42. data/spec/models/concerns/journaled/changes_spec.rb +0 -106
  43. data/spec/models/database_change_protection_spec.rb +0 -109
  44. data/spec/models/journaled/actor_uri_provider_spec.rb +0 -42
  45. data/spec/models/journaled/change_writer_spec.rb +0 -281
  46. data/spec/models/journaled/event_spec.rb +0 -236
  47. data/spec/models/journaled/json_schema_model/validator_spec.rb +0 -133
  48. data/spec/models/journaled/writer_spec.rb +0 -212
  49. data/spec/rails_helper.rb +0 -19
  50. data/spec/spec_helper.rb +0 -24
  51. data/spec/support/environment_spec_helper.rb +0 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc6d5adec8f9ee32ba34d1ba8dae8cb3da062e39dd1b67d5fc3e219be116d675
4
- data.tar.gz: ae77057a26203e90fbb8770e1b41864edcff69058cd80b65011eb414ddf2365a
3
+ metadata.gz: ac63d8988a5cbbd63340c019b82642a039a9dfee81f46d83b15e5a71d83e9cb7
4
+ data.tar.gz: ae809e4b05901d6eb73eb0196119999be2b0fd414c3af3c4bb30d280216098cf
5
5
  SHA512:
6
- metadata.gz: 05a99d3d5d530bca784fb44fa290d0ff661430263fbde8fa882f8c98a9dda2eabe76c82df142b6477e68439066cba52d66d875c035a7af6e9d6a2938c8985b82
7
- data.tar.gz: 7726aa5152e545cdba1a50ef475f8df0ce37fb97edc2d4fa146c74f73b41c7096434948afeecbe61bc042138cae9c3b94dda475adbf9c74d42892b1d6286e069
6
+ metadata.gz: 72bcbe0ae43717280eb8a0b3383672cc87762e4c2b9b082778f1beac249004ef90a41e32e6fbabd693377a4d0af6cf6fc78df8a2b8ff44067276dd502cece63a
7
+ data.tar.gz: b21401ba2cf6155a25f50f1c58c634e3036754ec69b8d7f287c86408f69819aed5cfac1a43d55636a2be461545096b1510318a6ce665bf47595f30c8b90bceb9
data/README.md CHANGED
@@ -444,6 +444,24 @@ gem version.
444
444
 
445
445
  As such, **we always recommend upgrading only one major version at a time.**
446
446
 
447
+ ### Upgrading from 4.3.0
448
+
449
+ Versions of Journaled prior to 5.0 would enqueue events one at a time, but 5.0
450
+ introduces a new transaction-aware feature that will bundle up all events
451
+ emitted within a transaction and enqueue them all in a single "batch" job
452
+ directly before the SQL `COMMIT` statement. This reduces the database impact of
453
+ emitting a large volume of events at once.
454
+
455
+ This feature can be disabled conditionally:
456
+
457
+ ```ruby
458
+ Journaled.transactional_batching_enabled = false
459
+ ```
460
+
461
+ Backwards compatibility has been included for background jobs enqueued by
462
+ version 4.0 and above, but **has been dropped for jobs emitted by versions prior
463
+ to 4.0**. (Again, be sure to upgrade only one major version at a time.)
464
+
447
465
  ### Upgrading from 3.1.0
448
466
 
449
467
  Versions of Journaled prior to 4.0 relied directly on environment variables for stream names, but now stream names are configured directly.
@@ -12,26 +12,11 @@ module Journaled
12
12
  raise KinesisTemporaryFailure
13
13
  end
14
14
 
15
- UNSPECIFIED = Object.new
16
- private_constant :UNSPECIFIED
17
-
18
- def perform(serialized_event:, partition_key:, stream_name: UNSPECIFIED, app_name: UNSPECIFIED)
19
- @serialized_event = serialized_event
20
- @partition_key = partition_key
21
- if app_name != UNSPECIFIED
22
- @stream_name = self.class.legacy_computed_stream_name(app_name: app_name)
23
- elsif stream_name != UNSPECIFIED && !stream_name.nil?
24
- @stream_name = stream_name
25
- else
26
- raise(ArgumentError, 'missing keyword: stream_name')
27
- end
28
-
29
- journal!
30
- end
15
+ def perform(*events, **legacy_kwargs)
16
+ events << legacy_kwargs if legacy_kwargs.present?
17
+ @kinesis_records = events.map { |e| KinesisRecord.new(**e.delete_if { |_k, v| v.nil? }) }
31
18
 
32
- def self.legacy_computed_stream_name(app_name:)
33
- env_var_name = [app_name&.upcase, 'JOURNALED_STREAM_NAME'].compact.join('_')
34
- ENV.fetch(env_var_name)
19
+ journal! if Journaled.enabled?
35
20
  end
36
21
 
37
22
  def kinesis_client_config
@@ -46,18 +31,22 @@ module Journaled
46
31
 
47
32
  private
48
33
 
49
- attr_reader :serialized_event, :partition_key, :stream_name
34
+ KinesisRecord = Struct.new(:serialized_event, :partition_key, :stream_name, keyword_init: true) do
35
+ def initialize(serialized_event:, partition_key:, stream_name:)
36
+ super(serialized_event: serialized_event, partition_key: partition_key, stream_name: stream_name)
37
+ end
50
38
 
51
- def journal!
52
- kinesis_client.put_record record if Journaled.enabled?
39
+ def to_h
40
+ { stream_name: stream_name, data: serialized_event, partition_key: partition_key }
41
+ end
53
42
  end
54
43
 
55
- def record
56
- {
57
- stream_name: stream_name,
58
- data: serialized_event,
59
- partition_key: partition_key,
60
- }
44
+ attr_reader :kinesis_records
45
+
46
+ def journal!
47
+ kinesis_records.map do |record|
48
+ kinesis_client.put_record(**record.to_h)
49
+ end
61
50
  end
62
51
 
63
52
  def kinesis_client
@@ -26,8 +26,34 @@ class Journaled::Writer
26
26
 
27
27
  def journal!
28
28
  validate!
29
- ActiveSupport::Notifications.instrument('journaled.event.enqueue', event: journaled_event, priority: job_opts[:priority]) do
30
- Journaled::DeliveryJob.set(job_opts).perform_later(**delivery_perform_args)
29
+
30
+ ActiveSupport::Notifications.instrument('journaled.event.stage', event: journaled_event, **journaled_enqueue_opts) do
31
+ if Journaled::Connection.available?
32
+ Journaled::Connection.stage!(journaled_event)
33
+ else
34
+ self.class.enqueue!(journaled_event)
35
+ end
36
+ end
37
+ end
38
+
39
+ def self.enqueue!(*events)
40
+ events.group_by(&:journaled_enqueue_opts).each do |enqueue_opts, batch|
41
+ job_opts = enqueue_opts.reverse_merge(priority: Journaled.job_priority)
42
+ ActiveSupport::Notifications.instrument('journaled.batch.enqueue', batch: batch, **job_opts) do
43
+ Journaled::DeliveryJob.set(job_opts).perform_later(*delivery_perform_args(batch))
44
+
45
+ batch.each { |event| ActiveSupport::Notifications.instrument('journaled.event.enqueue', event: event, **job_opts) }
46
+ end
47
+ end
48
+ end
49
+
50
+ def self.delivery_perform_args(events)
51
+ events.map do |event|
52
+ {
53
+ serialized_event: event.journaled_attributes.to_json,
54
+ partition_key: event.journaled_partition_key,
55
+ stream_name: event.journaled_stream_name,
56
+ }
31
57
  end
32
58
  end
33
59
 
@@ -38,27 +64,13 @@ class Journaled::Writer
38
64
  delegate(*EVENT_METHOD_NAMES, to: :journaled_event)
39
65
 
40
66
  def validate!
67
+ serialized_event = journaled_event.journaled_attributes.to_json
68
+
41
69
  schema_validator('base_event').validate! serialized_event
42
70
  schema_validator('tagged_event').validate! serialized_event if journaled_event.tagged?
43
71
  schema_validator(journaled_schema_name).validate! serialized_event
44
72
  end
45
73
 
46
- def job_opts
47
- journaled_enqueue_opts.reverse_merge(priority: Journaled.job_priority)
48
- end
49
-
50
- def delivery_perform_args
51
- {
52
- serialized_event: serialized_event,
53
- partition_key: journaled_partition_key,
54
- stream_name: journaled_stream_name,
55
- }
56
- end
57
-
58
- def serialized_event
59
- @serialized_event ||= journaled_attributes.to_json
60
- end
61
-
62
74
  def schema_validator(schema_name)
63
75
  Journaled::JsonSchemaModel::Validator.new(schema_name)
64
76
  end
@@ -0,0 +1,48 @@
1
+ module Journaled
2
+ module Connection
3
+ class << self
4
+ def available?
5
+ Journaled.transactional_batching_enabled && transaction_open?
6
+ end
7
+
8
+ def stage!(event)
9
+ raise TransactionSafetyError, <<~MSG unless transaction_open?
10
+ Transaction not available! By default, journaled event batching requires an open database transaction.
11
+ MSG
12
+
13
+ connection.current_transaction._journaled_staged_events << event
14
+ end
15
+
16
+ private
17
+
18
+ def transaction_open?
19
+ connection.transaction_open?
20
+ end
21
+
22
+ def connection
23
+ if Journaled.queue_adapter.in? %w(delayed delayed_job)
24
+ Delayed::Job.connection
25
+ elsif Journaled.queue_adapter == 'good_job'
26
+ GoodJob::BaseRecord.connection
27
+ elsif Journaled.queue_adapter == 'que'
28
+ Que::ActiveRecord::Model.connection
29
+ elsif Journaled.queue_adapter == 'test' && Rails.env.test?
30
+ ActiveRecord::Base.connection
31
+ else
32
+ raise "Unsupported adapter: #{Journaled.queue_adapter}"
33
+ end
34
+ end
35
+ end
36
+
37
+ module TestOnlyBehaviors
38
+ def transaction_open?
39
+ # Transactional fixtures wrap all tests in an outer, non-joinable transaction:
40
+ super && (connection.open_transactions > 1 || connection.current_transaction.joinable?)
41
+ end
42
+ end
43
+
44
+ class << self
45
+ prepend TestOnlyBehaviors if Rails.env.test?
46
+ end
47
+ end
48
+ end
@@ -4,6 +4,11 @@ module Journaled
4
4
  ActiveSupport.on_load(:active_job) do
5
5
  Journaled.detect_queue_adapter! unless Journaled.development_or_test?
6
6
  end
7
+
8
+ ActiveSupport.on_load(:active_record) do
9
+ require 'journaled/transaction_ext'
10
+ ActiveRecord::ConnectionAdapters::Transaction.prepend Journaled::TransactionExt
11
+ end
7
12
  end
8
13
  end
9
14
  end
@@ -0,0 +1,3 @@
1
+ module Journaled
2
+ class TransactionSafetyError < StandardError; end
3
+ end
@@ -0,0 +1,31 @@
1
+ require 'active_record/connection_adapters/abstract/transaction'
2
+
3
+ module Journaled
4
+ module TransactionExt
5
+ def initialize(*, **)
6
+ super.tap do
7
+ raise TransactionSafetyError, <<~MSG unless instance_variable_defined?(:@run_commit_callbacks)
8
+ Journaled::TransactionExt expects @run_commit_callbacks to be defined on Transaction!
9
+ This is an internal API that may have changed in a recent Rails release.
10
+ If you were not expecting to see this error, please file an issue here:
11
+ https://github.com/Betterment/journaled/issues
12
+ MSG
13
+ end
14
+ end
15
+
16
+ def before_commit_records
17
+ super.tap do
18
+ Writer.enqueue!(*_journaled_staged_events) if @run_commit_callbacks
19
+ end
20
+ end
21
+
22
+ def commit_records
23
+ connection.current_transaction._journaled_staged_events.push(*_journaled_staged_events) unless @run_commit_callbacks
24
+ super
25
+ end
26
+
27
+ def _journaled_staged_events
28
+ @_journaled_staged_events ||= []
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Journaled
2
- VERSION = "4.3.0".freeze
2
+ VERSION = "5.0.0".freeze
3
3
  end
data/lib/journaled.rb CHANGED
@@ -4,6 +4,8 @@ require "json-schema"
4
4
 
5
5
  require "journaled/engine"
6
6
  require "journaled/current"
7
+ require "journaled/errors"
8
+ require 'journaled/connection'
7
9
 
8
10
  module Journaled
9
11
  SUPPORTED_QUEUE_ADAPTERS = %w(delayed delayed_job good_job que).freeze
@@ -14,32 +16,36 @@ module Journaled
14
16
  mattr_accessor(:http_open_timeout) { 2 }
15
17
  mattr_accessor(:http_read_timeout) { 60 }
16
18
  mattr_accessor(:job_base_class_name) { 'ActiveJob::Base' }
19
+ mattr_accessor(:transactional_batching_enabled) { true }
17
20
 
18
- def development_or_test?
21
+ def self.development_or_test?
19
22
  %w(development test).include?(Rails.env)
20
23
  end
21
24
 
22
- def enabled?
25
+ def self.enabled?
23
26
  ['0', 'false', false, 'f', ''].exclude?(ENV.fetch('JOURNALED_ENABLED', !development_or_test?))
24
27
  end
25
28
 
26
- def schema_providers
29
+ def self.schema_providers
27
30
  @schema_providers ||= [Journaled::Engine, Rails]
28
31
  end
29
32
 
30
- def commit_hash
33
+ def self.commit_hash
31
34
  ENV.fetch('GIT_COMMIT')
32
35
  end
33
36
 
34
- def actor_uri
37
+ def self.actor_uri
35
38
  Journaled::ActorUriProvider.instance.actor_uri
36
39
  end
37
40
 
38
- def detect_queue_adapter!
39
- adapter = job_base_class_name.constantize.queue_adapter_name
40
- unless SUPPORTED_QUEUE_ADAPTERS.include?(adapter)
41
+ def self.queue_adapter
42
+ job_base_class_name.constantize.queue_adapter_name
43
+ end
44
+
45
+ def self.detect_queue_adapter!
46
+ unless SUPPORTED_QUEUE_ADAPTERS.include?(queue_adapter)
41
47
  raise <<~MSG
42
- Journaled has detected an unsupported ActiveJob queue adapter: `:#{adapter}`
48
+ Journaled has detected an unsupported ActiveJob queue adapter: `:#{queue_adapter}`
43
49
 
44
50
  Journaled jobs must be enqueued transactionally to your primary database.
45
51
 
@@ -62,6 +68,4 @@ module Journaled
62
68
  def self.tag!(**tags)
63
69
  Current.tags = Current.tags.merge(tags)
64
70
  end
65
-
66
- module_function :development_or_test?, :enabled?, :schema_providers, :commit_hash, :actor_uri, :detect_queue_adapter!
67
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: journaled
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jake Lipson
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2022-04-07 00:00:00.000000000 Z
14
+ date: 2022-08-23 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob
@@ -255,57 +255,39 @@ files:
255
255
  - journaled_schemas/journaled/change.json
256
256
  - journaled_schemas/tagged_event.json
257
257
  - lib/journaled.rb
258
+ - lib/journaled/connection.rb
258
259
  - lib/journaled/current.rb
259
260
  - lib/journaled/engine.rb
261
+ - lib/journaled/errors.rb
260
262
  - lib/journaled/relation_change_protection.rb
261
263
  - lib/journaled/rspec.rb
264
+ - lib/journaled/transaction_ext.rb
262
265
  - lib/journaled/version.rb
263
- - spec/dummy/README.rdoc
264
- - spec/dummy/Rakefile
265
- - spec/dummy/bin/bundle
266
- - spec/dummy/bin/rails
267
- - spec/dummy/bin/rake
268
- - spec/dummy/config.ru
269
- - spec/dummy/config/application.rb
270
- - spec/dummy/config/boot.rb
271
- - spec/dummy/config/database.yml
272
- - spec/dummy/config/environment.rb
273
- - spec/dummy/config/environments/development.rb
274
- - spec/dummy/config/environments/test.rb
275
- - spec/dummy/config/initializers/backtrace_silencers.rb
276
- - spec/dummy/config/initializers/cookies_serializer.rb
277
- - spec/dummy/config/initializers/filter_parameter_logging.rb
278
- - spec/dummy/config/initializers/inflections.rb
279
- - spec/dummy/config/initializers/mime_types.rb
280
- - spec/dummy/config/initializers/session_store.rb
281
- - spec/dummy/config/initializers/wrap_parameters.rb
282
- - spec/dummy/config/locales/en.yml
283
- - spec/dummy/config/routes.rb
284
- - spec/dummy/config/secrets.yml
285
- - spec/dummy/db/schema.rb
286
- - spec/dummy/public/404.html
287
- - spec/dummy/public/422.html
288
- - spec/dummy/public/500.html
289
- - spec/dummy/public/favicon.ico
290
- - spec/jobs/journaled/delivery_job_spec.rb
291
- - spec/lib/journaled_spec.rb
292
- - spec/models/concerns/journaled/actor_spec.rb
293
- - spec/models/concerns/journaled/changes_spec.rb
294
- - spec/models/database_change_protection_spec.rb
295
- - spec/models/journaled/actor_uri_provider_spec.rb
296
- - spec/models/journaled/change_writer_spec.rb
297
- - spec/models/journaled/event_spec.rb
298
- - spec/models/journaled/json_schema_model/validator_spec.rb
299
- - spec/models/journaled/writer_spec.rb
300
- - spec/rails_helper.rb
301
- - spec/spec_helper.rb
302
- - spec/support/environment_spec_helper.rb
303
266
  homepage: http://github.com/Betterment/journaled
304
267
  licenses:
305
268
  - MIT
306
269
  metadata:
307
270
  rubygems_mfa_required: 'true'
308
- post_install_message:
271
+ post_install_message: |+
272
+ ============================
273
+ NOTE FOR UPGRADING JOURNALED
274
+ ============================
275
+
276
+ If you are upgrading from an older `journaled` version, please be sure to
277
+ increment only ONE major version at a time.
278
+
279
+ ⚠️ IF YOU ARE UPGRADING FROM 3.1 OR EARLIER, you should NOT USE THIS VERSION. ⚠️
280
+
281
+ Instead, install a version of the gem that is backwards compatible with your
282
+ app's currently-enqueued journaled jobs:
283
+
284
+ gem 'journaled', '~> 4.2.0' # upgrading from 3.0-3.1
285
+ gem 'journaled', '~> 3.1.0' # upgrading from 2.0-2.5
286
+
287
+ For additional upgrade instructions (e.g. how to handle a few BREAKING CHANGES
288
+ to environment variables), please see the README:
289
+ https://github.com/Betterment/journaled/blob/v5.0.0/README.md#upgrades
290
+
309
291
  rdoc_options: []
310
292
  require_paths:
311
293
  - lib
@@ -324,44 +306,4 @@ rubygems_version: 3.3.5
324
306
  signing_key:
325
307
  specification_version: 4
326
308
  summary: Journaling for Betterment apps.
327
- test_files:
328
- - spec/spec_helper.rb
329
- - spec/dummy/bin/rake
330
- - spec/dummy/bin/bundle
331
- - spec/dummy/bin/rails
332
- - spec/dummy/config/secrets.yml
333
- - spec/dummy/config/routes.rb
334
- - spec/dummy/config/locales/en.yml
335
- - spec/dummy/config/environments/development.rb
336
- - spec/dummy/config/environments/test.rb
337
- - spec/dummy/config/environment.rb
338
- - spec/dummy/config/application.rb
339
- - spec/dummy/config/database.yml
340
- - spec/dummy/config/boot.rb
341
- - spec/dummy/config/initializers/backtrace_silencers.rb
342
- - spec/dummy/config/initializers/mime_types.rb
343
- - spec/dummy/config/initializers/filter_parameter_logging.rb
344
- - spec/dummy/config/initializers/session_store.rb
345
- - spec/dummy/config/initializers/wrap_parameters.rb
346
- - spec/dummy/config/initializers/cookies_serializer.rb
347
- - spec/dummy/config/initializers/inflections.rb
348
- - spec/dummy/config.ru
349
- - spec/dummy/Rakefile
350
- - spec/dummy/public/favicon.ico
351
- - spec/dummy/public/422.html
352
- - spec/dummy/public/500.html
353
- - spec/dummy/public/404.html
354
- - spec/dummy/db/schema.rb
355
- - spec/dummy/README.rdoc
356
- - spec/models/journaled/json_schema_model/validator_spec.rb
357
- - spec/models/journaled/actor_uri_provider_spec.rb
358
- - spec/models/journaled/event_spec.rb
359
- - spec/models/journaled/change_writer_spec.rb
360
- - spec/models/journaled/writer_spec.rb
361
- - spec/models/database_change_protection_spec.rb
362
- - spec/models/concerns/journaled/changes_spec.rb
363
- - spec/models/concerns/journaled/actor_spec.rb
364
- - spec/support/environment_spec_helper.rb
365
- - spec/lib/journaled_spec.rb
366
- - spec/jobs/journaled/delivery_job_spec.rb
367
- - spec/rails_helper.rb
309
+ test_files: []
@@ -1,28 +0,0 @@
1
- == README
2
-
3
- This README would normally document whatever steps are necessary to get the
4
- application up and running.
5
-
6
- Things you may want to cover:
7
-
8
- * Ruby version
9
-
10
- * System dependencies
11
-
12
- * Configuration
13
-
14
- * Database creation
15
-
16
- * Database initialization
17
-
18
- * How to run the test suite
19
-
20
- * Services (job queues, cache servers, search engines, etc.)
21
-
22
- * Deployment instructions
23
-
24
- * ...
25
-
26
-
27
- Please feel free to use a different markup language if you do not plan to run
28
- <tt>rake doc:app</tt>.
data/spec/dummy/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
- require File.expand_path('config/application', __dir__)
5
-
6
- Rails.application.load_tasks
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
- load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../config/application', __dir__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
data/spec/dummy/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,25 +0,0 @@
1
- require File.expand_path('boot', __dir__)
2
-
3
- require "active_record/railtie"
4
- require "active_job/railtie"
5
- require "active_model/railtie"
6
- require "action_controller/railtie"
7
-
8
- Bundler.require(*Rails.groups)
9
- require "journaled"
10
-
11
- module Dummy
12
- class Application < Rails::Application
13
- # Settings in config/environments/* take precedence over those specified here.
14
- # Application configuration should go into files in config/initializers
15
- # -- 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
- end
25
- end
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
-
4
- require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -1,6 +0,0 @@
1
- development:
2
- adapter: sqlite3
3
- database: ":memory:"
4
- test:
5
- adapter: sqlite3
6
- database: ":memory:"
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('application', __dir__)
3
-
4
- # Initialize the Rails application.
5
- Rails.application.initialize!
@@ -1,24 +0,0 @@
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 and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Print deprecation notices to the Rails logger.
17
- config.active_support.deprecation = :log
18
-
19
- # Raise an error on page load if there are pending migrations.
20
- config.active_record.migration_error = :page_load
21
-
22
- # Raises error for missing translations
23
- # config.action_view.raise_on_missing_translations = true
24
- end
@@ -1,37 +0,0 @@
1
- Rails.application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_assets = true
17
- config.static_cache_control = 'public, max-age=3600'
18
-
19
- # Show full error reports and disable caching.
20
- config.consider_all_requests_local = true
21
- config.action_controller.perform_caching = false
22
-
23
- # Raise exceptions instead of rendering exception templates.
24
- config.action_dispatch.show_exceptions = false
25
-
26
- # Disable request forgery protection in test environment.
27
- config.action_controller.allow_forgery_protection = false
28
-
29
- # Print deprecation notices to the stderr.
30
- config.active_support.deprecation = :stderr
31
-
32
- # Raises error for missing translations
33
- # config.action_view.raise_on_missing_translations = true
34
-
35
- # Use ActiveJob test adapter
36
- config.active_job.queue_adapter = :test
37
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,3 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]