contentful-importer 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +38 -0
- data/.rspec +3 -0
- data/.travis.yml +8 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +87 -0
- data/LICENSE +22 -0
- data/README.md +327 -0
- data/Rakefile +7 -0
- data/bin/contentful-importer +85 -0
- data/contentful_importer.gemspec +38 -0
- data/example_settings/contentful_model.json +288 -0
- data/example_settings/contentful_structure.json +78 -0
- data/example_settings/files_meaning.txt +15 -0
- data/example_settings/settings.yml +16 -0
- data/lib/cli.rb +13 -0
- data/lib/configuration.rb +36 -0
- data/lib/converters/content_types_structure_creator.rb +60 -0
- data/lib/converters/contentful_model_to_json.rb +109 -0
- data/lib/importer/data_organizer.rb +117 -0
- data/lib/importer/mime_content_type.rb +564 -0
- data/lib/importer/parallel_importer.rb +429 -0
- data/lib/json_schema_validator.rb +64 -0
- data/lib/migrator.rb +39 -0
- data/lib/version.rb +3 -0
- data/spec/fixtures/import_files/assets/image/image_1.json +9 -0
- data/spec/fixtures/import_files/assets/image/image_2.json +9 -0
- data/spec/fixtures/import_files/assets/image/image_3.json +9 -0
- data/spec/fixtures/import_files/assets/image/image_4.json +9 -0
- data/spec/fixtures/import_files/collections/job_skills.json +13 -0
- data/spec/fixtures/import_files/collections/jobs.json +37 -0
- data/spec/fixtures/import_files/collections/profile.json +19 -0
- data/spec/fixtures/import_files/collections/user.json +36 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_1.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_10.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_2.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_3.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_4.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_5.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_6.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_7.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_8.json +7 -0
- data/spec/fixtures/import_files/entries/job_skills/job_skills_9.json +7 -0
- data/spec/fixtures/import_files/entries/jobs/jobs_1.json +56 -0
- data/spec/fixtures/import_files/entries/jobs/jobs_2.json +55 -0
- data/spec/fixtures/import_files/entries/jobs/jobs_4.json +49 -0
- data/spec/fixtures/import_files/entries/profile/profile_1.json +12 -0
- data/spec/fixtures/import_files/entries/profile/profile_2.json +12 -0
- data/spec/fixtures/import_files/entries/user/user_1.json +24 -0
- data/spec/fixtures/import_files/entries/user/user_2.json +20 -0
- data/spec/fixtures/import_files/logs/log_published_assets.csv +4 -0
- data/spec/fixtures/import_files/logs/log_published_entries.csv +23 -0
- data/spec/fixtures/import_files/logs/success_assets.csv +4 -0
- data/spec/fixtures/import_files/logs/success_published_assets.csv +0 -0
- data/spec/fixtures/import_files/logs/success_published_entries.csv +22 -0
- data/spec/fixtures/import_files/logs/success_thread_0.csv +12 -0
- data/spec/fixtures/import_files/logs/success_thread_1.csv +11 -0
- data/spec/fixtures/import_files/threads/0/1TVvxCqoRq0qUYAOQuOqys_2.json +20 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_1.json +7 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_10.json +7 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_2.json +7 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_3.json +7 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_4.json +7 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_5.json +7 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_6.json +7 -0
- data/spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_7.json +7 -0
- data/spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_1.json +9 -0
- data/spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_2.json +9 -0
- data/spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_3.json +9 -0
- data/spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_4.json +9 -0
- data/spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_5.json +9 -0
- data/spec/fixtures/import_files/threads/1/1TVvxCqoRq0qUYAOQuOqys_1.json +24 -0
- data/spec/fixtures/import_files/threads/1/1TVvxCqoRq0qUYAOQuOqys_2.json +20 -0
- data/spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_6.json +7 -0
- data/spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_7.json +7 -0
- data/spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_8.json +7 -0
- data/spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_9.json +7 -0
- data/spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_1.json +56 -0
- data/spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_2.json +55 -0
- data/spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_4.json +49 -0
- data/spec/fixtures/import_files/threads/1/4WFZh4MwC4Mc0EQWAeOY8A_1.json +12 -0
- data/spec/fixtures/import_files/threads/1/4WFZh4MwC4Mc0EQWAeOY8A_2.json +12 -0
- data/spec/fixtures/import_files/threads/assets/0/image_1.json +9 -0
- data/spec/fixtures/import_files/threads/assets/0/image_2.json +9 -0
- data/spec/fixtures/import_files/threads/assets/0/image_3.json +9 -0
- data/spec/fixtures/import_files/threads/assets/0/image_4.json +9 -0
- data/spec/fixtures/settings/contentful_model.json +252 -0
- data/spec/fixtures/settings/contentful_structure.json +73 -0
- data/spec/fixtures/settings/contentful_structure_test.json +66 -0
- data/spec/fixtures/settings/settings.yml +12 -0
- data/spec/fixtures/vcr_cassettes/create_asset.yml +621 -0
- data/spec/fixtures/vcr_cassettes/create_entry.yml +122 -0
- data/spec/fixtures/vcr_cassettes/create_space.yml +87 -0
- data/spec/fixtures/vcr_cassettes/import_assets.yml +2822 -0
- data/spec/fixtures/vcr_cassettes/import_content_types.yml +1915 -0
- data/spec/fixtures/vcr_cassettes/import_entries.yml +5066 -0
- data/spec/fixtures/vcr_cassettes/import_entry.yml +363 -0
- data/spec/fixtures/vcr_cassettes/invalid_credentials.yml +69 -0
- data/spec/fixtures/vcr_cassettes/publish_an_entry.yml +214 -0
- data/spec/fixtures/vcr_cassettes/publish_asset.yml +895 -0
- data/spec/fixtures/vcr_cassettes/publish_entries.yml +5121 -0
- data/spec/fixtures/vcr_cassettes/valid_credentials.yml +7360 -0
- data/spec/lib/configuration_spec.rb +22 -0
- data/spec/lib/importer/parallel_importer_spec.rb +161 -0
- data/spec/lib/json_schema_validator_spec.rb +63 -0
- data/spec/lib/migrator_spec.rb +99 -0
- data/spec/spec_helper.rb +12 -0
- data/spec/support/db_rows_json.rb +9 -0
- data/spec/support/shared_configuration.rb +22 -0
- data/spec/support/vcr.rb +16 -0
- metadata +436 -0
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"id": "user_1",
|
3
|
+
"first_name": "FirstName",
|
4
|
+
"last_name": "LastName",
|
5
|
+
"birthday": "2009-04-16T09:43:00+00:00",
|
6
|
+
"created_at": "2014-12-16T09:43:43+00:00",
|
7
|
+
"updated_at": "2014-12-16T09:43:43+00:00",
|
8
|
+
"database_id": 1,
|
9
|
+
"custom_nick": "Nickname 1",
|
10
|
+
"profile": {
|
11
|
+
"type": "profile",
|
12
|
+
"id": "profile_1"
|
13
|
+
},
|
14
|
+
"job_adds": [
|
15
|
+
{
|
16
|
+
"type": "jobs",
|
17
|
+
"id": "jobs_1"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type": "jobs",
|
21
|
+
"id": "jobs_2"
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"id": "user_2",
|
3
|
+
"first_name": "FirstName User 2",
|
4
|
+
"last_name": "LastName User 2",
|
5
|
+
"birthday": "2014-12-16T09:43:00+00:00",
|
6
|
+
"created_at": "2014-12-16T09:45:08+00:00",
|
7
|
+
"updated_at": "2014-12-16T09:45:08+00:00",
|
8
|
+
"database_id": 2,
|
9
|
+
"custom_nick": "Nickname 2",
|
10
|
+
"profile": {
|
11
|
+
"type": "profile",
|
12
|
+
"id": "profile_2"
|
13
|
+
},
|
14
|
+
"job_adds": [
|
15
|
+
{
|
16
|
+
"type": "jobs",
|
17
|
+
"id": "jobs_4"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
job_skills_1
|
2
|
+
user_1
|
3
|
+
user_2
|
4
|
+
job_skills_10
|
5
|
+
job_skills_6
|
6
|
+
job_skills_2
|
7
|
+
job_skills_7
|
8
|
+
job_skills_3
|
9
|
+
job_skills_8
|
10
|
+
job_skills_4
|
11
|
+
job_skills_9
|
12
|
+
job_skills_5
|
13
|
+
jobs_1
|
14
|
+
comment_1
|
15
|
+
jobs_2
|
16
|
+
comment_2
|
17
|
+
jobs_4
|
18
|
+
comment_3
|
19
|
+
comment_4
|
20
|
+
profile_1
|
21
|
+
profile_2
|
22
|
+
comment_5
|
23
|
+
comment_5
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
user_1
|
2
|
+
job_skills_1
|
3
|
+
user_2
|
4
|
+
job_skills_10
|
5
|
+
job_skills_6
|
6
|
+
job_skills_2
|
7
|
+
job_skills_7
|
8
|
+
job_skills_3
|
9
|
+
job_skills_8
|
10
|
+
job_skills_4
|
11
|
+
job_skills_9
|
12
|
+
job_skills_5
|
13
|
+
jobs_1
|
14
|
+
comment_1
|
15
|
+
jobs_2
|
16
|
+
comment_2
|
17
|
+
jobs_4
|
18
|
+
comment_3
|
19
|
+
profile_1
|
20
|
+
comment_4
|
21
|
+
profile_2
|
22
|
+
comment_5
|
@@ -0,0 +1,12 @@
|
|
1
|
+
2soCP557HGKoOOK0SqmMOm_1.json
|
2
|
+
2soCP557HGKoOOK0SqmMOm_10.json
|
3
|
+
2soCP557HGKoOOK0SqmMOm_2.json
|
4
|
+
2soCP557HGKoOOK0SqmMOm_3.json
|
5
|
+
2soCP557HGKoOOK0SqmMOm_4.json
|
6
|
+
2soCP557HGKoOOK0SqmMOm_5.json
|
7
|
+
6H6pGAV1PUsuoAW26Iu48W_1.json
|
8
|
+
6H6pGAV1PUsuoAW26Iu48W_2.json
|
9
|
+
6H6pGAV1PUsuoAW26Iu48W_3.json
|
10
|
+
6H6pGAV1PUsuoAW26Iu48W_4.json
|
11
|
+
6H6pGAV1PUsuoAW26Iu48W_5.json
|
12
|
+
file_path
|
@@ -0,0 +1,11 @@
|
|
1
|
+
1TVvxCqoRq0qUYAOQuOqys_1.json
|
2
|
+
1TVvxCqoRq0qUYAOQuOqys_2.json
|
3
|
+
2soCP557HGKoOOK0SqmMOm_6.json
|
4
|
+
2soCP557HGKoOOK0SqmMOm_7.json
|
5
|
+
2soCP557HGKoOOK0SqmMOm_8.json
|
6
|
+
2soCP557HGKoOOK0SqmMOm_9.json
|
7
|
+
4L1bg4WQ5aWQMiE82ouag_1.json
|
8
|
+
4L1bg4WQ5aWQMiE82ouag_2.json
|
9
|
+
4L1bg4WQ5aWQMiE82ouag_4.json
|
10
|
+
4WFZh4MwC4Mc0EQWAeOY8A_1.json
|
11
|
+
4WFZh4MwC4Mc0EQWAeOY8A_2.json
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"id": "user_2",
|
3
|
+
"first_name": "FirstName User 2",
|
4
|
+
"last_name": "LastName User 2",
|
5
|
+
"birthday": "2014-12-16T09:43:00+00:00",
|
6
|
+
"created_at": "2014-12-16T09:45:08+00:00",
|
7
|
+
"updated_at": "2014-12-16T09:45:08+00:00",
|
8
|
+
"database_id": 2,
|
9
|
+
"custom_nick": "Nickname 2",
|
10
|
+
"profile": {
|
11
|
+
"type": "profile",
|
12
|
+
"id": "profile_2"
|
13
|
+
},
|
14
|
+
"job_adds": [
|
15
|
+
{
|
16
|
+
"type": "jobs",
|
17
|
+
"id": "jobs_4"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"id": "user_1",
|
3
|
+
"first_name": "FirstName",
|
4
|
+
"last_name": "LastName",
|
5
|
+
"birthday": "2009-04-16T09:43:00+00:00",
|
6
|
+
"created_at": "2014-12-16T09:43:43+00:00",
|
7
|
+
"updated_at": "2014-12-16T09:43:43+00:00",
|
8
|
+
"database_id": 1,
|
9
|
+
"custom_nick": "Nickname 1",
|
10
|
+
"profile": {
|
11
|
+
"type": "profile",
|
12
|
+
"id": "profile_1"
|
13
|
+
},
|
14
|
+
"job_adds": [
|
15
|
+
{
|
16
|
+
"type": "jobs",
|
17
|
+
"id": "jobs_1"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
"type": "jobs",
|
21
|
+
"id": "jobs_2"
|
22
|
+
}
|
23
|
+
]
|
24
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"id": "user_2",
|
3
|
+
"first_name": "FirstName User 2",
|
4
|
+
"last_name": "LastName User 2",
|
5
|
+
"birthday": "2014-12-16T09:43:00+00:00",
|
6
|
+
"created_at": "2014-12-16T09:45:08+00:00",
|
7
|
+
"updated_at": "2014-12-16T09:45:08+00:00",
|
8
|
+
"database_id": 2,
|
9
|
+
"custom_nick": "Nickname 2",
|
10
|
+
"profile": {
|
11
|
+
"type": "profile",
|
12
|
+
"id": "profile_2"
|
13
|
+
},
|
14
|
+
"job_adds": [
|
15
|
+
{
|
16
|
+
"type": "jobs",
|
17
|
+
"id": "jobs_4"
|
18
|
+
}
|
19
|
+
]
|
20
|
+
}
|
@@ -0,0 +1,56 @@
|
|
1
|
+
{
|
2
|
+
"id": "jobs_1",
|
3
|
+
"name": "First new Job",
|
4
|
+
"specification": "Job description",
|
5
|
+
"created_at": "2014-12-16T10:26:03+00:00",
|
6
|
+
"updated_at": "2014-12-16T10:26:03+00:00",
|
7
|
+
"image_id": 3,
|
8
|
+
"user_id": 1,
|
9
|
+
"database_id": 1,
|
10
|
+
"first_name": "FirstName",
|
11
|
+
"subjects_comments": [
|
12
|
+
"Title comment 1",
|
13
|
+
"Title comment 2",
|
14
|
+
"Title comment 3"
|
15
|
+
],
|
16
|
+
"image": {
|
17
|
+
"type": "File",
|
18
|
+
"id": "image_3"
|
19
|
+
},
|
20
|
+
"creator": {
|
21
|
+
"type": "Entry",
|
22
|
+
"id": "user_1"
|
23
|
+
},
|
24
|
+
"comments": [
|
25
|
+
{
|
26
|
+
"type": "comment",
|
27
|
+
"id": "comment_1"
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"type": "comment",
|
31
|
+
"id": "comment_2"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"type": "comment",
|
35
|
+
"id": "comment_3"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
"skills": [
|
39
|
+
{
|
40
|
+
"type": "job_skills",
|
41
|
+
"id": "job_skills_1"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"type": "job_skills",
|
45
|
+
"id": "job_skills_3"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"type": "job_skills",
|
49
|
+
"id": "job_skills_8"
|
50
|
+
},
|
51
|
+
{
|
52
|
+
"type": "job_skills",
|
53
|
+
"id": "job_skills_10"
|
54
|
+
}
|
55
|
+
]
|
56
|
+
}
|