Revision 5146ac68
Added by Thomas McKay almost 7 years ago
lib/hammer_cli_csv/content_views.rb | ||
---|---|---|
106 | 106 |
'description' => line[DESCRIPTION], |
107 | 107 |
'composite' => is_composite |
108 | 108 |
} |
109 |
if is_composite |
|
110 |
options['component_ids'] = composite_ids |
|
111 |
else |
|
112 |
options['repository_ids'] = repository_ids |
|
113 |
end |
|
114 | 109 |
contentview_id = @api.resource(:content_views).call(:create, options)['id'] |
115 | 110 |
@existing_contentviews[line[ORGANIZATION]][name] = contentview_id |
116 |
publish = true |
|
117 | 111 |
else |
118 | 112 |
print _("Updating content view '%{name}'...") % {:name => name} if option_verbose? |
119 |
options = { |
|
120 |
'id' => contentview_id, |
|
121 |
'description' => line[DESCRIPTION] |
|
122 |
} |
|
123 |
if is_composite |
|
124 |
options['component_ids'] = composite_ids |
|
125 |
else |
|
126 |
options['repository_ids'] = repository_ids |
|
127 |
end |
|
128 |
contentview = @api.resource(:content_views).call(:update, options) |
|
129 |
contentview_id = contentview['id'] |
|
130 |
publish = contentview['versions'].empty? |
|
131 | 113 |
end |
132 | 114 |
|
115 |
options = { |
|
116 |
'id' => contentview_id, |
|
117 |
'description' => line[DESCRIPTION] |
|
118 |
} |
|
119 |
if is_composite |
|
120 |
options['component_ids'] = composite_ids |
|
121 |
else |
|
122 |
options['repository_ids'] = repository_ids |
|
123 |
end |
|
124 |
contentview = @api.resource(:content_views).call(:update, options) |
|
125 |
contentview_id = contentview['id'] |
|
126 |
|
|
133 | 127 |
# Content views cannot be used in composites unless a publish has occurred |
134 |
publish_content_view(contentview_id, line) if publish
|
|
128 |
publish_content_view(contentview_id, line) if contentview['versions'].empty?
|
|
135 | 129 |
promote_content_view(contentview_id, line) |
136 | 130 |
|
137 | 131 |
puts _('done') if option_verbose? |
Also available in: Unified diff
myriad changes in attempt to get import working against master/develop