rails-archiver 0.1.6 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ca3e0face6f9a1c35335bd8863be14ad33d114f9
4
- data.tar.gz: 3dfe6020b3699ff6f542c2523bf3f6cc3f9ce9d3
2
+ SHA256:
3
+ metadata.gz: 22767f51d1fefb73fd2d17b703a0ee846509bb99fc4dd2bed27c06a28fcdfc60
4
+ data.tar.gz: d04f42ec798d1df81fc3ee76575d4e1658563b73e4087f1e1639553b489b52b6
5
5
  SHA512:
6
- metadata.gz: d93da3f91309bbe039a53c207836c64b12f48e6d9250fbef9f58badf663fe9875a83bbcec150a67c4540423b7cafee7ae1d94c419661a23c3d4071f27dd62482
7
- data.tar.gz: 9dc75efa7583d6d931bf0e1c7b955fd7739bbae9c33846e7b2d7b05d360718c90ad0369d9d8fe369686332f292671fdc0be3a7f7611cd441cce05fe779aa0b8d
6
+ metadata.gz: a9b6176a12fd8fd673ebb726dcaa4dd08f2a3e561718685693870f78d0661b863e7ca03b2ea8a9da8f8e18e73f1128115c20af17f65aee08e070911584473958
7
+ data.tar.gz: 176e5169d8d4756fdae4ff8fcbe5e8f5bcde4395a262a332321e7cbbdf1e61530e7373b1fd389217d5c747190d4dbb0023aa1aab48c29df5128ac7827a7a502d
@@ -29,7 +29,8 @@ module RailsArchiver
29
29
  def store_archive(hash)
30
30
  json = hash.to_json
31
31
  file_path = "#{@model.id}_#{SecureRandom.hex(8)}.json"
32
- s3_key = "#{@options[:base_path]}/#{file_path}.gz"
32
+ base_path = @options[:base_path] ? "#{@options[:base_path]}/" : ''
33
+ s3_key = "#{base_path}#{file_path}.gz"
33
34
  Dir.mktmpdir do |dir|
34
35
  json_filename = "#{dir}/#{file_path}"
35
36
  @logger.info('Writing hash to JSON')
@@ -40,7 +40,7 @@ module RailsArchiver
40
40
  if @model
41
41
  @model.reload
42
42
  if @model.attribute_names.include?('archived')
43
- @model.update_attribute(:archived, false)
43
+ @model.class.where(id: @model.id).update_all(:archived => false)
44
44
  end
45
45
  end
46
46
  @logger.info("#{source} load complete!")
@@ -51,7 +51,11 @@ module RailsArchiver
51
51
  def load_classes(hash)
52
52
  full_hash = hash.with_indifferent_access
53
53
  full_hash.each do |key, vals|
54
- save_models(key.constantize, vals)
54
+ begin
55
+ save_models(key.constantize, vals)
56
+ rescue NameError => e
57
+ @logger.error("Could not save models for #{key}: #{e.message}")
58
+ end
55
59
  end
56
60
  if @options[:crash_on_errors] && self.errors.any?
57
61
  raise ImportError.new("Errors occurred during load - please see 'errors' method for more details")
@@ -1,8 +1,8 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'rails-archiver'
3
3
  s.require_paths = %w(. lib lib/rails-archiver)
4
- s.version = '0.1.6'
5
- s.date = '2018-06-05'
4
+ s.version = '0.1.8'
5
+ s.date = '2024-07-03'
6
6
  s.summary = 'Fully archive a Rails model'
7
7
  s.description = <<-EOF
8
8
  EOF
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-archiver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-05 00:00:00.000000000 Z
11
+ date: 2024-07-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,7 +56,7 @@ homepage: https://github.com/dorner/rails-archiver
56
56
  licenses:
57
57
  - MIT
58
58
  metadata: {}
59
- post_install_message:
59
+ post_install_message:
60
60
  rdoc_options: []
61
61
  require_paths:
62
62
  - "."
@@ -73,9 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  requirements: []
76
- rubyforge_project:
77
- rubygems_version: 2.6.14
78
- signing_key:
76
+ rubygems_version: 3.4.10
77
+ signing_key:
79
78
  specification_version: 4
80
79
  summary: Fully archive a Rails model
81
80
  test_files: []