rseed 1.0.2 → 1.0.3

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MTgwMjMzOTlkYzM4MjcyYzAyZDZjZDRmMWY5ZTliNDhmZWVjZjk2Yg==
4
+ ZjBlZDc3ZThmOGFlZTZlYjE1YmNiZjk2ZGFhOTc4YjkzYWM0YmY3Yw==
5
5
  data.tar.gz: !binary |-
6
- Y2YxODA4MTRmNDBlYzI0M2MyMTUxMWZmNTkwMTA0ZDEwZDgxNzhiYg==
6
+ MGIzNmY3MGUxODI1MWVkYzgwNTQzOTNkMzAxYjQ1OWMzMDdhODE0Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MDBiMTZmYzcyNzc2ZmI5NjcxNTY0NGYzYTcwMjkxN2Q4MmIzZmNjYTJiZWJm
10
- ZGJlM2NlOWY4MTIzM2U2ZjE4ZDUyZDJlNjRlYTAxYzQ4MWRjM2E1NWY3MmJj
11
- NTI5OTBlZDFlZjZjZDQ1Yzc2OWJiNTFjMTY2MWU4MTRiNWZlNTE=
9
+ YzYxOGE5YTI2YTY5ZDBlMDA5OThiNzIxZWIwMTU4NzU1ZDMwNmM2MGM5NTc1
10
+ MDJkZDhmZGRmODBjOWI0NmRiNmM0YmEwZjcwMzM1NTE2MzU2NWEwNDU4ODA4
11
+ NTQ5YTQ1ZTczNDgxNzJkNGQzMWI3NTNkMDVhM2JiNGJhZDE3MzI=
12
12
  data.tar.gz: !binary |-
13
- ZWI1ZDhjNGE5OWI3ZTcwMWJmYzQxZmM4MjE2ZGVkYmEwYjY2NTg1MzI2Mzg4
14
- NzE2ZmRhYWM3ODI0ZWE3MWE5NGJiZWQ2ZmM0MmFlM2JhYWU2MzhlN2UwZmI0
15
- ZWI4NjExZjk2MTcwMjNmYmE5MGYyZTY4YWM5ZWZiMGNkZmFiNGM=
13
+ ZDkxNjJlNTVlOTZmNzVlNTllZTE5ODVmNzYxODBiNmY3ODkzNGRjODU1ZmEx
14
+ NTMyNzZiMmVmM2M4NzJhZjI0NDhkMTEwMWU5M2E1MzFmZDg0OGJkM2M4Yzgx
15
+ ODJhMDc2YWI1MmE4MDI0Mjk2ZjM4NTg5MDUxN2RhODEzYTI3NjQ=
@@ -5,7 +5,7 @@ class <%= @converter_name.camelize %>Converter < Rseed::Converter
5
5
  attribute :<%= attribute %>, type: :<%= meta.type %>
6
6
  <% end -%>
7
7
  <% @relationships.each_pair do |attribute, meta| -%>
8
- attribute :<%= attribute %><% unless @minimal %>, model: <%= meta.class_name %><% end %>, model_attribute: :<%= meta.foreign_key %><% unless @minimal %>, model_match: :first<% end %>
8
+ attribute :<%= attribute %><% unless @minimal %>, model: <%= meta.class_name %><% end %>, model_attribute: :id<% unless @minimal %>, model_match: :first<% end %>
9
9
  <% end -%>
10
10
 
11
11
  def <%= @model_name %>_attributes values
@@ -36,16 +36,16 @@ class <%= @converter_name.camelize %>Converter < Rseed::Converter
36
36
  # remove_blank_from values
37
37
 
38
38
  # For create only
39
- # <%= @model_name %> = <%= @class_name %>.new
39
+ # <%= @model_name %> = ::<%= @class_name %>.new
40
40
  #
41
41
  # For create or update, use the following instead and change the match attribute name as required
42
- # <%= @model_name %> = <%= @class_name %>.where(:id => values[:id]).first_or_initialize
42
+ # <%= @model_name %> = ::<%= @class_name %>.where(:id => values[:id]).first_or_initialize
43
43
  <% end -%>
44
44
 
45
45
  <% if @match_attribute -%>
46
- <%= @model_name %> = <%= @class_name %>.where(<%= @match_attribute %>: values[:<%= @match_attribute %>]).first_or_initialize
46
+ <%= @model_name %> = ::<%= @class_name %>.where(<%= @match_attribute %>: values[:<%= @match_attribute %>]).first_or_initialize
47
47
  <% else -%>
48
- <%= @model_name %> = <%= @class_name %>.new
48
+ <%= @model_name %> = ::<%= @class_name %>.new
49
49
  <% end -%>
50
50
 
51
51
  success = <%= @model_name %>.update_attributes <%= @model_name %>_attributes(values)
@@ -67,6 +67,13 @@ module Rseed
67
67
  tpr = (Time.now - start_time)/meta[:record_count]
68
68
  meta[:eta] = remaining * tpr
69
69
  end
70
+
71
+ # Log any errors
72
+ unless result[:success]
73
+ logger.error result[:message].to_s.red
74
+ logger.error result[:error].to_s.red
75
+ logger.error result[:backtrace].to_s
76
+ end
70
77
  yield :processing, result, meta
71
78
  end
72
79
  @converter.after_deserialize
data/lib/rseed/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rseed
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rseed
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Monagle