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,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/configuration'
|
3
|
+
|
4
|
+
module Contentful
|
5
|
+
describe Configuration do
|
6
|
+
|
7
|
+
include_context 'shared_configuration'
|
8
|
+
|
9
|
+
it 'initialize' do
|
10
|
+
expect(@config.data_dir).to eq 'spec/fixtures/import_files'
|
11
|
+
expect(@config.collections_dir).to eq 'spec/fixtures/import_files/collections'
|
12
|
+
expect(@config.assets_dir).to eq 'spec/fixtures/import_files/assets'
|
13
|
+
expect(@config.entries_dir).to eq 'spec/fixtures/import_files/entries'
|
14
|
+
expect(@config.log_files_dir).to eq 'spec/fixtures/import_files/logs'
|
15
|
+
expect(@config.threads_dir).to eq 'spec/fixtures/import_files/threads'
|
16
|
+
expect(@config.imported_entries).to be_empty
|
17
|
+
expect(@config.published_entries).to be_empty
|
18
|
+
expect(@config.published_assets).to be_empty
|
19
|
+
expect(@config.space_id).to eq 'ip17s12q0ek4'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/importer/parallel_importer'
|
3
|
+
require './lib/configuration'
|
4
|
+
|
5
|
+
module Contentful
|
6
|
+
describe ParallelImporter do
|
7
|
+
|
8
|
+
include_context 'shared_configuration'
|
9
|
+
|
10
|
+
before do
|
11
|
+
@importer = ParallelImporter.new(@config)
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
it 'number of threads' do
|
16
|
+
number = @importer.number_of_threads
|
17
|
+
expect(number).to eq 2
|
18
|
+
end
|
19
|
+
|
20
|
+
it 'create_asset_file' do
|
21
|
+
file = @importer.create_asset_file('title', {'url' => 'www.example.com/photo.png'})
|
22
|
+
expect(file).to be_a Contentful::Management::File
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'get_id' do
|
26
|
+
id = @importer.send(:get_id, {'id' => 'name.png'})
|
27
|
+
expect(id).to eq 'name.png'
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'asset_status' do
|
31
|
+
it 'successfully imported' do
|
32
|
+
allow(CSV).to receive(:open).with('spec/fixtures/import_files/logs/success_assets.csv', 'a')
|
33
|
+
asset_file = Contentful::Management::Asset.new
|
34
|
+
asset_file.id = 'test_id'
|
35
|
+
expect_any_instance_of(Contentful::Management::Asset).to receive(:process_file)
|
36
|
+
@importer.asset_status(asset_file, {'url' => 'www.example.com/photo.png'})
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'publish an entry' do
|
41
|
+
vcr('publish_an_entry') do
|
42
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:publish_status).with(Contentful::Management::Entry,
|
43
|
+
'comment_5',
|
44
|
+
'published_entries')
|
45
|
+
@importer.publish_entry('comment_5')
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'import_entry' do
|
50
|
+
vcr('import_entry') do
|
51
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:import_status).with(Contentful::Management::Entry, './spec/fixtures/import_files/entries/job_skills/job_skills_1.json', 'success_thread_0')
|
52
|
+
expect(Contentful::Management::Entry.find('ip17s12q0ek4', 'job_skills_1')).to be_a Contentful::Management::NotFound
|
53
|
+
@importer.send(:import_entry, './spec/fixtures/import_files/entries/job_skills/job_skills_1.json', 'ip17s12q0ek4', '2soCP557HGKoOOK0SqmMOm', 'success_thread_0')
|
54
|
+
entry = Contentful::Management::Entry.find('ip17s12q0ek4', 'job_skills_1')
|
55
|
+
expect(entry).to be_a Contentful::Management::Entry
|
56
|
+
expect(entry.id).to eq 'job_skills_1'
|
57
|
+
expect(entry.name).to eq 'Commercial awareness'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
context 'import_status' do
|
62
|
+
it 'successfully imported' do
|
63
|
+
allow(CSV).to receive(:open).with('spec/fixtures/import_files/logs/success_thread_0.csv', 'a')
|
64
|
+
allow(File).to receive(:basename).with('file_path')
|
65
|
+
entry = Contentful::Management::Entry.new
|
66
|
+
@importer.send(:import_status, entry, 'file_path', 'success_thread_0')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'create space' do
|
71
|
+
vcr('create_space') do
|
72
|
+
space = @importer.send(:create_space, 'rspec_test_space')
|
73
|
+
expect(space).to be_a Contentful::Management::Space
|
74
|
+
expect(space.name).to eq 'rspec_test_space'
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it 'create entry' do
|
79
|
+
vcr('create_entry') do
|
80
|
+
entry = @importer.send(:create_entry, {'id' => 'entry_id'}, 'ip17s12q0ek4', '6H6pGAV1PUsuoAW26Iu48W')
|
81
|
+
expect(entry).to be_a Contentful::Management::Entry
|
82
|
+
expect(entry.id).to eq 'entry_id'
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
it 'create asset' do
|
87
|
+
vcr('create_asset') do
|
88
|
+
asset = @importer.send(:create_asset, 'ip17s12q0ek4', {'id' => 'asset_id'})
|
89
|
+
expect(asset).to be_a Contentful::Management::Asset
|
90
|
+
expect(asset.id).to eq 'asset_id'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'create location file' do
|
95
|
+
file = @importer.send(:create_location_file, {'lat' => 'lat_v', 'lng' => 'lng_v'})
|
96
|
+
expect(file).to be_a Contentful::Management::Location
|
97
|
+
end
|
98
|
+
|
99
|
+
context 'validate_params' do
|
100
|
+
it 'Array type' do
|
101
|
+
result = @importer.send(:validate_param, [])
|
102
|
+
expect(result).to be true
|
103
|
+
end
|
104
|
+
it 'Other type' do
|
105
|
+
result = @importer.send(:validate_param, 'value')
|
106
|
+
expect(result).to be false
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
context 'create_entry_parameters' do
|
111
|
+
it 'Hash' do
|
112
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:validate_param) { true }
|
113
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:parse_attributes_from_hash).with({'k' => 'v'}, 'space_id', 'content_type_id')
|
114
|
+
@importer.send(:create_entry_parameters, 'content_type_id', {'Hash' => {'k' => 'v'}}, 'space_id')
|
115
|
+
end
|
116
|
+
it 'Array' do
|
117
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:validate_param) { true }
|
118
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:parse_attributes_from_array).with(['Value'], 'space_id', 'content_type_id')
|
119
|
+
@importer.send(:create_entry_parameters, 'content_type_id', {'Array' => ['Value']}, 'space_id')
|
120
|
+
end
|
121
|
+
it 'String' do
|
122
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:validate_param) { true }
|
123
|
+
@importer.send(:create_entry_parameters, 'content_type_id', {'key' => 'value'}, 'space_id')
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
context 'parse_attributes_from_hash' do
|
128
|
+
it 'Location' do
|
129
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:create_location_file).with({'type' => 'Location'})
|
130
|
+
@importer.send(:parse_attributes_from_hash, {'type' => 'Location'}, 'space_id', 'content_type_id')
|
131
|
+
end
|
132
|
+
it 'File' do
|
133
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:create_asset).with('space_id', {'type' => 'File'})
|
134
|
+
@importer.send(:parse_attributes_from_hash, {'type' => 'File'}, 'space_id', 'content_type_id')
|
135
|
+
end
|
136
|
+
it 'Entry' do
|
137
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:create_entry).with({'type' => 'Entry'}, 'space_id', 'content_type_id')
|
138
|
+
@importer.send(:parse_attributes_from_hash, {'type' => 'Entry'}, 'space_id', 'content_type_id')
|
139
|
+
end
|
140
|
+
it 'Entry' do
|
141
|
+
params = @importer.send(:parse_attributes_from_hash, {'some' => 'params'}, 'space_id', 'content_type_id')
|
142
|
+
expect(params).to include('some' => 'params')
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context 'parse_attributes_from_array' do
|
147
|
+
it 'File' do
|
148
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:create_asset).with('space_id', {'type' => 'File'})
|
149
|
+
@importer.send(:parse_attributes_from_array, [{'type' => 'File'}], 'space_id', 'content_type_id')
|
150
|
+
end
|
151
|
+
it 'Entry' do
|
152
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:create_entry).with({'type' => 'Entry'}, 'space_id', 'content_type_id')
|
153
|
+
@importer.send(:parse_attributes_from_array, [{'type' => 'Entry'}], 'space_id', 'content_type_id')
|
154
|
+
end
|
155
|
+
it 'Entry' do
|
156
|
+
params = @importer.send(:parse_attributes_from_array, [{'some' => 'params'}], 'space_id', 'content_type_id')
|
157
|
+
expect(params).to include('some' => 'params')
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'json_schema_validator'
|
3
|
+
|
4
|
+
module Contentful
|
5
|
+
describe JsonSchemaValidator do
|
6
|
+
|
7
|
+
include_context 'shared_configuration'
|
8
|
+
|
9
|
+
it 'initialize' do
|
10
|
+
validator = JsonSchemaValidator.new(@config)
|
11
|
+
expect(validator.config).to be_a Contentful::Configuration
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'validate_schemas' do
|
15
|
+
expect_any_instance_of(Contentful::JsonSchemaValidator).to receive(:validate_schema).exactly(4).times
|
16
|
+
JsonSchemaValidator.new(@config).validate_schemas
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'validate_schema' do
|
20
|
+
expect_any_instance_of(Contentful::JsonSchemaValidator).to receive(:validate_entry).with('job_skills',
|
21
|
+
{'type' => 'object',
|
22
|
+
'properties' => {'name' => {'type' => 'string'}
|
23
|
+
}})
|
24
|
+
JsonSchemaValidator.new(@config).validate_schema('spec/fixtures/import_files/collections/job_skills.json')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'validate_entry' do
|
28
|
+
schema = load_json('import_files/collections/job_skills')
|
29
|
+
expect { JsonSchemaValidator.new(@config).validate_entry('job_skills', schema) }.not_to raise_error
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'parse_content_type_schema' do
|
33
|
+
ct_file = load_json('import_files/collections/job_skills')
|
34
|
+
result = JsonSchemaValidator.new(@config).parse_content_type_schema(ct_file)
|
35
|
+
expect(result).to include('type' => 'object', 'properties' => {'name' => {'type' => 'string'}})
|
36
|
+
end
|
37
|
+
|
38
|
+
it 'base schema form' do
|
39
|
+
result = JsonSchemaValidator.new(@config).base_schema_format
|
40
|
+
expect(result).to include('type' => 'object', 'properties' => {})
|
41
|
+
end
|
42
|
+
|
43
|
+
context 'convert_type' do
|
44
|
+
it 'Text to String' do
|
45
|
+
result = JsonSchemaValidator.new(@config).convert_type('Text')
|
46
|
+
expect(result).to eq 'string'
|
47
|
+
end
|
48
|
+
it 'Number to Float' do
|
49
|
+
result = JsonSchemaValidator.new(@config).convert_type('Number')
|
50
|
+
expect(result).to eq 'float'
|
51
|
+
end
|
52
|
+
it 'Asset to Object(Hash)' do
|
53
|
+
result = JsonSchemaValidator.new(@config).convert_type('Asset')
|
54
|
+
expect(result).to eq 'object'
|
55
|
+
end
|
56
|
+
it 'Other to downcase format' do
|
57
|
+
result = JsonSchemaValidator.new(@config).convert_type('Integer')
|
58
|
+
expect(result).to eq 'integer'
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require './lib/migrator'
|
3
|
+
|
4
|
+
describe Migrator do
|
5
|
+
before do
|
6
|
+
@setting_file = YAML.load_file('spec/fixtures/settings/settings.yml')
|
7
|
+
end
|
8
|
+
it 'convert contentful model to contentful structure' do
|
9
|
+
Migrator.new(@setting_file).run('--convert-content-model-to-json')
|
10
|
+
contentful_structure = load_fixture('settings/contentful_structure_test')
|
11
|
+
expect(contentful_structure.count).to eq 4
|
12
|
+
expect(contentful_structure['Jobs']).to include(id: '4L1bg4WQ5aWQMiE82ouag', name: 'Jobs', displayField: 'title', description: nil)
|
13
|
+
expect(contentful_structure['Jobs']['fields'].count).to eq 4
|
14
|
+
expect(contentful_structure['Jobs']['fields']['Image']).to include(id: 'image', type: 'Asset', link: 'Link')
|
15
|
+
expect(contentful_structure['Jobs']['fields']['Creator']).to include(id: 'creator', type: 'Entry', link: 'Link')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'create content type json files from contentful structure' do
|
19
|
+
Migrator.new(@setting_file).run('--create-contentful-model-from-json')
|
20
|
+
expect(Dir.glob('spec/fixtures/import_files/collections/*').count).to eq 4
|
21
|
+
content_types_files = %w(comment.json job_skills.json jobs.json profile.json user.json)
|
22
|
+
Dir.glob('spec/fixtures/import_files/collections/*') do |directory_name|
|
23
|
+
expect(content_types_files.include?(File.basename(directory_name))).to be true
|
24
|
+
end
|
25
|
+
job_skills = load_fixture('import_files/collections/job_skills')
|
26
|
+
expect(job_skills).to include(id: '2soCP557HGKoOOK0SqmMOm', name: 'Job Skills', displayField: 'name')
|
27
|
+
expect(job_skills['fields'].count).to eq 1
|
28
|
+
expect(job_skills['fields'].first).to include(id: 'name', name: 'Name', type: 'Text')
|
29
|
+
|
30
|
+
jobs = load_fixture('import_files/collections/jobs')
|
31
|
+
expect(jobs).to include(id: '4L1bg4WQ5aWQMiE82ouag', name: 'Jobs', displayField: 'title')
|
32
|
+
expect(jobs['fields'].count).to eq 5
|
33
|
+
expect(jobs['fields'].last).to include(id: 'skills', name: 'Skills', type: 'Array', link_type: 'Entry', link: 'Link')
|
34
|
+
|
35
|
+
profile = load_fixture('import_files/collections/profile')
|
36
|
+
expect(profile).to include(id: '4WFZh4MwC4Mc0EQWAeOY8A', name: 'Profile', displayField: nil)
|
37
|
+
expect(profile['fields'].count).to eq 2
|
38
|
+
expect(profile['fields'].first).to include(id: 'nickname', name: 'Nickname', type: 'Text')
|
39
|
+
|
40
|
+
user = load_fixture('import_files/collections/user')
|
41
|
+
expect(user).to include(id: '1TVvxCqoRq0qUYAOQuOqys', name: 'User', displayField: 'first_name')
|
42
|
+
expect(user['fields'].first).to include(id: 'first_name', name: 'First_name', type: 'Text')
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'create content type json files from contentful structure' do
|
46
|
+
vcr('import_content_types') do
|
47
|
+
Migrator.new(@setting_file).run('--import-content-types', space_id: 'space_id')
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'import an entires to Contentful with two Threads' do
|
52
|
+
vcr('import_entries') do
|
53
|
+
allow(FileUtils).to receive(:rm_r)
|
54
|
+
import = Migrator.new(@setting_file).run('--import', threads: 2)
|
55
|
+
expect(import).to be_a Array
|
56
|
+
expect(import.count).to eq 2
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'import an assets to Contentful' do
|
61
|
+
vcr('import_assets') do
|
62
|
+
Migrator.new(@setting_file).run('--import-assets')
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'publish an entires' do
|
67
|
+
vcr('publish_entries') do
|
68
|
+
Migrator.new(@setting_file).run('--publish-entries')
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
it 'publish an assets' do
|
73
|
+
vcr('publish_asset') do
|
74
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:publish_status).exactly(4).times
|
75
|
+
expect_any_instance_of(Contentful::ParallelImporter).to receive(:create_log_file).with('success_published_assets')
|
76
|
+
Migrator.new(@setting_file).run('--publish-assets', threads: 1)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
context 'test credentials' do
|
81
|
+
it 'when valid' do
|
82
|
+
vcr('valid_credentials') do
|
83
|
+
expect_any_instance_of(Logger).to receive(:info).with('Contentful Management API credentials: OK')
|
84
|
+
Migrator.new(@setting_file).run('--test-credentials')
|
85
|
+
end
|
86
|
+
end
|
87
|
+
it 'when invalid' do
|
88
|
+
vcr('invalid_credentials') do
|
89
|
+
expect_any_instance_of(Logger).to receive(:info).with('Contentful Management API credentials: INVALID (check README)')
|
90
|
+
Migrator.new(@setting_file).run('--test-credentials')
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
it 'validate JSON schema' do
|
96
|
+
expect { Migrator.new(@setting_file).run('--validate-schema') }.not_to raise_error
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'multi_json'
|
2
|
+
|
3
|
+
def load_fixture(file, _as_json = false)
|
4
|
+
JSON.parse(File.read(File.dirname(__FILE__) + "/../fixtures/#{file}.json")).with_indifferent_access
|
5
|
+
end
|
6
|
+
|
7
|
+
def load_json(file, _as_json = false)
|
8
|
+
JSON.parse(File.read(File.dirname(__FILE__) + "/../fixtures/#{file}.json"))
|
9
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require './lib/configuration'
|
2
|
+
|
3
|
+
shared_context 'shared_configuration' do
|
4
|
+
before do
|
5
|
+
yaml_text = <<-EOF
|
6
|
+
data_dir: spec/fixtures/import_files
|
7
|
+
|
8
|
+
access_token: <ACCESS_TOKEN>
|
9
|
+
organization_id: <ORGANIZATION_ID>
|
10
|
+
space_id: ip17s12q0ek4
|
11
|
+
default_locale: 'en-US'
|
12
|
+
|
13
|
+
mapping_dir: spec/fixtures/settings/mapping.json
|
14
|
+
contentful_structure_dir: spec/fixtures/settings/contentful_structure.json
|
15
|
+
|
16
|
+
content_model_json: spec/fixtures/settings/contentful_model.json
|
17
|
+
converted_model_dir: spec/fixtures/settings/contentful_structure_test.json
|
18
|
+
EOF
|
19
|
+
yaml = YAML.load(yaml_text)
|
20
|
+
@config = Contentful::Configuration.new(yaml)
|
21
|
+
end
|
22
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
|
3
|
+
VCR.configure do |c|
|
4
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
5
|
+
c.ignore_localhost = true
|
6
|
+
c.hook_into :webmock
|
7
|
+
c.default_cassette_options = {record: :once}
|
8
|
+
end
|
9
|
+
|
10
|
+
def vcr(name, &block)
|
11
|
+
VCR.use_cassette(name, &block)
|
12
|
+
end
|
13
|
+
|
14
|
+
def expect_vcr(name, &block)
|
15
|
+
expect { VCR.use_cassette(name, &block) }
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,436 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: contentful-importer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Contentful GmbH (Andreas Tiefenthaler)
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-01-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: http
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: multi_json
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: contentful-management
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.5.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.5.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: activesupport
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.1'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.1'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: escort
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.4.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.4.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: api_cache
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.3.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.3.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: i18n
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.6'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.6'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: json-schema
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.5.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.5.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: bundler
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.6'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.6'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rspec
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '3'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '3'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec-its
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 1.1.0
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 1.1.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: vcr
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 2.9.3
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 2.9.3
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: webmock
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '1.20'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - ">="
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '1.20'
|
209
|
+
description: Generic importer for contentful.com
|
210
|
+
email:
|
211
|
+
- rubygems@contentful.com
|
212
|
+
executables:
|
213
|
+
- contentful-importer
|
214
|
+
extensions: []
|
215
|
+
extra_rdoc_files: []
|
216
|
+
files:
|
217
|
+
- ".gitignore"
|
218
|
+
- ".rspec"
|
219
|
+
- ".travis.yml"
|
220
|
+
- CHANGELOG.md
|
221
|
+
- Gemfile
|
222
|
+
- Gemfile.lock
|
223
|
+
- LICENSE
|
224
|
+
- README.md
|
225
|
+
- Rakefile
|
226
|
+
- bin/contentful-importer
|
227
|
+
- contentful_importer.gemspec
|
228
|
+
- example_settings/contentful_model.json
|
229
|
+
- example_settings/contentful_structure.json
|
230
|
+
- example_settings/files_meaning.txt
|
231
|
+
- example_settings/settings.yml
|
232
|
+
- lib/cli.rb
|
233
|
+
- lib/configuration.rb
|
234
|
+
- lib/converters/content_types_structure_creator.rb
|
235
|
+
- lib/converters/contentful_model_to_json.rb
|
236
|
+
- lib/importer/data_organizer.rb
|
237
|
+
- lib/importer/mime_content_type.rb
|
238
|
+
- lib/importer/parallel_importer.rb
|
239
|
+
- lib/json_schema_validator.rb
|
240
|
+
- lib/migrator.rb
|
241
|
+
- lib/version.rb
|
242
|
+
- spec/fixtures/import_files/assets/image/image_1.json
|
243
|
+
- spec/fixtures/import_files/assets/image/image_2.json
|
244
|
+
- spec/fixtures/import_files/assets/image/image_3.json
|
245
|
+
- spec/fixtures/import_files/assets/image/image_4.json
|
246
|
+
- spec/fixtures/import_files/collections/job_skills.json
|
247
|
+
- spec/fixtures/import_files/collections/jobs.json
|
248
|
+
- spec/fixtures/import_files/collections/profile.json
|
249
|
+
- spec/fixtures/import_files/collections/user.json
|
250
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_1.json
|
251
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_10.json
|
252
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_2.json
|
253
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_3.json
|
254
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_4.json
|
255
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_5.json
|
256
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_6.json
|
257
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_7.json
|
258
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_8.json
|
259
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_9.json
|
260
|
+
- spec/fixtures/import_files/entries/jobs/jobs_1.json
|
261
|
+
- spec/fixtures/import_files/entries/jobs/jobs_2.json
|
262
|
+
- spec/fixtures/import_files/entries/jobs/jobs_4.json
|
263
|
+
- spec/fixtures/import_files/entries/profile/profile_1.json
|
264
|
+
- spec/fixtures/import_files/entries/profile/profile_2.json
|
265
|
+
- spec/fixtures/import_files/entries/user/user_1.json
|
266
|
+
- spec/fixtures/import_files/entries/user/user_2.json
|
267
|
+
- spec/fixtures/import_files/logs/log_published_assets.csv
|
268
|
+
- spec/fixtures/import_files/logs/log_published_entries.csv
|
269
|
+
- spec/fixtures/import_files/logs/success_assets.csv
|
270
|
+
- spec/fixtures/import_files/logs/success_published_assets.csv
|
271
|
+
- spec/fixtures/import_files/logs/success_published_entries.csv
|
272
|
+
- spec/fixtures/import_files/logs/success_thread_0.csv
|
273
|
+
- spec/fixtures/import_files/logs/success_thread_1.csv
|
274
|
+
- spec/fixtures/import_files/threads/0/1TVvxCqoRq0qUYAOQuOqys_2.json
|
275
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_1.json
|
276
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_10.json
|
277
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_2.json
|
278
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_3.json
|
279
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_4.json
|
280
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_5.json
|
281
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_6.json
|
282
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_7.json
|
283
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_1.json
|
284
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_2.json
|
285
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_3.json
|
286
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_4.json
|
287
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_5.json
|
288
|
+
- spec/fixtures/import_files/threads/1/1TVvxCqoRq0qUYAOQuOqys_1.json
|
289
|
+
- spec/fixtures/import_files/threads/1/1TVvxCqoRq0qUYAOQuOqys_2.json
|
290
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_6.json
|
291
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_7.json
|
292
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_8.json
|
293
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_9.json
|
294
|
+
- spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_1.json
|
295
|
+
- spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_2.json
|
296
|
+
- spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_4.json
|
297
|
+
- spec/fixtures/import_files/threads/1/4WFZh4MwC4Mc0EQWAeOY8A_1.json
|
298
|
+
- spec/fixtures/import_files/threads/1/4WFZh4MwC4Mc0EQWAeOY8A_2.json
|
299
|
+
- spec/fixtures/import_files/threads/assets/0/image_1.json
|
300
|
+
- spec/fixtures/import_files/threads/assets/0/image_2.json
|
301
|
+
- spec/fixtures/import_files/threads/assets/0/image_3.json
|
302
|
+
- spec/fixtures/import_files/threads/assets/0/image_4.json
|
303
|
+
- spec/fixtures/settings/contentful_model.json
|
304
|
+
- spec/fixtures/settings/contentful_structure.json
|
305
|
+
- spec/fixtures/settings/contentful_structure_test.json
|
306
|
+
- spec/fixtures/settings/settings.yml
|
307
|
+
- spec/fixtures/vcr_cassettes/create_asset.yml
|
308
|
+
- spec/fixtures/vcr_cassettes/create_entry.yml
|
309
|
+
- spec/fixtures/vcr_cassettes/create_space.yml
|
310
|
+
- spec/fixtures/vcr_cassettes/import_assets.yml
|
311
|
+
- spec/fixtures/vcr_cassettes/import_content_types.yml
|
312
|
+
- spec/fixtures/vcr_cassettes/import_entries.yml
|
313
|
+
- spec/fixtures/vcr_cassettes/import_entry.yml
|
314
|
+
- spec/fixtures/vcr_cassettes/invalid_credentials.yml
|
315
|
+
- spec/fixtures/vcr_cassettes/publish_an_entry.yml
|
316
|
+
- spec/fixtures/vcr_cassettes/publish_asset.yml
|
317
|
+
- spec/fixtures/vcr_cassettes/publish_entries.yml
|
318
|
+
- spec/fixtures/vcr_cassettes/valid_credentials.yml
|
319
|
+
- spec/lib/configuration_spec.rb
|
320
|
+
- spec/lib/importer/parallel_importer_spec.rb
|
321
|
+
- spec/lib/json_schema_validator_spec.rb
|
322
|
+
- spec/lib/migrator_spec.rb
|
323
|
+
- spec/spec_helper.rb
|
324
|
+
- spec/support/db_rows_json.rb
|
325
|
+
- spec/support/shared_configuration.rb
|
326
|
+
- spec/support/vcr.rb
|
327
|
+
homepage: https://github.com/contentful/contentful-importer.rb
|
328
|
+
licenses:
|
329
|
+
- MIT
|
330
|
+
metadata: {}
|
331
|
+
post_install_message:
|
332
|
+
rdoc_options: []
|
333
|
+
require_paths:
|
334
|
+
- lib
|
335
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
336
|
+
requirements:
|
337
|
+
- - ">="
|
338
|
+
- !ruby/object:Gem::Version
|
339
|
+
version: '0'
|
340
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
341
|
+
requirements:
|
342
|
+
- - ">="
|
343
|
+
- !ruby/object:Gem::Version
|
344
|
+
version: '0'
|
345
|
+
requirements: []
|
346
|
+
rubyforge_project:
|
347
|
+
rubygems_version: 2.2.2
|
348
|
+
signing_key:
|
349
|
+
specification_version: 4
|
350
|
+
summary: Allows to import structured data to contentful.com
|
351
|
+
test_files:
|
352
|
+
- spec/fixtures/import_files/assets/image/image_1.json
|
353
|
+
- spec/fixtures/import_files/assets/image/image_2.json
|
354
|
+
- spec/fixtures/import_files/assets/image/image_3.json
|
355
|
+
- spec/fixtures/import_files/assets/image/image_4.json
|
356
|
+
- spec/fixtures/import_files/collections/job_skills.json
|
357
|
+
- spec/fixtures/import_files/collections/jobs.json
|
358
|
+
- spec/fixtures/import_files/collections/profile.json
|
359
|
+
- spec/fixtures/import_files/collections/user.json
|
360
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_1.json
|
361
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_10.json
|
362
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_2.json
|
363
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_3.json
|
364
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_4.json
|
365
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_5.json
|
366
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_6.json
|
367
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_7.json
|
368
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_8.json
|
369
|
+
- spec/fixtures/import_files/entries/job_skills/job_skills_9.json
|
370
|
+
- spec/fixtures/import_files/entries/jobs/jobs_1.json
|
371
|
+
- spec/fixtures/import_files/entries/jobs/jobs_2.json
|
372
|
+
- spec/fixtures/import_files/entries/jobs/jobs_4.json
|
373
|
+
- spec/fixtures/import_files/entries/profile/profile_1.json
|
374
|
+
- spec/fixtures/import_files/entries/profile/profile_2.json
|
375
|
+
- spec/fixtures/import_files/entries/user/user_1.json
|
376
|
+
- spec/fixtures/import_files/entries/user/user_2.json
|
377
|
+
- spec/fixtures/import_files/logs/log_published_assets.csv
|
378
|
+
- spec/fixtures/import_files/logs/log_published_entries.csv
|
379
|
+
- spec/fixtures/import_files/logs/success_assets.csv
|
380
|
+
- spec/fixtures/import_files/logs/success_published_assets.csv
|
381
|
+
- spec/fixtures/import_files/logs/success_published_entries.csv
|
382
|
+
- spec/fixtures/import_files/logs/success_thread_0.csv
|
383
|
+
- spec/fixtures/import_files/logs/success_thread_1.csv
|
384
|
+
- spec/fixtures/import_files/threads/0/1TVvxCqoRq0qUYAOQuOqys_2.json
|
385
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_1.json
|
386
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_10.json
|
387
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_2.json
|
388
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_3.json
|
389
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_4.json
|
390
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_5.json
|
391
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_6.json
|
392
|
+
- spec/fixtures/import_files/threads/0/2soCP557HGKoOOK0SqmMOm_7.json
|
393
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_1.json
|
394
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_2.json
|
395
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_3.json
|
396
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_4.json
|
397
|
+
- spec/fixtures/import_files/threads/0/6H6pGAV1PUsuoAW26Iu48W_5.json
|
398
|
+
- spec/fixtures/import_files/threads/1/1TVvxCqoRq0qUYAOQuOqys_1.json
|
399
|
+
- spec/fixtures/import_files/threads/1/1TVvxCqoRq0qUYAOQuOqys_2.json
|
400
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_6.json
|
401
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_7.json
|
402
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_8.json
|
403
|
+
- spec/fixtures/import_files/threads/1/2soCP557HGKoOOK0SqmMOm_9.json
|
404
|
+
- spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_1.json
|
405
|
+
- spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_2.json
|
406
|
+
- spec/fixtures/import_files/threads/1/4L1bg4WQ5aWQMiE82ouag_4.json
|
407
|
+
- spec/fixtures/import_files/threads/1/4WFZh4MwC4Mc0EQWAeOY8A_1.json
|
408
|
+
- spec/fixtures/import_files/threads/1/4WFZh4MwC4Mc0EQWAeOY8A_2.json
|
409
|
+
- spec/fixtures/import_files/threads/assets/0/image_1.json
|
410
|
+
- spec/fixtures/import_files/threads/assets/0/image_2.json
|
411
|
+
- spec/fixtures/import_files/threads/assets/0/image_3.json
|
412
|
+
- spec/fixtures/import_files/threads/assets/0/image_4.json
|
413
|
+
- spec/fixtures/settings/contentful_model.json
|
414
|
+
- spec/fixtures/settings/contentful_structure.json
|
415
|
+
- spec/fixtures/settings/contentful_structure_test.json
|
416
|
+
- spec/fixtures/settings/settings.yml
|
417
|
+
- spec/fixtures/vcr_cassettes/create_asset.yml
|
418
|
+
- spec/fixtures/vcr_cassettes/create_entry.yml
|
419
|
+
- spec/fixtures/vcr_cassettes/create_space.yml
|
420
|
+
- spec/fixtures/vcr_cassettes/import_assets.yml
|
421
|
+
- spec/fixtures/vcr_cassettes/import_content_types.yml
|
422
|
+
- spec/fixtures/vcr_cassettes/import_entries.yml
|
423
|
+
- spec/fixtures/vcr_cassettes/import_entry.yml
|
424
|
+
- spec/fixtures/vcr_cassettes/invalid_credentials.yml
|
425
|
+
- spec/fixtures/vcr_cassettes/publish_an_entry.yml
|
426
|
+
- spec/fixtures/vcr_cassettes/publish_asset.yml
|
427
|
+
- spec/fixtures/vcr_cassettes/publish_entries.yml
|
428
|
+
- spec/fixtures/vcr_cassettes/valid_credentials.yml
|
429
|
+
- spec/lib/configuration_spec.rb
|
430
|
+
- spec/lib/importer/parallel_importer_spec.rb
|
431
|
+
- spec/lib/json_schema_validator_spec.rb
|
432
|
+
- spec/lib/migrator_spec.rb
|
433
|
+
- spec/spec_helper.rb
|
434
|
+
- spec/support/db_rows_json.rb
|
435
|
+
- spec/support/shared_configuration.rb
|
436
|
+
- spec/support/vcr.rb
|