smuggle 0.3.0 → 0.4.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 +4 -4
- data/README.md +140 -67
- data/lib/generators/smuggle/exporter/exporter_generator.rb +4 -2
- data/lib/generators/smuggle/exporter/templates/exporter.rb +1 -1
- data/lib/generators/smuggle/importer/USAGE +14 -0
- data/lib/generators/smuggle/importer/importer_generator.rb +15 -0
- data/lib/generators/smuggle/importer/templates/importer.rb +11 -0
- data/lib/generators/smuggle/install/USAGE +1 -1
- data/lib/generators/smuggle/install/install_generator.rb +8 -2
- data/lib/generators/smuggle/install/templates/application_exporter.rb +2 -0
- data/lib/generators/smuggle/install/templates/application_importer.rb +4 -0
- data/lib/smuggle.rb +9 -7
- data/lib/smuggle/engine.rb +2 -0
- data/lib/smuggle/errors.rb +9 -0
- data/lib/smuggle/exporter/base.rb +7 -3
- data/lib/smuggle/importer/base.rb +50 -0
- data/lib/smuggle/services/export.rb +4 -4
- data/lib/smuggle/services/import.rb +43 -0
- data/lib/smuggle/version.rb +3 -1
- metadata +79 -36
- data/.editorconfig +0 -30
- data/.gitignore +0 -13
- data/.rspec +0 -2
- data/.rubocop.yml +0 -71
- data/.travis.yml +0 -5
- data/CHANGELOG.md +0 -12
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Rakefile +0 -6
- data/bin/console +0 -13
- data/bin/setup +0 -8
- data/lib/smuggle/exporter_not_found.rb +0 -4
- data/smuggle.gemspec +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76c28e234e739e3124cd325d75adcbdfbce6af88b4b48ad55ece82ca5d0db14e
|
4
|
+
data.tar.gz: 2e5357b380f21f5249e233505c6d67f91b43db50b28bdbdcc04f771af95dd112
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a6b749134917f0b16b745e5678b6332f6f2f24895fd5171c34762c7b8dad848d439fa713b495d860eda326e16a40de31c236d0d252fbfe5af7928c02d43e9a1
|
7
|
+
data.tar.gz: a91cd6e70449ed729cab625faa84a79d199364abf538de800c4646077709619c93ba33b3aab9ec55d54a937f3e621bc29a595105b53b905b6af5cc094e4b53b6
|
data/README.md
CHANGED
@@ -1,136 +1,209 @@
|
|
1
1
|
# Smuggle
|
2
2
|
|
3
|
-
|
3
|
+
[](http://rubygems.org/gems/smuggle)
|
4
|
+
[](https://depfu.com/github/InspireNL/smuggle?project=Bundler)
|
5
|
+
[](http://inch-ci.org/github/InspireNL/smuggle)
|
6
|
+
[](https://circleci.com/gh/InspireNL/smuggle)
|
7
|
+
[](https://codeclimate.com/github/InspireNL/smuggle/maintainability)
|
8
|
+
[](https://codeclimate.com/github/InspireNL/smuggle/test_coverage)
|
4
9
|
|
5
|
-
|
10
|
+
Is a gem to manage exports and imports with ease, separating the logic from the models, resulting in a much cleaner codebase. Easy to use, with familiar structure.
|
6
11
|
|
7
|
-
|
12
|
+
**Smuggle is not dependent on Rails**, you can use it on ActiveModel/ActiveRecord models, as well as plain ruby objects and hashes.
|
8
13
|
|
9
|
-
|
14
|
+
Links:
|
10
15
|
|
11
|
-
|
12
|
-
|
13
|
-
|
16
|
+
- [API Docs](https://www.rubydoc.info/gems/smuggle)
|
17
|
+
- [Contributing](https://github.com/InspireNL/smuggle/blob/master/CONTRIBUTING.md)
|
18
|
+
- [Code of Conduct](https://github.com/InspireNL/smuggle/blob/master/CODE_OF_CONDUCT.md)
|
14
19
|
|
15
|
-
|
20
|
+
## Requirements
|
16
21
|
|
17
|
-
|
18
|
-
|
19
|
-
|
22
|
+
1. [Ruby 2.5.0](https://www.ruby-lang.org)
|
23
|
+
|
24
|
+
## Installation
|
20
25
|
|
21
|
-
|
26
|
+
To install, run:
|
22
27
|
|
23
28
|
```
|
24
|
-
|
29
|
+
gem install smuggle
|
25
30
|
```
|
26
31
|
|
27
|
-
|
32
|
+
Or add the following to your Gemfile:
|
28
33
|
|
29
34
|
```
|
30
|
-
|
31
|
-
create app/exporters/application_exporter.rb
|
35
|
+
gem "smuggle"
|
32
36
|
```
|
33
37
|
|
34
|
-
|
38
|
+
## Usage
|
35
39
|
|
36
|
-
|
37
|
-
$ rails g smuggle:exporter user
|
38
|
-
create app/exporters/user_exporter.rb
|
39
|
-
```
|
40
|
+
### Exporters
|
40
41
|
|
41
|
-
|
42
|
+
Given the following plain old ruby object:
|
42
43
|
|
43
|
-
```
|
44
|
-
|
45
|
-
|
46
|
-
```
|
44
|
+
```ruby
|
45
|
+
class User
|
46
|
+
attr_accessor :name
|
47
47
|
|
48
|
-
|
48
|
+
def initialize(name)
|
49
|
+
@name = name
|
50
|
+
end
|
51
|
+
end
|
52
|
+
```
|
49
53
|
|
50
|
-
|
54
|
+
An exporter can be defined by inheriting from [Smuggle::Exporter::Base](lib/smuggle/exporter/base.rb) and define the attributes to export:
|
51
55
|
|
52
56
|
```ruby
|
53
|
-
class UserExporter <
|
54
|
-
attributes :
|
57
|
+
class UserExporter < Smuggle::Exporter::Base
|
58
|
+
attributes :name
|
55
59
|
end
|
56
60
|
```
|
57
61
|
|
58
62
|
Extra logic can be establish inside the exporter file, using the same name as the attribute:
|
59
63
|
|
60
64
|
```ruby
|
61
|
-
class UserExporter <
|
62
|
-
attributes :
|
65
|
+
class UserExporter < Smuggle::Exporter::Base
|
66
|
+
attributes :name
|
63
67
|
|
64
|
-
def
|
65
|
-
super
|
68
|
+
def name
|
69
|
+
super + " - exported"
|
66
70
|
end
|
67
71
|
end
|
68
72
|
```
|
69
73
|
|
70
|
-
If there are no attributes defined in the exporter, all the attributes of the
|
74
|
+
If there are no attributes defined in the exporter and you are using ActiveModel or ActiveRecord, all the attributes of the record will be included.
|
71
75
|
If it is a hash, then all values will be included.
|
72
76
|
|
73
|
-
|
77
|
+
To generate the csv data simply call:
|
74
78
|
|
75
|
-
|
79
|
+
```ruby
|
80
|
+
users = [User.new("Rick Sanchez"), User.new("Morty Smith")]
|
81
|
+
Smuggle::Services::Export.call(scope: users, exporter: UserExporter)
|
82
|
+
# => "Full name,Full name\nRick Sanchez,Rick Sanchez\nMorty Smith,Morty Smith\n"
|
83
|
+
```
|
84
|
+
|
85
|
+
Or if you are using ActiveRecord, the exporter class will be automatically resolved from the scope:
|
76
86
|
|
77
87
|
```ruby
|
78
|
-
|
79
|
-
|
88
|
+
Smuggle::Services::Export.call(scope: User.all)
|
89
|
+
```
|
80
90
|
|
81
|
-
|
82
|
-
@name = name
|
83
|
-
end
|
84
|
-
end
|
91
|
+
To add labels for your attributes (to show in the header instead of the raw attribute keys) you can add **attribute_labels** to your exporter:
|
85
92
|
|
86
|
-
|
93
|
+
``` ruby
|
94
|
+
class UserExporter < Smuggle::Exporter::Base
|
87
95
|
attributes :name
|
96
|
+
attribute_labels name: "Full name"
|
88
97
|
end
|
89
98
|
|
90
|
-
users = [User.new(
|
99
|
+
users = [User.new("Rick Sanchez"), User.new("Morty Smith")]
|
91
100
|
|
92
101
|
Smuggle::Services::Export.call(scope: users, exporter: UserExporter)
|
93
|
-
# => "name\
|
102
|
+
# => "Full name\nRick Sanchez\nMorty Smith\n"
|
94
103
|
```
|
95
104
|
|
96
|
-
|
105
|
+
### Importers
|
106
|
+
|
107
|
+
Give the following ActiveRecord model:
|
97
108
|
|
98
109
|
```ruby
|
99
|
-
|
110
|
+
class User < ApplicationRecord
|
111
|
+
validates :full_name, :username, presence: true
|
112
|
+
end
|
100
113
|
```
|
101
114
|
|
102
|
-
|
115
|
+
To define a importers you need to inherit from [Smuggle::Importer::Base](lib/smuggle/importer/base.rb) and define the attributes to import:
|
103
116
|
|
104
|
-
|
117
|
+
```ruby
|
118
|
+
class UserImporter < Smuggle::Importer::Base
|
119
|
+
# List all the attributes you need to import, everything else will be ignored
|
120
|
+
attributes :full_name, :username
|
105
121
|
|
106
|
-
|
107
|
-
|
108
|
-
|
122
|
+
# Computed attributes from the row data
|
123
|
+
def full_name
|
124
|
+
[row[:first_name], row[:last_name]].join(" ")
|
125
|
+
end
|
109
126
|
|
110
|
-
def
|
111
|
-
|
127
|
+
def persist
|
128
|
+
# You can implement how to persist the data anyway you prefer
|
129
|
+
# This is an example using active record
|
130
|
+
model.create(to_h)
|
131
|
+
# model.new(to_h).save(validate: false) # Another example skipping validations
|
112
132
|
end
|
113
133
|
end
|
134
|
+
```
|
114
135
|
|
115
|
-
|
116
|
-
attributes :name
|
117
|
-
attribute_labels name: 'Full name'
|
118
|
-
end
|
136
|
+
For example:
|
119
137
|
|
120
|
-
|
138
|
+
Given the following `users.csv` file:
|
139
|
+
|
140
|
+
```
|
141
|
+
"first_name","last_name","username"
|
142
|
+
"Rick","Sanchez","rsanchez"
|
143
|
+
"Morty","Smith","msmith"
|
144
|
+
"Jerry","Smith","jsmith"
|
145
|
+
```
|
146
|
+
|
147
|
+
Just run:
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
Smuggle::Services::Import.call(model: User, filepath: "users.csv")
|
151
|
+
```
|
152
|
+
|
153
|
+
The importer class will be resolved from the model name, otherwise you could explicitely set the importer like this:
|
154
|
+
|
155
|
+
```ruby
|
156
|
+
Smuggle::Services::Import.call(model: User, filepath: "users.csv", importer: UserImporter)
|
157
|
+
```
|
158
|
+
|
159
|
+
### Generators
|
160
|
+
|
161
|
+
If you are using rails you can use the following generators:
|
121
162
|
|
122
|
-
Smuggle::Services::Export.call(scope: users, exporter: UserExporter)
|
123
|
-
# => "Full name\n" + "Rick Sanchez\n" + "Morty Smith\n"
|
124
163
|
```
|
164
|
+
$ rails g smuggle:install
|
165
|
+
create app/exporters/application_exporter.rb
|
166
|
+
create app/importers/application_importer.rb
|
167
|
+
```
|
168
|
+
|
169
|
+
To generate an exporter, you can run the following command:
|
170
|
+
|
171
|
+
```
|
172
|
+
$ rails g smuggle:exporter user
|
173
|
+
create app/exporters/user_exporter.rb
|
174
|
+
```
|
175
|
+
|
176
|
+
You can also include the attributes you wish to export by running:
|
177
|
+
|
178
|
+
```
|
179
|
+
$ rails g smuggle:exporter user email username created_at
|
180
|
+
create app/exporters/user_exporter.rb
|
181
|
+
```
|
182
|
+
|
183
|
+
And to generate an importer, just run:
|
184
|
+
|
185
|
+
```
|
186
|
+
$ rails g smuggle:importer user email username full_name
|
187
|
+
create app/importers/user_importer.rb
|
188
|
+
```
|
189
|
+
|
190
|
+
## Tests
|
125
191
|
|
126
|
-
|
192
|
+
To test, run:
|
193
|
+
|
194
|
+
```
|
195
|
+
bundle exec rspec spec/
|
196
|
+
```
|
127
197
|
|
128
|
-
|
198
|
+
## Versioning
|
129
199
|
|
130
|
-
|
200
|
+
Read [Semantic Versioning](https://semver.org) for details. Briefly, it means:
|
131
201
|
|
132
|
-
-
|
202
|
+
- Major (X.y.z) - Incremented for any backwards incompatible public API changes.
|
203
|
+
- Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.
|
204
|
+
- Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.
|
133
205
|
|
134
206
|
## License
|
135
207
|
|
136
|
-
|
208
|
+
Copyright 2018 [Inspire Innovation BV](https://inspire.nl).
|
209
|
+
Read [LICENSE](LICENSE) for details.
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Smuggle
|
2
4
|
module Generators
|
3
5
|
class ExporterGenerator < Rails::Generators::NamedBase
|
4
|
-
source_root File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
5
7
|
|
6
8
|
argument :attributes, type: :array, required: false
|
7
9
|
|
8
10
|
def create_exporter
|
9
|
-
template
|
11
|
+
template "exporter.rb", File.join("app/exporters", class_path, "#{file_name}_exporter.rb")
|
10
12
|
end
|
11
13
|
end
|
12
14
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
Description:
|
2
|
+
Generates a importer for a model with the given name.
|
3
|
+
You need to pass the attributes to include in the import.
|
4
|
+
|
5
|
+
Example:
|
6
|
+
rails generate smuggle:importer user first_name last_name
|
7
|
+
|
8
|
+
This will create:
|
9
|
+
|
10
|
+
# app/importer/user_importer.rb
|
11
|
+
|
12
|
+
class UserImporter < ApplicationImporter
|
13
|
+
attributes :first_name, :last_name
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Smuggle
|
4
|
+
module Generators
|
5
|
+
class ImporterGenerator < Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
7
|
+
|
8
|
+
argument :attributes, type: :array, required: true
|
9
|
+
|
10
|
+
def create_importer
|
11
|
+
template "importer.rb", File.join("app/importers", class_path, "#{file_name}_importer.rb")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
class <%= class_name %>Importer < ApplicationImporter
|
2
|
+
<% if attributes -%>
|
3
|
+
attributes <%= attributes.map { |attribute| ":#{attribute.name}" }.join(', ') %>
|
4
|
+
<% end -%>
|
5
|
+
|
6
|
+
def persist
|
7
|
+
# Save your model here. Example using ActiveRecord:
|
8
|
+
# model.create(to_h)
|
9
|
+
raise NotImplementedError
|
10
|
+
end
|
11
|
+
end
|
@@ -1,10 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Smuggle
|
2
4
|
module Generators
|
3
5
|
class InstallGenerator < Rails::Generators::Base
|
4
|
-
source_root File.expand_path(File.join(File.dirname(__FILE__),
|
6
|
+
source_root File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
5
7
|
|
6
8
|
def copy_application_exporter
|
7
|
-
template
|
9
|
+
template "application_exporter.rb", "app/exporters/application_exporter.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
def copy_application_importer
|
13
|
+
template "application_importer.rb", "app/importers/application_importer.rb"
|
8
14
|
end
|
9
15
|
end
|
10
16
|
end
|
data/lib/smuggle.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
require 'smuggle/exporter/base'
|
3
|
-
require 'smuggle/services/export'
|
4
|
-
require 'smuggle/exporter_not_found'
|
5
|
-
require 'smuggle/engine' if defined?(Rails)
|
1
|
+
# frozen_string_literal: true
|
6
2
|
|
7
|
-
|
8
|
-
|
3
|
+
require "csv"
|
4
|
+
require "smuggle/version"
|
5
|
+
require "smuggle/errors"
|
6
|
+
require "smuggle/exporter/base"
|
7
|
+
require "smuggle/importer/base"
|
8
|
+
require "smuggle/services/export"
|
9
|
+
require "smuggle/services/import"
|
10
|
+
require "smuggle/engine" if defined?(Rails)
|
data/lib/smuggle/engine.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Smuggle
|
2
4
|
module Exporter
|
3
5
|
class Base < SimpleDelegator
|
4
6
|
class << self
|
5
|
-
|
6
|
-
|
7
|
+
attr_writer :attributes
|
8
|
+
attr_writer :attribute_labels
|
7
9
|
|
8
10
|
def inherited(base)
|
9
11
|
base.attributes = []
|
@@ -28,7 +30,8 @@ module Smuggle
|
|
28
30
|
|
29
31
|
def header
|
30
32
|
return @attributes unless attribute_labels?
|
31
|
-
|
33
|
+
|
34
|
+
@attributes.map do |attribute|
|
32
35
|
@attribute_labels.fetch(attribute, attribute)
|
33
36
|
end
|
34
37
|
end
|
@@ -43,6 +46,7 @@ module Smuggle
|
|
43
46
|
def defined_attributes
|
44
47
|
return self.class.attributes if self.class.attributes?
|
45
48
|
return attribute_names if __getobj__.respond_to?(:attribute_names)
|
49
|
+
|
46
50
|
keys if __getobj__.respond_to?(:keys)
|
47
51
|
end
|
48
52
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Smuggle
|
4
|
+
module Importer
|
5
|
+
class Base
|
6
|
+
class << self
|
7
|
+
attr_writer :attributes
|
8
|
+
|
9
|
+
def inherited(base)
|
10
|
+
base.attributes = []
|
11
|
+
end
|
12
|
+
|
13
|
+
def attributes(*names)
|
14
|
+
@attributes.concat names
|
15
|
+
end
|
16
|
+
|
17
|
+
def attributes?
|
18
|
+
@attributes.any?
|
19
|
+
end
|
20
|
+
|
21
|
+
def csv_converters
|
22
|
+
Hash(header_converters: :symbol, converters: %i[all])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
attr_reader :row, :model
|
27
|
+
|
28
|
+
def initialize(row, model)
|
29
|
+
@model = model
|
30
|
+
@row = row
|
31
|
+
end
|
32
|
+
|
33
|
+
def persist
|
34
|
+
raise NotImplementedError
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_h
|
38
|
+
defined_attributes.each_with_object({}) do |attribute, hash|
|
39
|
+
hash[attribute.to_sym] = respond_to?(attribute) ? public_send(attribute) : row[attribute.to_sym]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def defined_attributes
|
44
|
+
return self.class.attributes if self.class.attributes?
|
45
|
+
|
46
|
+
model.attribute_names if model.respond_to?(:attribute_names)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Smuggle
|
4
4
|
module Services
|
@@ -14,8 +14,8 @@ module Smuggle
|
|
14
14
|
attr_reader :scope
|
15
15
|
|
16
16
|
def initialize(scope, options = {})
|
17
|
-
@scope = scope
|
18
17
|
@exporter = options[:exporter]
|
18
|
+
@scope = scope
|
19
19
|
end
|
20
20
|
|
21
21
|
def call
|
@@ -23,8 +23,8 @@ module Smuggle
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def resolve
|
26
|
-
"#{scope.name
|
27
|
-
rescue
|
26
|
+
Object.const_get("#{scope.name}Exporter")
|
27
|
+
rescue NameError
|
28
28
|
raise ExporterNotFound
|
29
29
|
end
|
30
30
|
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Smuggle
|
4
|
+
module Services
|
5
|
+
class Import
|
6
|
+
class << self
|
7
|
+
def call(model:, filepath:, **options)
|
8
|
+
new(model, filepath, options).send(:call)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
attr_reader :model, :filepath
|
15
|
+
|
16
|
+
def initialize(model, filepath, options = {})
|
17
|
+
@filepath = filepath
|
18
|
+
@importer = options[:importer]
|
19
|
+
@model = model
|
20
|
+
end
|
21
|
+
|
22
|
+
def call
|
23
|
+
import_from_csv
|
24
|
+
end
|
25
|
+
|
26
|
+
def resolve
|
27
|
+
Object.const_get("#{model.name}Importer")
|
28
|
+
rescue NameError
|
29
|
+
raise ImporterNotFound
|
30
|
+
end
|
31
|
+
|
32
|
+
def importer
|
33
|
+
@importer || resolve
|
34
|
+
end
|
35
|
+
|
36
|
+
def import_from_csv
|
37
|
+
CSV.read(filepath, headers: true, **importer.csv_converters).map do |row|
|
38
|
+
importer.new(row, model).persist
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/smuggle/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smuggle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Crivella
|
8
|
+
- InspireNL
|
8
9
|
autorequire:
|
9
|
-
bindir:
|
10
|
+
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2018-
|
12
|
+
date: 2018-09-10 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -25,33 +26,33 @@ dependencies:
|
|
25
26
|
- !ruby/object:Gem::Version
|
26
27
|
version: '1.15'
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
29
|
+
name: faker
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
30
31
|
requirements:
|
31
32
|
- - "~>"
|
32
33
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
34
|
+
version: '1.8'
|
34
35
|
type: :development
|
35
36
|
prerelease: false
|
36
37
|
version_requirements: !ruby/object:Gem::Requirement
|
37
38
|
requirements:
|
38
39
|
- - "~>"
|
39
40
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
41
|
+
version: '1.8'
|
41
42
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
43
|
+
name: pry
|
43
44
|
requirement: !ruby/object:Gem::Requirement
|
44
45
|
requirements:
|
45
46
|
- - "~>"
|
46
47
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
+
version: '0.10'
|
48
49
|
type: :development
|
49
50
|
prerelease: false
|
50
51
|
version_requirements: !ruby/object:Gem::Requirement
|
51
52
|
requirements:
|
52
53
|
- - "~>"
|
53
54
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
55
|
+
version: '0.10'
|
55
56
|
- !ruby/object:Gem::Dependency
|
56
57
|
name: pry-byebug
|
57
58
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,84 +68,126 @@ dependencies:
|
|
67
68
|
- !ruby/object:Gem::Version
|
68
69
|
version: '3.5'
|
69
70
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
71
|
+
name: rake
|
71
72
|
requirement: !ruby/object:Gem::Requirement
|
72
73
|
requirements:
|
73
74
|
- - "~>"
|
74
75
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
76
|
+
version: '12.3'
|
76
77
|
type: :development
|
77
78
|
prerelease: false
|
78
79
|
version_requirements: !ruby/object:Gem::Requirement
|
79
80
|
requirements:
|
80
81
|
- - "~>"
|
81
82
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
83
|
+
version: '12.3'
|
83
84
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
85
|
+
name: rspec
|
85
86
|
requirement: !ruby/object:Gem::Requirement
|
86
87
|
requirements:
|
87
88
|
- - "~>"
|
88
89
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
90
|
+
version: '3.0'
|
90
91
|
type: :development
|
91
92
|
prerelease: false
|
92
93
|
version_requirements: !ruby/object:Gem::Requirement
|
93
94
|
requirements:
|
94
95
|
- - "~>"
|
95
96
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
97
|
+
version: '3.0'
|
97
98
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
99
|
+
name: rspec_junit_formatter
|
99
100
|
requirement: !ruby/object:Gem::Requirement
|
100
101
|
requirements:
|
101
102
|
- - "~>"
|
102
103
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
104
|
+
version: '0.4'
|
104
105
|
type: :development
|
105
106
|
prerelease: false
|
106
107
|
version_requirements: !ruby/object:Gem::Requirement
|
107
108
|
requirements:
|
108
109
|
- - "~>"
|
109
110
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
111
|
-
|
111
|
+
version: '0.4'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rubocop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0.59'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.59'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop-rspec
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - "~>"
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '1.29'
|
133
|
+
type: :development
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - "~>"
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '1.29'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: simplecov
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0.16'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0.16'
|
154
|
+
description:
|
112
155
|
email:
|
113
156
|
- pablocrivella@gmail.com
|
157
|
+
- info@inspire.nl
|
114
158
|
executables: []
|
115
159
|
extensions: []
|
116
|
-
extra_rdoc_files:
|
160
|
+
extra_rdoc_files:
|
161
|
+
- README.md
|
162
|
+
- LICENSE
|
117
163
|
files:
|
118
|
-
- ".editorconfig"
|
119
|
-
- ".gitignore"
|
120
|
-
- ".rspec"
|
121
|
-
- ".rubocop.yml"
|
122
|
-
- ".travis.yml"
|
123
|
-
- CHANGELOG.md
|
124
|
-
- CODE_OF_CONDUCT.md
|
125
|
-
- Gemfile
|
126
164
|
- LICENSE
|
127
165
|
- README.md
|
128
|
-
- Rakefile
|
129
|
-
- bin/console
|
130
|
-
- bin/setup
|
131
166
|
- lib/generators/smuggle/exporter/USAGE
|
132
167
|
- lib/generators/smuggle/exporter/exporter_generator.rb
|
133
168
|
- lib/generators/smuggle/exporter/templates/exporter.rb
|
169
|
+
- lib/generators/smuggle/importer/USAGE
|
170
|
+
- lib/generators/smuggle/importer/importer_generator.rb
|
171
|
+
- lib/generators/smuggle/importer/templates/importer.rb
|
134
172
|
- lib/generators/smuggle/install/USAGE
|
135
173
|
- lib/generators/smuggle/install/install_generator.rb
|
136
174
|
- lib/generators/smuggle/install/templates/application_exporter.rb
|
175
|
+
- lib/generators/smuggle/install/templates/application_importer.rb
|
137
176
|
- lib/smuggle.rb
|
138
177
|
- lib/smuggle/engine.rb
|
178
|
+
- lib/smuggle/errors.rb
|
139
179
|
- lib/smuggle/exporter/base.rb
|
140
|
-
- lib/smuggle/
|
180
|
+
- lib/smuggle/importer/base.rb
|
141
181
|
- lib/smuggle/services/export.rb
|
182
|
+
- lib/smuggle/services/import.rb
|
142
183
|
- lib/smuggle/version.rb
|
143
|
-
|
144
|
-
homepage: https://github.com/pablocrivella/smuggle
|
184
|
+
homepage: https://github.com/InspireNL/smuggle
|
145
185
|
licenses:
|
146
186
|
- MIT
|
147
|
-
metadata:
|
187
|
+
metadata:
|
188
|
+
bug_tracker_uri: https://github.com/InspireNL/smuggle/issues
|
189
|
+
changelog_uri: https://github.com/InspireNL/smuggle/blob/master/CHANGELOG.md
|
190
|
+
source_code_uri: https://github.com/InspireNL/smuggle
|
148
191
|
post_install_message:
|
149
192
|
rdoc_options: []
|
150
193
|
require_paths:
|
@@ -164,5 +207,5 @@ rubyforge_project:
|
|
164
207
|
rubygems_version: 2.7.7
|
165
208
|
signing_key:
|
166
209
|
specification_version: 4
|
167
|
-
summary: It
|
210
|
+
summary: It exports and imports all kinds of stuff from and to CSV
|
168
211
|
test_files: []
|
data/.editorconfig
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
root = true
|
2
|
-
|
3
|
-
[*]
|
4
|
-
indent_style = tab
|
5
|
-
end_of_line = lf
|
6
|
-
charset = utf-8
|
7
|
-
trim_trailing_whitespace = true
|
8
|
-
insert_final_newline = true
|
9
|
-
indent_style = space
|
10
|
-
indent_size = 2
|
11
|
-
|
12
|
-
[*.scss]
|
13
|
-
indent_style = space
|
14
|
-
indent_size = 2
|
15
|
-
|
16
|
-
[*.js]
|
17
|
-
indent_style = space
|
18
|
-
indent_size = 2
|
19
|
-
|
20
|
-
[Rakefile]
|
21
|
-
indent_style = space
|
22
|
-
indent_size = 2
|
23
|
-
|
24
|
-
[Gemfile*]
|
25
|
-
indent_style = space
|
26
|
-
indent_size = 2
|
27
|
-
|
28
|
-
[config.ru]
|
29
|
-
indent_style = space
|
30
|
-
indent_size = 2
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
Include:
|
3
|
-
- Gemfile
|
4
|
-
Exclude:
|
5
|
-
- vendor/ruby/**/*
|
6
|
-
- lib/generators/**/*
|
7
|
-
TargetRubyVersion: 2.4
|
8
|
-
|
9
|
-
Layout/SpaceBeforeFirstArg:
|
10
|
-
Enabled: false
|
11
|
-
|
12
|
-
Metrics/AbcSize:
|
13
|
-
Max: 25
|
14
|
-
|
15
|
-
Metrics/CyclomaticComplexity:
|
16
|
-
Max: 10
|
17
|
-
|
18
|
-
Metrics/LineLength:
|
19
|
-
Enabled: true
|
20
|
-
Max: 125
|
21
|
-
|
22
|
-
Metrics/MethodLength:
|
23
|
-
Max: 25
|
24
|
-
|
25
|
-
Metrics/BlockLength:
|
26
|
-
Exclude:
|
27
|
-
- spec/**/*
|
28
|
-
- '*.gemspec'
|
29
|
-
|
30
|
-
Layout/AlignHash:
|
31
|
-
EnforcedLastArgumentHashStyle: ignore_implicit
|
32
|
-
|
33
|
-
Layout/AlignParameters:
|
34
|
-
EnforcedStyle: with_fixed_indentation
|
35
|
-
|
36
|
-
Layout/MultilineMethodCallIndentation:
|
37
|
-
EnforcedStyle: indented
|
38
|
-
|
39
|
-
Layout/MultilineOperationIndentation:
|
40
|
-
EnforcedStyle: indented
|
41
|
-
|
42
|
-
Style/ClassAndModuleChildren:
|
43
|
-
EnforcedStyle: nested
|
44
|
-
|
45
|
-
Style/Documentation:
|
46
|
-
Enabled: false
|
47
|
-
|
48
|
-
Style/FileName:
|
49
|
-
Enabled: false
|
50
|
-
|
51
|
-
Style/FormatString:
|
52
|
-
EnforcedStyle: sprintf
|
53
|
-
|
54
|
-
Style/EmptyMethod:
|
55
|
-
EnforcedStyle: expanded
|
56
|
-
|
57
|
-
Style/RegexpLiteral:
|
58
|
-
EnforcedStyle: mixed
|
59
|
-
|
60
|
-
Style/StringLiterals:
|
61
|
-
EnforcedStyle: single_quotes
|
62
|
-
|
63
|
-
Style/StringLiteralsInInterpolation:
|
64
|
-
EnforcedStyle: single_quotes
|
65
|
-
|
66
|
-
Style/TrivialAccessors:
|
67
|
-
AllowPredicates: true
|
68
|
-
AllowDSLWriters: true
|
69
|
-
|
70
|
-
Style/FrozenStringLiteralComment:
|
71
|
-
Enabled: false
|
data/.travis.yml
DELETED
data/CHANGELOG.md
DELETED
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at pablocrivella@gmail.com. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'smuggle'
|
5
|
-
require 'faker'
|
6
|
-
require 'factory_girl'
|
7
|
-
require 'pry'
|
8
|
-
require_relative '../spec/support/user.rb'
|
9
|
-
require_relative '../spec/support/exporters/with_attributes.rb'
|
10
|
-
require_relative '../spec/support/exporters/without_attributes.rb'
|
11
|
-
|
12
|
-
FactoryGirl.find_definitions
|
13
|
-
Pry.start
|
data/bin/setup
DELETED
data/smuggle.gemspec
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
|
3
|
-
lib = File.expand_path('../lib', __FILE__)
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
-
require 'smuggle/version'
|
6
|
-
|
7
|
-
Gem::Specification.new do |spec|
|
8
|
-
spec.name = 'smuggle'
|
9
|
-
spec.version = Smuggle::VERSION
|
10
|
-
spec.authors = ['Pablo Crivella']
|
11
|
-
spec.email = ['pablocrivella@gmail.com']
|
12
|
-
|
13
|
-
spec.summary = %q{It Exports stuff to CSV}
|
14
|
-
spec.description = %q{It Exports all kind of stuff to CSV}
|
15
|
-
spec.homepage = 'https://github.com/pablocrivella/smuggle'
|
16
|
-
spec.license = 'MIT'
|
17
|
-
|
18
|
-
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
19
|
-
f.match(%r{^(test|spec|features)/})
|
20
|
-
end
|
21
|
-
spec.bindir = 'exe'
|
22
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
|
-
spec.require_paths = ['lib']
|
24
|
-
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1.15'
|
26
|
-
spec.add_development_dependency 'factory_girl', '~> 4.0'
|
27
|
-
spec.add_development_dependency 'faker', '~> 1.8'
|
28
|
-
spec.add_development_dependency 'pry-byebug', '~> 3.5'
|
29
|
-
spec.add_development_dependency 'pry', '~> 0.10'
|
30
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
31
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
32
|
-
end
|