mojito_import 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +83 -0
- data/Guardfile +50 -0
- data/changelog.md +3 -0
- data/lib/mojito_import/report.rb +34 -24
- data/lib/mojito_import/version.rb +1 -1
- data/mojito_import.gemspec +1 -0
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cdc82e36585c1c83aec0c63435f0d5180ade856c9b3bc6c16fd8054d1e12dc8b
|
4
|
+
data.tar.gz: ebb93ceba3047bf6c91daf387a961f78377988dc318a4bdc3b78a1256e0f045d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ade5e9be267b918751f336fffcc4f1288722640269623a25401983a6b27882c3769be9f0f2a7249898c6376f17ac42c28141df6325f35e781b737296be4246bf
|
7
|
+
data.tar.gz: 6eaf8db74869b5a9c034fbba309417326bfd8233129db382faa15426190e496d21b021a4def00d0c9d82a8644f239b721795fcb8216544c73359ed8bec010a89
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mojito_import (0.5.0)
|
5
|
+
rest-client (~> 2.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.2)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
domain_name (0.5.20180417)
|
13
|
+
unf (>= 0.0.5, < 1.0.0)
|
14
|
+
ffi (1.11.1)
|
15
|
+
formatador (0.2.5)
|
16
|
+
guard (2.15.1)
|
17
|
+
formatador (>= 0.2.4)
|
18
|
+
listen (>= 2.7, < 4.0)
|
19
|
+
lumberjack (>= 1.0.12, < 2.0)
|
20
|
+
nenv (~> 0.1)
|
21
|
+
notiffany (~> 0.0)
|
22
|
+
pry (>= 0.9.12)
|
23
|
+
shellany (~> 0.0)
|
24
|
+
thor (>= 0.18.1)
|
25
|
+
http-cookie (1.0.3)
|
26
|
+
domain_name (~> 0.5)
|
27
|
+
listen (3.1.5)
|
28
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
29
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
30
|
+
ruby_dep (~> 1.2)
|
31
|
+
lumberjack (1.0.13)
|
32
|
+
method_source (0.9.2)
|
33
|
+
mime-types (3.2.2)
|
34
|
+
mime-types-data (~> 3.2015)
|
35
|
+
mime-types-data (3.2019.0331)
|
36
|
+
nenv (0.3.0)
|
37
|
+
netrc (0.11.0)
|
38
|
+
notiffany (0.1.3)
|
39
|
+
nenv (~> 0.1)
|
40
|
+
shellany (~> 0.0)
|
41
|
+
pry (0.12.2)
|
42
|
+
coderay (~> 1.1.0)
|
43
|
+
method_source (~> 0.9.0)
|
44
|
+
rake (12.3.3)
|
45
|
+
rb-fsevent (0.10.3)
|
46
|
+
rb-inotify (0.10.0)
|
47
|
+
ffi (~> 1.0)
|
48
|
+
rest-client (2.0.2)
|
49
|
+
http-cookie (>= 1.0.2, < 2.0)
|
50
|
+
mime-types (>= 1.16, < 4.0)
|
51
|
+
netrc (~> 0.8)
|
52
|
+
rspec (3.8.0)
|
53
|
+
rspec-core (~> 3.8.0)
|
54
|
+
rspec-expectations (~> 3.8.0)
|
55
|
+
rspec-mocks (~> 3.8.0)
|
56
|
+
rspec-core (3.8.0)
|
57
|
+
rspec-support (~> 3.8.0)
|
58
|
+
rspec-expectations (3.8.3)
|
59
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
60
|
+
rspec-support (~> 3.8.0)
|
61
|
+
rspec-mocks (3.8.0)
|
62
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
63
|
+
rspec-support (~> 3.8.0)
|
64
|
+
rspec-support (3.8.0)
|
65
|
+
ruby_dep (1.5.0)
|
66
|
+
shellany (0.0.1)
|
67
|
+
thor (0.20.3)
|
68
|
+
unf (0.1.4)
|
69
|
+
unf_ext
|
70
|
+
unf_ext (0.0.7.6)
|
71
|
+
|
72
|
+
PLATFORMS
|
73
|
+
ruby
|
74
|
+
|
75
|
+
DEPENDENCIES
|
76
|
+
bundler (~> 1.17)
|
77
|
+
guard (~> 2.15)
|
78
|
+
mojito_import!
|
79
|
+
rake (~> 12.3)
|
80
|
+
rspec (~> 3.0)
|
81
|
+
|
82
|
+
BUNDLED WITH
|
83
|
+
1.17.3
|
data/Guardfile
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
## Uncomment and set this to only include directories you want to watch
|
5
|
+
# directories %w(app lib config test spec features) \
|
6
|
+
# .select{|d| Dir.exists?(d) ? d : UI.warning("Directory #{d} does not exist")}
|
7
|
+
|
8
|
+
## Note: if you are using the `directories` clause above and you are not
|
9
|
+
## watching the project directory ('.'), then you will want to move
|
10
|
+
## the Guardfile to a watched dir and symlink it back, e.g.
|
11
|
+
#
|
12
|
+
# $ mkdir config
|
13
|
+
# $ mv Guardfile config/
|
14
|
+
# $ ln -s config/Guardfile .
|
15
|
+
#
|
16
|
+
# and, you'll have to watch "config/Guardfile" instead of "Guardfile"
|
17
|
+
|
18
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
19
|
+
# rspec may be run, below are examples of the most common uses.
|
20
|
+
# * bundler: 'bundle exec rspec'
|
21
|
+
# * bundler binstubs: 'bin/rspec'
|
22
|
+
# * spring: 'bin/rspec' (This will use spring if running and you have
|
23
|
+
# installed the spring binstubs per the docs)
|
24
|
+
# * zeus: 'zeus rspec' (requires the server to be started separately)
|
25
|
+
# * 'just' rspec: 'rspec'
|
26
|
+
|
27
|
+
guard :rspec, cmd: "bundle exec rspec" do
|
28
|
+
require "guard/rspec/dsl"
|
29
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
30
|
+
|
31
|
+
directories %w(lib spec)
|
32
|
+
# We should also watch Guardfile
|
33
|
+
|
34
|
+
# Feel free to open issues for suggestions and improvements
|
35
|
+
|
36
|
+
# RSpec files
|
37
|
+
rspec = dsl.rspec
|
38
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
39
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
40
|
+
watch(rspec.spec_files)
|
41
|
+
|
42
|
+
# Ruby files
|
43
|
+
ruby = dsl.ruby
|
44
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
45
|
+
|
46
|
+
# Watch lib
|
47
|
+
watch(%r{^lib/(?<path>.+)\.rb$}) { |m| "spec/#{m[:path]}_spec.rb" }
|
48
|
+
|
49
|
+
|
50
|
+
end
|
data/changelog.md
CHANGED
data/lib/mojito_import/report.rb
CHANGED
@@ -1,43 +1,53 @@
|
|
1
1
|
module MojitoImport
|
2
2
|
class Report
|
3
|
-
|
4
|
-
attr_accessor :data_errors, :general_errors, :import_id
|
3
|
+
attr_accessor :data_errors, :general_errors, :data_updates, :import_id
|
5
4
|
|
6
5
|
def initialize(import_id)
|
7
6
|
self.import_id = import_id
|
8
7
|
self.data_errors = []
|
9
8
|
self.general_errors = []
|
9
|
+
self.data_updates = []
|
10
10
|
end
|
11
11
|
|
12
12
|
def add_general_error(error)
|
13
13
|
general_errors << error
|
14
14
|
end
|
15
15
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
if hash_element.nil?
|
21
|
-
new_error_hash = {
|
22
|
-
"mojitoId" => mojito_id,
|
23
|
-
field => [error]
|
24
|
-
}
|
25
|
-
data_errors << new_error_hash
|
26
|
-
else
|
27
|
-
hash_element[field] ||= []
|
28
|
-
hash_element[field] << error
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def find_errors_for_object(mojito_id)
|
33
|
-
data_error = data_errors.detect{|data| data["mojitoId"] == mojito_id}
|
34
|
-
return if data_error.nil?
|
16
|
+
def add_data_update(mojito_id, field, from, to: nil)
|
17
|
+
# reload!; report = MojitoImport::Report.new('1234'); report.add_data_error('123', 'name', 'your name sucks')
|
18
|
+
hash_element =
|
19
|
+
data_updates.detect { |error_hash| error_hash["mojitoId"] == mojito_id }
|
35
20
|
|
36
|
-
|
37
|
-
|
21
|
+
update_hash = {"before" => from}
|
22
|
+
update_hash["after"] = to unless to.nil?
|
38
23
|
|
24
|
+
if hash_element.nil?
|
25
|
+
new_update_hash = { "mojitoId" => mojito_id, field => update_hash }
|
26
|
+
data_updates << new_update_hash
|
27
|
+
else
|
28
|
+
hash_element[field] = update_hash
|
29
|
+
end
|
30
|
+
end
|
39
31
|
|
32
|
+
def add_data_error(mojito_id, field, error)
|
33
|
+
# reload!; report = MojitoImport::Report.new('1234'); report.add_data_error('123', 'name', 'your name sucks')
|
34
|
+
hash_element =
|
35
|
+
data_errors.detect { |error_hash| error_hash["mojitoId"] == mojito_id }
|
36
|
+
|
37
|
+
if hash_element.nil?
|
38
|
+
new_error_hash = { "mojitoId" => mojito_id, field => [error] }
|
39
|
+
data_errors << new_error_hash
|
40
|
+
else
|
41
|
+
hash_element[field] ||= []
|
42
|
+
hash_element[field] << error
|
43
|
+
end
|
44
|
+
end
|
40
45
|
|
46
|
+
def find_errors_for_object(mojito_id)
|
47
|
+
data_error = data_errors.detect { |data| data["mojitoId"] == mojito_id }
|
48
|
+
return if data_error.nil?
|
41
49
|
|
42
|
-
|
50
|
+
data_error.except("mojitoId")
|
51
|
+
end
|
52
|
+
end
|
43
53
|
end
|
data/mojito_import.gemspec
CHANGED
@@ -32,5 +32,6 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_dependency "rest-client", "~> 2.0"
|
33
33
|
spec.add_development_dependency "bundler", "~> 1.17"
|
34
34
|
spec.add_development_dependency "rake", "~> 12.3"
|
35
|
+
spec.add_development_dependency "guard", "~> 2.15"
|
35
36
|
spec.add_development_dependency "rspec", "~> 3.0"
|
36
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mojito_import
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Darde
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '12.3'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.15'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.15'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,6 +92,8 @@ files:
|
|
78
92
|
- ".travis.yml"
|
79
93
|
- CODE_OF_CONDUCT.md
|
80
94
|
- Gemfile
|
95
|
+
- Gemfile.lock
|
96
|
+
- Guardfile
|
81
97
|
- LICENSE.txt
|
82
98
|
- README.md
|
83
99
|
- Rakefile
|
@@ -111,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
127
|
- !ruby/object:Gem::Version
|
112
128
|
version: '0'
|
113
129
|
requirements: []
|
114
|
-
rubygems_version: 3.0.
|
130
|
+
rubygems_version: 3.0.6
|
115
131
|
signing_key:
|
116
132
|
specification_version: 4
|
117
133
|
summary: Mojito Import, so fresh.
|