active_archive 4.0.7 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5092866dde1665b90ef7990da9caf0d876daec7c
4
- data.tar.gz: 6ea0affb05227176e452ee64619ae618b0d1550f
3
+ metadata.gz: 53a57d20b53abe71307066f628f8e5024eba8c76
4
+ data.tar.gz: 05bcfc26b4081f9ad67803389fa4caeb172d6b2e
5
5
  SHA512:
6
- metadata.gz: a616c28a17e305a010cc0ed56941f6961b192dcf7d0e55f6dba329ed27aa7b026e49c7ff7ff3a3efe344d4567fba2d5881311134ada9767d3066f4013fa55ca0
7
- data.tar.gz: d88833a0cdffce65f24898d0cba0e086362dd52050c881c623f0b078bcd8f2f5b91c7808f4381474c69885bfedc88ae0659c7ec3e1fe870f7cfea56b53239e88
6
+ metadata.gz: 4976442d877d97a811ed350592d857edcf6bfaf435e7286cbd4050c4164e40cf5223bab9f3784a329ebb8172fbac738d9a6a0ca7d1f580509169a5b84aa0e309
7
+ data.tar.gz: 9696a7cb69d41e5a4b58c3f61ab7ccd88bd6e5127833c8ed126cacd21f597e976b3e228b5a17db2d28f74733b0898aa77d767e6c1735b85a2c3c787944ced307
data/.reek CHANGED
@@ -1,29 +1,22 @@
1
1
  ---
2
2
  Attribute:
3
3
  enabled: false
4
- BooleanParameter:
5
- enabled: false
6
- ControlParameter:
4
+ DuplicateMethodCall:
7
5
  enabled: false
8
6
  FeatureEnvy:
9
7
  enabled: false
10
8
  IrresponsibleModule:
11
9
  enabled: false
12
- LongParameterList:
13
- enabled: false
14
10
  ManualDispatch:
15
11
  enabled: false
16
12
  NestedIterators:
17
13
  max_allowed_nesting: 2
18
14
  NilCheck:
19
15
  enabled: false
20
- PrimaDonnaMethod:
21
- enabled: false
22
- RepeatedConditional:
23
- enabled: false
24
16
  TooManyStatements:
25
17
  max_statements: 10
26
18
  exclude:
27
19
  - 'ActiveArchive::Base#retrieve_dependent_records'
20
+ - 'ActiveArchive::Base#set_archived_at'
28
21
  UtilityFunction:
29
22
  enabled: false
data/.rubocop.yml CHANGED
@@ -4,37 +4,23 @@ AllCops:
4
4
  TargetRubyVersion: 2.4
5
5
  Exclude:
6
6
  - 'spec/**/**/*'
7
- Layout/ClosingParenthesisIndentation:
8
- Enabled: false
9
7
  Layout/EmptyLinesAroundBlockBody:
10
8
  Enabled: false
11
9
  Layout/EmptyLinesAroundClassBody:
12
10
  Enabled: false
13
11
  Layout/EmptyLinesAroundModuleBody:
14
12
  Enabled: false
15
- Layout/FirstParameterIndentation:
16
- Enabled: false
17
- Layout/MultilineMethodCallIndentation:
18
- EnforcedStyle: aligned
19
13
  LineLength:
20
14
  Max: 100
15
+ Lint/RescueWithoutErrorClass:
16
+ Enabled: false
21
17
  Lint/ScriptPermission:
22
18
  Enabled: false
23
- Metrics/ClassLength:
19
+ Metrics/MethodLength:
24
20
  Enabled: false
25
21
  Metrics/ModuleLength:
26
22
  Enabled: false
27
23
  Style/Alias:
28
24
  EnforcedStyle: prefer_alias_method
29
- Style/BracesAroundHashParameters:
30
- Enabled: false
31
25
  Style/Documentation:
32
26
  Enabled: false
