eac_rails_remotes 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/eac_rails_remotes/instance.rb +25 -5
- data/lib/eac_rails_remotes/version.rb +1 -1
- data/lib/tasks/eac_rails_remotes.rake +1 -1
- metadata +27 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6cc86581c903002e2e9913cb8d5177fcf6584335981aafe7f635a2e6bf91793
|
4
|
+
data.tar.gz: 734e7de9b68fca2663e6ec6a932169ab7580e0597f5d12d17bf48f731b23e54b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bde88ca426dffcf997c6a79101d7165eb7fc3b15593650b3345772b7d8566d6355ed48fc3870d9e41160f5030a81ce558ad6adffb27b27ae5d0587df4d9f9ffb
|
7
|
+
data.tar.gz: c57298ba0a909455c8b212dbabd35b9b353fae6cecc27abf320662574b85873eb43dd8780faba300bd2361fbf30726b64dfc3642353a2ebe1ece03db8769572a
|
@@ -24,6 +24,16 @@ module EacRailsRemotes
|
|
24
24
|
"#{source}|#{entity}|#{code}"
|
25
25
|
end
|
26
26
|
|
27
|
+
# @return [Object]
|
28
|
+
def assert_target
|
29
|
+
return target if target.present?
|
30
|
+
|
31
|
+
export if export_status != EXPORT_STATUS_ERROR
|
32
|
+
return target if target.present?
|
33
|
+
|
34
|
+
raise "Export failed (ID: #{id}, export message: \"#{export_message}\""
|
35
|
+
end
|
36
|
+
|
27
37
|
def export
|
28
38
|
Rails.logger.info("Exporting #{self}")
|
29
39
|
t = target || entity_class.new
|
@@ -65,14 +75,24 @@ module EacRailsRemotes
|
|
65
75
|
end
|
66
76
|
|
67
77
|
class << self
|
78
|
+
# @param record [Hash]
|
79
|
+
# @return [EacRailsRemotes::Instance]
|
68
80
|
def import(record)
|
69
|
-
ri = where(source: record
|
70
|
-
|
71
|
-
ri.data = record
|
72
|
-
ri.
|
73
|
-
|
81
|
+
ri = where(source: record.fetch(:source), entity: sanitize_entity(record.fetch(:entity)),
|
82
|
+
code: record.fetch(:code)).first_or_initialize
|
83
|
+
ri.data = record.fetch(:data).to_yaml
|
84
|
+
if ri.data_changed?
|
85
|
+
ri.export_status = EXPORT_STATUS_NEW_DATA
|
86
|
+
ri.save!
|
87
|
+
end
|
74
88
|
ri
|
75
89
|
end
|
90
|
+
|
91
|
+
# @oaram entity [Object]
|
92
|
+
# @return [String]
|
93
|
+
def sanitize_entity(entity)
|
94
|
+
entity.is_a?(::Module) ? entity.name : entity.to_s
|
95
|
+
end
|
76
96
|
end
|
77
97
|
end
|
78
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eac_rails_remotes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Put here the authors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_active_scaffold
|
@@ -16,54 +16,68 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.6'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.6.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.6'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.6.1
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
|
-
name:
|
34
|
+
name: eac_rails_gem_support
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
39
|
+
version: '0.10'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.10.1
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '0.
|
49
|
+
version: '0.10'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.
|
52
|
+
version: 0.10.1
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
name: eac_rails_utils
|
55
|
+
requirement: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - "~>"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.24'
|
60
|
+
type: :runtime
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - "~>"
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '0.24'
|
53
67
|
- !ruby/object:Gem::Dependency
|
54
68
|
name: eac_ruby_utils
|
55
69
|
requirement: !ruby/object:Gem::Requirement
|
56
70
|
requirements:
|
57
71
|
- - "~>"
|
58
72
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0.
|
73
|
+
version: '0.122'
|
60
74
|
type: :runtime
|
61
75
|
prerelease: false
|
62
76
|
version_requirements: !ruby/object:Gem::Requirement
|
63
77
|
requirements:
|
64
78
|
- - "~>"
|
65
79
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0.
|
80
|
+
version: '0.122'
|
67
81
|
- !ruby/object:Gem::Dependency
|
68
82
|
name: eac_rails_gem_support
|
69
83
|
requirement: !ruby/object:Gem::Requirement
|