33
- Style/HashSyntax:
34
- Enabled: false
35
- Style/FrozenStringLiteralComment:
36
- Enabled: false
37
- Style/NumericLiterals:
38
- Enabled: false
39
- Style/RescueModifier:
40
- Enabled: false
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in active_archive.gemspec
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/active_archive.svg)](http://badge.fury.io/rb/active_archive)
4
4
  [![Build Status](https://travis-ci.org/drexed/active_archive.svg?branch=master)](https://travis-ci.org/drexed/active_archive)
5
- [![Coverage Status](https://coveralls.io/repos/github/drexed/active_archive/badge.svg?branch=master)](https://coveralls.io/github/drexed/active_archive?branch=master)
6
5
 
7
6
  ActiveArchive is a library for preventing database records from being destroyed.
8
7
 
@@ -34,7 +33,7 @@ Or install it yourself as:
34
33
  `../config/initalizers/active_archive.rb`
35
34
 
36
35
  ```ruby
37
- ActiveArchive::Settings.configure do |config|
36
+ ActiveArchive.configure do |config|
38
37
  config.all_records_archivable = false
39
38
  config.dependent_record_window = 3.seconds
40
39
  end
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
 
3
5
  task default: :spec
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # coding: utf-8
2
4
 
3
5
  lib = File.expand_path('../lib', __FILE__)
@@ -20,10 +22,8 @@ Gem::Specification.new do |spec|
20
22
  spec.require_paths = %w[lib]
21
23
 
22
24
  spec.add_runtime_dependency 'rails'
23
- spec.add_runtime_dependency 'dry-configurable'
24
25
 
25
26
  spec.add_development_dependency 'bundler'
26
- spec.add_development_dependency 'coveralls'
27
27
  spec.add_development_dependency 'rake'
28
28
  spec.add_development_dependency 'rspec'
29
29
  spec.add_development_dependency 'sqlite3'
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require 'bundler/setup'
4
5
  require 'active_archive'
data/bin/rake CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- #
2
+ # frozen_string_literal: true
3
+
3
4
  # This file was generated by Bundler.
4
5
  #
5
6
  # The application "rake" is installed as part of a gem, and
6
7
  # this file is here to facilitate running it.
7
- #
8
8
 
9
9
  require 'pathname'
10
10
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', Pathname.new(__FILE__).realpath)
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails'
2
4
 
3
- %w[version settings table_definition methods scopes base].each do |file_name|
5
+ %w[version configuration table_definition methods scopes base].each do |file_name|
4
6
  require "active_archive/#{file_name}"
5
7
  end
6
8
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveArchive
2
4
  module Base
3
5
 
@@ -189,7 +191,7 @@ module ActiveArchive
189
191
 
190
192
  def set_record_window(_, name, reflection)
191
193
  quoted_table_name = reflection.quoted_table_name
192
- window = ActiveArchive::Settings.config.dependent_record_window
194
+ window = ActiveArchive.configuration.dependent_record_window
193
195
 
194
196
  query = "#{quoted_table_name}.archived_at > ? AND #{quoted_table_name}.archived_at < ?"
195
197
 
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActiveArchive
4
+ class Configuration
5
+
6
+ attr_accessor :all_records_archivable, :dependent_record_window
7
+
8
+ def initialize
9
+ @all_records_archivable = false
10
+ @dependent_record_window = 3.seconds
11
+ end
12
+
13
+ end
14
+
15
+ def self.configuration
16
+ @configuration ||= Configuration.new
17
+ end
18
+
19
+ def self.configuration=(config)
20
+ @configuration = config
21
+ end
22
+
23
+ def self.configure
24
+ yield(configuration)
25
+ end
26
+
27
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveArchive
2
4
  module Methods
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveArchive
2
4
  module Scopes
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveArchive
2
4
  module TableDefinition
3
5
 
@@ -7,7 +9,7 @@ module ActiveArchive
7
9
  column(:created_at, :datetime, options)
8
10
  column(:updated_at, :datetime, options)
9
11
 
10
- return unless ActiveArchive::Settings.config.all_records_archivable == true
12
+ return unless ActiveArchive.configuration.all_records_archivable == true
11
13
  return if options[:skip]
12
14
 
13
15
  options[:null] = true
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module ActiveArchive
2
- VERSION = '4.0.7'.freeze
4
+ VERSION ||= '5.0.0'
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'rails/generators'
2
4
 
3
5
  module ActiveArchive
@@ -1,4 +1,6 @@
1
- ActiveArchive::Settings.configure do |config|
1
+ # frozen_string_literal: true
2
+
3
+ ActiveArchive.configure do |config|
2
4
  config.all_records_archivable = false
3
5
  config.dependent_record_window = 3.seconds
4
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.7
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-04 00:00:00.000000000 Z
11
+ date: 2017-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: dry-configurable
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: bundler
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -52,20 +38,6 @@ dependencies:
52
38
  - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: coveralls
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: rake
71
43
  requirement: !ruby/object:Gem::Requirement
@@ -186,7 +158,6 @@ extensions: []
186
158
  extra_rdoc_files: []
187
159
  files:
188
160
  - ".DS_Store"
189
- - ".coveralls.yml"
190
161
  - ".fasterer.yml"
191
162
  - ".gitignore"
192
163
  - ".reek"
@@ -206,9 +177,9 @@ files:
206
177
  - lib/active_archive.rb
207
178
  - lib/active_archive/.DS_Store
208
179
  - lib/active_archive/base.rb
180
+ - lib/active_archive/configuration.rb
209
181
  - lib/active_archive/methods.rb
210
182
  - lib/active_archive/scopes.rb
211
- - lib/active_archive/settings.rb
212
183
  - lib/active_archive/table_definition.rb
213
184
  - lib/active_archive/version.rb
214
185
  - lib/generators/active_archive/install_generator.rb
@@ -232,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
203
  version: '0'
233
204
  requirements: []
234
205
  rubyforge_project:
235
- rubygems_version: 2.6.12
206
+ rubygems_version: 2.6.13
236
207
  signing_key:
237
208
  specification_version: 4
238
209
  summary: Gem for soft-deleting ActiveRecord objects.
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
@@ -1,11 +0,0 @@
1
- require 'dry-configurable'
2
-
3
- module ActiveArchive
4
- class Settings
5
- extend Dry::Configurable
6
-
7
- setting :all_records_archivable, false
8
- setting :dependent_record_window, 3.seconds
9
-
10
- end
11
- end