Commit 9b77f3c1d246505392f57070a7f3f3ab23c0e5ee
0 parents
Exists in
master
Script to import a profile to Noosfero
Also an example of yaml file with data
Showing
2 changed files
with
814 additions
and
0 deletions
Show diff stats
| 1 | +++ a/example_profile.yml | ||
| @@ -0,0 +1,775 @@ | @@ -0,0 +1,775 @@ | ||
| 1 | +--- | ||
| 2 | +:community: | ||
| 3 | + - :id: 1 | ||
| 4 | + :name: Lorem Ipsum | ||
| 5 | + :type: Community | ||
| 6 | + :identifier: lorem | ||
| 7 | + :environment_id: 1 | ||
| 8 | + :active: true | ||
| 9 | + :address: '' | ||
| 10 | + :contact_phone: | ||
| 11 | + :home_page_id: 310 | ||
| 12 | + :user_id: | ||
| 13 | + :region_id: | ||
| 14 | + :data: | ||
| 15 | + :moderated_articles: false | ||
| 16 | + :layout_template: default | ||
| 17 | + :closed: false | ||
| 18 | + :redirect_l10n: false | ||
| 19 | + :email_suggestions: false | ||
| 20 | + :fields_privacy: !ruby/hash:ActiveSupport::HashWithIndifferentAccess | ||
| 21 | + address: public | ||
| 22 | + :created_at: 2014-12-05 11:09:15.201420000 Z | ||
| 23 | + :lat: | ||
| 24 | + :lng: | ||
| 25 | + :geocode_precision: | ||
| 26 | + :enabled: true | ||
| 27 | + :nickname: | ||
| 28 | + :custom_header: | ||
| 29 | + :custom_footer: | ||
| 30 | + :theme: | ||
| 31 | + :public_profile: true | ||
| 32 | + :birth_date: | ||
| 33 | + :preferred_domain_id: | ||
| 34 | + :updated_at: 2015-06-24 20:40:28.548303000 Z | ||
| 35 | + :visible: true | ||
| 36 | + :image_id: 49 | ||
| 37 | + :validated: true | ||
| 38 | + :cnpj: | ||
| 39 | + :national_region_code: | ||
| 40 | + :is_template: false | ||
| 41 | + :template_id: 67 | ||
| 42 | + :redirection_after_login: keep_on_same_page | ||
| 43 | + :friends_count: 0 | ||
| 44 | + :members_count: 13 | ||
| 45 | + :activities_count: 6 | ||
| 46 | + :personal_website: | ||
| 47 | + :jabber_id: | ||
| 48 | + :welcome_page_id: | ||
| 49 | + :allow_members_to_invite: true | ||
| 50 | + :invite_friends_only: false | ||
| 51 | + :secret: false | ||
| 52 | +:image: | ||
| 53 | + - :id: 49 | ||
| 54 | + :parent_id: | ||
| 55 | + :content_type: image/png | ||
| 56 | + :filename: lorem.png | ||
| 57 | + :thumbnail: | ||
| 58 | + :size: 3574 | ||
| 59 | + :width: 150 | ||
| 60 | + :height: 183 | ||
| 61 | + :thumbnails_processed: true | ||
| 62 | + :label: '' | ||
| 63 | + - :id: 50 | ||
| 64 | + :parent_id: 49 | ||
| 65 | + :content_type: image/png | ||
| 66 | + :filename: lorem_big.png | ||
| 67 | + :thumbnail: big | ||
| 68 | + :size: 18720 | ||
| 69 | + :width: 123 | ||
| 70 | + :height: 150 | ||
| 71 | + :thumbnails_processed: false | ||
| 72 | + :label: '' | ||
| 73 | + - :id: 51 | ||
| 74 | + :parent_id: 49 | ||
| 75 | + :content_type: image/png | ||
| 76 | + :filename: lorem_thumb.png | ||
| 77 | + :thumbnail: thumb | ||
| 78 | + :size: 10781 | ||
| 79 | + :width: 82 | ||
| 80 | + :height: 100 | ||
| 81 | + :thumbnails_processed: false | ||
| 82 | + :label: '' | ||
| 83 | + - :id: 52 | ||
| 84 | + :parent_id: 49 | ||
| 85 | + :content_type: image/png | ||
| 86 | + :filename: lorem_portrait.png | ||
| 87 | + :thumbnail: portrait | ||
| 88 | + :size: 5771 | ||
| 89 | + :width: 52 | ||
| 90 | + :height: 64 | ||
| 91 | + :thumbnails_processed: false | ||
| 92 | + :label: '' | ||
| 93 | + - :id: 53 | ||
| 94 | + :parent_id: 49 | ||
| 95 | + :content_type: image/png | ||
| 96 | + :filename: lorem_minor.png | ||
| 97 | + :thumbnail: minor | ||
| 98 | + :size: 4146 | ||
| 99 | + :width: 41 | ||
| 100 | + :height: 50 | ||
| 101 | + :thumbnails_processed: false | ||
| 102 | + :label: '' | ||
| 103 | + - :id: 54 | ||
| 104 | + :parent_id: 49 | ||
| 105 | + :content_type: image/png | ||
| 106 | + :filename: lorem_icon.png | ||
| 107 | + :thumbnail: icon | ||
| 108 | + :size: 1232 | ||
| 109 | + :width: 20 | ||
| 110 | + :height: 20 | ||
| 111 | + :thumbnails_processed: false | ||
| 112 | + :label: '' | ||
| 113 | +:box: | ||
| 114 | + - :id: 262 | ||
| 115 | + :owner_type: Profile | ||
| 116 | + :owner_id: 1 | ||
| 117 | + :position: 1 | ||
| 118 | + - :id: 263 | ||
| 119 | + :owner_type: Profile | ||
| 120 | + :owner_id: 1 | ||
| 121 | + :position: 2 | ||
| 122 | + - :id: 264 | ||
| 123 | + :owner_type: Profile | ||
| 124 | + :owner_id: 1 | ||
| 125 | + :position: 3 | ||
| 126 | + - :id: 1592 | ||
| 127 | + :owner_type: Profile | ||
| 128 | + :owner_id: 1 | ||
| 129 | + :position: 4 | ||
| 130 | +:block: | ||
| 131 | + - :id: 489 | ||
| 132 | + :title: '' | ||
| 133 | + :box_id: 262 | ||
| 134 | + :type: MainBlock | ||
| 135 | + :settings: | ||
| 136 | + :fixed: false | ||
| 137 | + :display: always | ||
| 138 | + :display_user: all | ||
| 139 | + :language: all | ||
| 140 | + :position: 3 | ||
| 141 | + :enabled: true | ||
| 142 | + :created_at: 2014-12-05 11:09:15.563837000 Z | ||
| 143 | + :updated_at: 2014-12-08 18:13:12.306137000 Z | ||
| 144 | + :fetched_at: | ||
| 145 | + :mirror: false | ||
| 146 | + :mirror_block_id: | ||
| 147 | + :observers_id: | ||
| 148 | + - :id: 490 | ||
| 149 | + :title: | ||
| 150 | + :box_id: 262 | ||
| 151 | + :type: CategoriesAndTagsBlock | ||
| 152 | + :settings: | ||
| 153 | + :display: home_page_only | ||
| 154 | + :position: 4 | ||
| 155 | + :enabled: true | ||
| 156 | + :created_at: 2014-12-05 11:09:15.584732000 Z | ||
| 157 | + :updated_at: 2014-12-05 11:09:15.584732000 Z | ||
| 158 | + :fetched_at: | ||
| 159 | + :mirror: false | ||
| 160 | + :mirror_block_id: | ||
| 161 | + :observers_id: | ||
| 162 | + - :id: 1700 | ||
| 163 | + :title: '' | ||
| 164 | + :box_id: 263 | ||
| 165 | + :type: LinkListBlock | ||
| 166 | + :settings: | ||
| 167 | + :links: | ||
| 168 | + - !ruby/hash:ActiveSupport::HashWithIndifferentAccess | ||
| 169 | + :icon: no-icon | ||
| 170 | + :name: Link | ||
| 171 | + :address: /link | ||
| 172 | + :target: _self | ||
| 173 | + :fixed: false | ||
| 174 | + :display: always | ||
| 175 | + :display_user: all | ||
| 176 | + :language: all | ||
| 177 | + :position: 1 | ||
| 178 | + :enabled: true | ||
| 179 | + :created_at: 2015-03-12 14:27:35.845251000 Z | ||
| 180 | + :updated_at: 2015-03-12 14:31:22.355721000 Z | ||
| 181 | + :fetched_at: | ||
| 182 | + :mirror: false | ||
| 183 | + :mirror_block_id: | ||
| 184 | + :observers_id: | ||
| 185 | + - :id: 494 | ||
| 186 | + :title: | ||
| 187 | + :box_id: 264 | ||
| 188 | + :type: ProfileImageBlock | ||
| 189 | + :settings: | ||
| 190 | + :display: except_home_page | ||
| 191 | + :show_name: false | ||
| 192 | + :position: 1 | ||
| 193 | + :enabled: true | ||
| 194 | + :created_at: 2014-12-05 11:09:15.882481000 Z | ||
| 195 | + :updated_at: 2014-12-05 11:09:15.882481000 Z | ||
| 196 | + :fetched_at: | ||
| 197 | + :mirror: false | ||
| 198 | + :mirror_block_id: | ||
| 199 | + :observers_id: | ||
| 200 | + - :id: 498 | ||
| 201 | + :title: Integrantes | ||
| 202 | + :box_id: 264 | ||
| 203 | + :type: MembersBlock | ||
| 204 | + :settings: | ||
| 205 | + :display: never | ||
| 206 | + :name: '' | ||
| 207 | + :address: '' | ||
| 208 | + :visible_role: '' | ||
| 209 | + :limit: 6 | ||
| 210 | + :prioritize_profiles_with_image: true | ||
| 211 | + :show_join_leave_button: false | ||
| 212 | + :fixed: false | ||
| 213 | + :display_user: all | ||
| 214 | + :language: all | ||
| 215 | + :position: 5 | ||
| 216 | + :enabled: true | ||
| 217 | + :created_at: 2014-12-05 11:09:16.181404000 Z | ||
| 218 | + :updated_at: 2015-03-13 01:50:49.150748000 Z | ||
| 219 | + :fetched_at: | ||
| 220 | + :mirror: false | ||
| 221 | + :mirror_block_id: | ||
| 222 | + :observers_id: | ||
| 223 | +:article: | ||
| 224 | + - :id: 302 | ||
| 225 | + :name: Blog | ||
| 226 | + :slug: blog | ||
| 227 | + :path: blog | ||
| 228 | + :parent_id: | ||
| 229 | + :body: | ||
| 230 | + :abstract: | ||
| 231 | + :profile_id: 1 | ||
| 232 | + :updated_at: 2014-12-08 11:07:35.894768000 Z | ||
| 233 | + :created_at: 2014-12-05 11:09:16.334973000 Z | ||
| 234 | + :last_changed_by_id: | ||
| 235 | + :version: 1 | ||
| 236 | + :type: Blog | ||
| 237 | + :size: | ||
| 238 | + :content_type: | ||
| 239 | + :filename: | ||
| 240 | + :height: | ||
| 241 | + :width: | ||
| 242 | + :comments_count: 0 | ||
| 243 | + :advertise: false | ||
| 244 | + :published: true | ||
| 245 | + :start_date: | ||
| 246 | + :end_date: | ||
| 247 | + :children_count: 2 | ||
| 248 | + :accept_comments: true | ||
| 249 | + :reference_article_id: | ||
| 250 | + :setting: {} | ||
| 251 | + :notify_comments: true | ||
| 252 | + :hits: 40 | ||
| 253 | + :published_at: 2014-10-21 12:01:07.090025000 Z | ||
| 254 | + :source: | ||
| 255 | + :highlighted: false | ||
| 256 | + :external_link: | ||
| 257 | + :thumbnails_processed: false | ||
| 258 | + :is_image: false | ||
| 259 | + :translation_of_id: | ||
| 260 | + :language: | ||
| 261 | + :source_name: | ||
| 262 | + :license_id: | ||
| 263 | + :image_id: | ||
| 264 | + :position: | ||
| 265 | + :spam_comments_count: 0 | ||
| 266 | + :author_id: | ||
| 267 | + :created_by_id: | ||
| 268 | + :show_to_followers: false | ||
| 269 | + - :id: 303 | ||
| 270 | + :name: feed | ||
| 271 | + :slug: feed | ||
| 272 | + :path: blog/feed | ||
| 273 | + :parent_id: 302 | ||
| 274 | + :body: {} | ||
| 275 | + :abstract: | ||
| 276 | + :profile_id: 1 | ||
| 277 | + :updated_at: 2014-12-05 11:09:16.348735000 Z | ||
| 278 | + :created_at: 2014-12-05 11:09:16.348735000 Z | ||
| 279 | + :last_changed_by_id: | ||
| 280 | + :version: 1 | ||
| 281 | + :type: RssFeed | ||
| 282 | + :size: | ||
| 283 | + :content_type: | ||
| 284 | + :filename: | ||
| 285 | + :height: | ||
| 286 | + :width: | ||
| 287 | + :comments_count: 0 | ||
| 288 | + :advertise: false | ||
| 289 | + :published: true | ||
| 290 | + :start_date: | ||
| 291 | + :end_date: | ||
| 292 | + :children_count: 0 | ||
| 293 | + :accept_comments: true | ||
| 294 | + :reference_article_id: | ||
| 295 | + :setting: {} | ||
| 296 | + :notify_comments: true | ||
| 297 | + :hits: 0 | ||
| 298 | + :published_at: 2014-12-05 11:09:16.348516000 Z | ||
| 299 | + :source: | ||
| 300 | + :highlighted: false | ||
| 301 | + :external_link: | ||
| 302 | + :thumbnails_processed: false | ||
| 303 | + :is_image: false | ||
| 304 | + :translation_of_id: | ||
| 305 | + :language: | ||
| 306 | + :source_name: | ||
| 307 | + :license_id: | ||
| 308 | + :image_id: | ||
| 309 | + :position: | ||
| 310 | + :spam_comments_count: 0 | ||
| 311 | + :author_id: | ||
| 312 | + :created_by_id: | ||
| 313 | + :show_to_followers: false | ||
| 314 | + - :id: 304 | ||
| 315 | + :name: Gallery | ||
| 316 | + :slug: gallery | ||
| 317 | + :path: gallery | ||
| 318 | + :parent_id: | ||
| 319 | + :body: | ||
| 320 | + :abstract: | ||
| 321 | + :profile_id: 1 | ||
| 322 | + :updated_at: 2014-12-08 20:41:54.571859000 Z | ||
| 323 | + :created_at: 2014-12-05 11:09:16.544535000 Z | ||
| 324 | + :last_changed_by_id: | ||
| 325 | + :version: 1 | ||
| 326 | + :type: Gallery | ||
| 327 | + :size: | ||
| 328 | + :content_type: | ||
| 329 | + :filename: | ||
| 330 | + :height: | ||
| 331 | + :width: | ||
| 332 | + :comments_count: 0 | ||
| 333 | + :advertise: false | ||
| 334 | + :published: true | ||
| 335 | + :start_date: | ||
| 336 | + :end_date: | ||
| 337 | + :children_count: 5 | ||
| 338 | + :accept_comments: true | ||
| 339 | + :reference_article_id: | ||
| 340 | + :setting: {} | ||
| 341 | + :notify_comments: true | ||
| 342 | + :hits: 52 | ||
| 343 | + :published_at: 2014-10-21 12:01:07.278852000 Z | ||
| 344 | + :source: | ||
| 345 | + :highlighted: false | ||
| 346 | + :external_link: | ||
| 347 | + :thumbnails_processed: false | ||
| 348 | + :is_image: false | ||
| 349 | + :translation_of_id: | ||
| 350 | + :language: | ||
| 351 | + :source_name: | ||
| 352 | + :license_id: | ||
| 353 | + :image_id: | ||
| 354 | + :position: | ||
| 355 | + :spam_comments_count: 0 | ||
| 356 | + :author_id: | ||
| 357 | + :created_by_id: | ||
| 358 | + :show_to_followers: false | ||
| 359 | + - :id: 305 | ||
| 360 | + :name: Documentação | ||
| 361 | + :slug: documentacao | ||
| 362 | + :path: documentacao | ||
| 363 | + :parent_id: | ||
| 364 | + :body: Pasta destinada para documentação | ||
| 365 | + :abstract: | ||
| 366 | + :profile_id: 1 | ||
| 367 | + :updated_at: 2015-01-29 13:00:52.171667000 Z | ||
| 368 | + :created_at: 2014-12-05 11:09:16.591802000 Z | ||
| 369 | + :last_changed_by_id: 82 | ||
| 370 | + :version: 2 | ||
| 371 | + :type: Folder | ||
| 372 | + :size: | ||
| 373 | + :content_type: | ||
| 374 | + :filename: | ||
| 375 | + :height: | ||
| 376 | + :width: | ||
| 377 | + :comments_count: 0 | ||
| 378 | + :advertise: true | ||
| 379 | + :published: true | ||
| 380 | + :start_date: | ||
| 381 | + :end_date: | ||
| 382 | + :children_count: 0 | ||
| 383 | + :accept_comments: false | ||
| 384 | + :reference_article_id: | ||
| 385 | + :setting: {} | ||
| 386 | + :notify_comments: true | ||
| 387 | + :hits: 197 | ||
| 388 | + :published_at: 2014-12-04 18:24:31.823160000 Z | ||
| 389 | + :source: | ||
| 390 | + :highlighted: false | ||
| 391 | + :external_link: | ||
| 392 | + :thumbnails_processed: false | ||
| 393 | + :is_image: false | ||
| 394 | + :translation_of_id: | ||
| 395 | + :language: | ||
| 396 | + :source_name: | ||
| 397 | + :license_id: | ||
| 398 | + :image_id: | ||
| 399 | + :position: | ||
| 400 | + :spam_comments_count: 0 | ||
| 401 | + :author_id: | ||
| 402 | + :created_by_id: | ||
| 403 | + :show_to_followers: false | ||
| 404 | + - :id: 386 | ||
| 405 | + :name: Em construção | ||
| 406 | + :slug: em-construcao | ||
| 407 | + :path: blog/em-construcao | ||
| 408 | + :parent_id: 302 | ||
| 409 | + :body: ! '<p><span style="font-size: 12pt;">Em construção.</span></p>' | ||
| 410 | + :abstract: '' | ||
| 411 | + :profile_id: 1 | ||
| 412 | + :updated_at: 2014-12-08 11:07:35.818152000 Z | ||
| 413 | + :created_at: 2014-12-08 11:07:35.818152000 Z | ||
| 414 | + :last_changed_by_id: 71 | ||
| 415 | + :version: 1 | ||
| 416 | + :type: TinyMceArticle | ||
| 417 | + :size: | ||
| 418 | + :content_type: | ||
| 419 | + :filename: | ||
| 420 | + :height: | ||
| 421 | + :width: | ||
| 422 | + :comments_count: 0 | ||
| 423 | + :advertise: true | ||
| 424 | + :published: true | ||
| 425 | + :start_date: | ||
| 426 | + :end_date: | ||
| 427 | + :children_count: 0 | ||
| 428 | + :accept_comments: false | ||
| 429 | + :reference_article_id: | ||
| 430 | + :setting: | ||
| 431 | + :allow_members_to_edit: false | ||
| 432 | + :moderate_comments: false | ||
| 433 | + :display_hits: true | ||
| 434 | + :display_versions: false | ||
| 435 | + :author_name: Joana Silva | ||
| 436 | + :notify_comments: true | ||
| 437 | + :hits: 1 | ||
| 438 | + :published_at: 2014-12-08 11:07:35.817826000 Z | ||
| 439 | + :source: | ||
| 440 | + :highlighted: false | ||
| 441 | + :external_link: | ||
| 442 | + :thumbnails_processed: false | ||
| 443 | + :is_image: false | ||
| 444 | + :translation_of_id: | ||
| 445 | + :language: pt | ||
| 446 | + :source_name: | ||
| 447 | + :license_id: | ||
| 448 | + :image_id: | ||
| 449 | + :position: | ||
| 450 | + :spam_comments_count: 0 | ||
| 451 | + :author_id: 71 | ||
| 452 | + :created_by_id: 71 | ||
| 453 | + :show_to_followers: false | ||
| 454 | +:role_assignment: | ||
| 455 | + - :id: 33 | ||
| 456 | + :accessor_id: 71 | ||
| 457 | + :accessor_type: Profile | ||
| 458 | + :resource_id: 1 | ||
| 459 | + :resource_type: Profile | ||
| 460 | + :role_id: 6 | ||
| 461 | + :is_global: | ||
| 462 | + - :id: 43 | ||
| 463 | + :accessor_id: 93 | ||
| 464 | + :accessor_type: Profile | ||
| 465 | + :resource_id: 1 | ||
| 466 | + :resource_type: Profile | ||
| 467 | + :role_id: 7 | ||
| 468 | + :is_global: | ||
| 469 | + - :id: 49 | ||
| 470 | + :accessor_id: 82 | ||
| 471 | + :accessor_type: Profile | ||
| 472 | + :resource_id: 1 | ||
| 473 | + :resource_type: Profile | ||
| 474 | + :role_id: 6 | ||
| 475 | + :is_global: | ||
| 476 | +:software_info: | ||
| 477 | + - :id: 12 | ||
| 478 | + :license_info_id: 1 | ||
| 479 | + :community_id: 1 | ||
| 480 | + :e_mag: false | ||
| 481 | + :icp_brasil: false | ||
| 482 | + :intern: false | ||
| 483 | + :e_ping: false | ||
| 484 | + :e_arq: false | ||
| 485 | + :operating_platform: '' | ||
| 486 | + :demonstration_url: http://teste.lorem.cc | ||
| 487 | + :acronym: '' | ||
| 488 | + :objectives: | ||
| 489 | + :features: ! "\r\nLorem ipsum dolor sit amet, consectetur adipiscing elit. | ||
| 490 | + Ut facilisis augue a libero volutpat malesuada. Pellentesque diam mi, venenatis | ||
| 491 | + et ante sodales, auctor maximus tortor. Suspendisse sodales varius lacus, ut | ||
| 492 | + varius est luctus vel. Donec id ligula vitae diam volutpat dictum. Duis et sem | ||
| 493 | + tempor, sagittis ligula nec, iaculis est. Etiam pulvinar nulla in luctus cursus. | ||
| 494 | + Suspendisse fringilla ex sit amet luctus fringilla. Fusce eu nibh varius nisl | ||
| 495 | + faucibus imperdiet. Aliquam erat volutpat. Fusce hendrerit pulvinar auctor. | ||
| 496 | + Quisque vitae posuere metus. Vivamus eros elit, egestas et pharetra id, luctus | ||
| 497 | + sed orci. Donec vestibulum lacus vel sapien dignissim, sed tempus metus maximus. | ||
| 498 | + Integer consequat elit sed dignissim rhoncus. | ||
| 499 | + na rede." | ||
| 500 | + :finality: Lorem ipsum dolor sit amet | ||
| 501 | + :repository_link: https://portal.softwarepublico.gov.br/gitlab/groups/lorem/ | ||
| 502 | + :public_software: true | ||
| 503 | + :first_edit: false | ||
| 504 | + :settings: {} | ||
| 505 | +:article_version: | ||
| 506 | + - :id: 313 | ||
| 507 | + :article_id: 302 | ||
| 508 | + :version: 1 | ||
| 509 | + :name: Blog | ||
| 510 | + :slug: blog | ||
| 511 | + :path: blog | ||
| 512 | + :parent_id: | ||
| 513 | + :body: | ||
| 514 | + :abstract: | ||
| 515 | + :profile_id: 1 | ||
| 516 | + :updated_at: 2014-12-05 11:09:16.334973000 Z | ||
| 517 | + :created_at: 2014-12-05 11:09:16.334973000 Z | ||
| 518 | + :last_changed_by_id: | ||
| 519 | + :size: | ||
| 520 | + :content_type: | ||
| 521 | + :filename: | ||
| 522 | + :height: | ||
| 523 | + :width: | ||
| 524 | + :versioned_type: Blog | ||
| 525 | + :comments_count: 0 | ||
| 526 | + :advertise: false | ||
| 527 | + :published: true | ||
| 528 | + :start_date: | ||
| 529 | + :end_date: | ||
| 530 | + :children_count: 0 | ||
| 531 | + :accept_comments: true | ||
| 532 | + :reference_article_id: | ||
| 533 | + :setting: | ||
| 534 | + :notify_comments: true | ||
| 535 | + :hits: 0 | ||
| 536 | + :published_at: 2014-10-21 12:01:07.090025000 Z | ||
| 537 | + :source: | ||
| 538 | + :highlighted: false | ||
| 539 | + :external_link: | ||
| 540 | + :thumbnails_processed: false | ||
| 541 | + :is_image: false | ||
| 542 | + :translation_of_id: | ||
| 543 | + :language: | ||
| 544 | + :source_name: | ||
| 545 | + :license_id: | ||
| 546 | + :image_id: | ||
| 547 | + :position: | ||
| 548 | + :spam_comments_count: 0 | ||
| 549 | + :author_id: | ||
| 550 | + :created_by_id: | ||
| 551 | + - :id: 312 | ||
| 552 | + :article_id: 303 | ||
| 553 | + :version: 1 | ||
| 554 | + :name: feed | ||
| 555 | + :slug: feed | ||
| 556 | + :path: blog/feed | ||
| 557 | + :parent_id: 302 | ||
| 558 | + :body: ! '--- {}' | ||
| 559 | + :abstract: | ||
| 560 | + :profile_id: 1 | ||
| 561 | + :updated_at: 2014-12-05 11:09:16.348735000 Z | ||
| 562 | + :created_at: 2014-12-05 11:09:16.348735000 Z | ||
| 563 | + :last_changed_by_id: | ||
| 564 | + :size: | ||
| 565 | + :content_type: | ||
| 566 | + :filename: | ||
| 567 | + :height: | ||
| 568 | + :width: | ||
| 569 | + :versioned_type: RssFeed | ||
| 570 | + :comments_count: 0 | ||
| 571 | + :advertise: false | ||
| 572 | + :published: true | ||
| 573 | + :start_date: | ||
| 574 | + :end_date: | ||
| 575 | + :children_count: 0 | ||
| 576 | + :accept_comments: true | ||
| 577 | + :reference_article_id: | ||
| 578 | + :setting: | ||
| 579 | + :notify_comments: true | ||
| 580 | + :hits: 0 | ||
| 581 | + :published_at: 2014-12-05 11:09:16.348516000 Z | ||
| 582 | + :source: | ||
| 583 | + :highlighted: false | ||
| 584 | + :external_link: | ||
| 585 | + :thumbnails_processed: false | ||
| 586 | + :is_image: false | ||
| 587 | + :translation_of_id: | ||
| 588 | + :language: | ||
| 589 | + :source_name: | ||
| 590 | + :license_id: | ||
| 591 | + :image_id: | ||
| 592 | + :position: | ||
| 593 | + :spam_comments_count: 0 | ||
| 594 | + :author_id: | ||
| 595 | + :created_by_id: | ||
| 596 | + - :id: 544 | ||
| 597 | + :article_id: 386 | ||
| 598 | + :version: 1 | ||
| 599 | + :name: Em construção | ||
| 600 | + :slug: em-construcao | ||
| 601 | + :path: blog/em-construcao | ||
| 602 | + :parent_id: 302 | ||
| 603 | + :body: ! '<p><span style="font-size: 12pt;">Em construção.</span></p>' | ||
| 604 | + :abstract: '' | ||
| 605 | + :profile_id: 1 | ||
| 606 | + :updated_at: 2014-12-08 11:07:35.818152000 Z | ||
| 607 | + :created_at: 2014-12-08 11:07:35.818152000 Z | ||
| 608 | + :last_changed_by_id: 71 | ||
| 609 | + :size: | ||
| 610 | + :content_type: | ||
| 611 | + :filename: | ||
| 612 | + :height: | ||
| 613 | + :width: | ||
| 614 | + :versioned_type: TinyMceArticle | ||
| 615 | + :comments_count: 0 | ||
| 616 | + :advertise: true | ||
| 617 | + :published: true | ||
| 618 | + :start_date: | ||
| 619 | + :end_date: | ||
| 620 | + :children_count: 0 | ||
| 621 | + :accept_comments: false | ||
| 622 | + :reference_article_id: | ||
| 623 | + :setting: | ||
| 624 | + :notify_comments: true | ||
| 625 | + :hits: 0 | ||
| 626 | + :published_at: 2014-12-08 11:07:35.817826000 Z | ||
| 627 | + :source: | ||
| 628 | + :highlighted: false | ||
| 629 | + :external_link: | ||
| 630 | + :thumbnails_processed: false | ||
| 631 | + :is_image: false | ||
| 632 | + :translation_of_id: | ||
| 633 | + :language: pt | ||
| 634 | + :source_name: | ||
| 635 | + :license_id: | ||
| 636 | + :image_id: | ||
| 637 | + :position: | ||
| 638 | + :spam_comments_count: 0 | ||
| 639 | + :author_id: 71 | ||
| 640 | + :created_by_id: 71 | ||
| 641 | + - :id: 314 | ||
| 642 | + :article_id: 304 | ||
| 643 | + :version: 1 | ||
| 644 | + :name: Gallery | ||
| 645 | + :slug: gallery | ||
| 646 | + :path: gallery | ||
| 647 | + :parent_id: | ||
| 648 | + :body: | ||
| 649 | + :abstract: | ||
| 650 | + :profile_id: 1 | ||
| 651 | + :updated_at: 2014-12-05 11:09:16.544535000 Z | ||
| 652 | + :created_at: 2014-12-05 11:09:16.544535000 Z | ||
| 653 | + :last_changed_by_id: | ||
| 654 | + :size: | ||
| 655 | + :content_type: | ||
| 656 | + :filename: | ||
| 657 | + :height: | ||
| 658 | + :width: | ||
| 659 | + :versioned_type: Gallery | ||
| 660 | + :comments_count: 0 | ||
| 661 | + :advertise: false | ||
| 662 | + :published: true | ||
| 663 | + :start_date: | ||
| 664 | + :end_date: | ||
| 665 | + :children_count: 0 | ||
| 666 | + :accept_comments: true | ||
| 667 | + :reference_article_id: | ||
| 668 | + :setting: | ||
| 669 | + :notify_comments: true | ||
| 670 | + :hits: 0 | ||
| 671 | + :published_at: 2014-10-21 12:01:07.278852000 Z | ||
| 672 | + :source: | ||
| 673 | + :highlighted: false | ||
| 674 | + :external_link: | ||
| 675 | + :thumbnails_processed: false | ||
| 676 | + :is_image: false | ||
| 677 | + :translation_of_id: | ||
| 678 | + :language: | ||
| 679 | + :source_name: | ||
| 680 | + :license_id: | ||
| 681 | + :image_id: | ||
| 682 | + :position: | ||
| 683 | + :spam_comments_count: 0 | ||
| 684 | + :author_id: | ||
| 685 | + :created_by_id: | ||
| 686 | + - :id: 315 | ||
| 687 | + :article_id: 305 | ||
| 688 | + :version: 1 | ||
| 689 | + :name: Documentação | ||
| 690 | + :slug: documentacao | ||
| 691 | + :path: documentacao | ||
| 692 | + :parent_id: | ||
| 693 | + :body: Pasta | ||
| 694 | + :abstract: | ||
| 695 | + :profile_id: 1 | ||
| 696 | + :updated_at: 2014-12-05 11:09:16.591802000 Z | ||
| 697 | + :created_at: 2014-12-05 11:09:16.591802000 Z | ||
| 698 | + :last_changed_by_id: | ||
| 699 | + :size: | ||
| 700 | + :content_type: | ||
| 701 | + :filename: | ||
| 702 | + :height: | ||
| 703 | + :width: | ||
| 704 | + :versioned_type: Folder | ||
| 705 | + :comments_count: 0 | ||
| 706 | + :advertise: false | ||
| 707 | + :published: true | ||
| 708 | + :start_date: | ||
| 709 | + :end_date: | ||
| 710 | + :children_count: 0 | ||
| 711 | + :accept_comments: false | ||
| 712 | + :reference_article_id: | ||
| 713 | + :setting: | ||
| 714 | + :notify_comments: true | ||
| 715 | + :hits: 0 | ||
| 716 | + :published_at: 2014-12-04 18:24:31.823160000 Z | ||
| 717 | + :source: | ||
| 718 | + :highlighted: false | ||
| 719 | + :external_link: | ||
| 720 | + :thumbnails_processed: false | ||
| 721 | + :is_image: false | ||
| 722 | + :translation_of_id: | ||
| 723 | + :language: | ||
| 724 | + :source_name: | ||
| 725 | + :license_id: 1 | ||
| 726 | + :image_id: | ||
| 727 | + :position: | ||
| 728 | + :spam_comments_count: 0 | ||
| 729 | + :author_id: | ||
| 730 | + :created_by_id: | ||
| 731 | + - :id: 1170 | ||
| 732 | + :article_id: 305 | ||
| 733 | + :version: 2 | ||
| 734 | + :name: Documentação | ||
| 735 | + :slug: documentacao | ||
| 736 | + :path: documentacao | ||
| 737 | + :parent_id: | ||
| 738 | + :body: Pasta destinada para documentação | ||
| 739 | + :abstract: | ||
| 740 | + :profile_id: 1 | ||
| 741 | + :updated_at: 2015-01-29 13:00:52.171667000 Z | ||
| 742 | + :created_at: 2014-12-05 11:09:16.591802000 Z | ||
| 743 | + :last_changed_by_id: 82 | ||
| 744 | + :size: | ||
| 745 | + :content_type: | ||
| 746 | + :filename: | ||
| 747 | + :height: | ||
| 748 | + :width: | ||
| 749 | + :versioned_type: Folder | ||
| 750 | + :comments_count: 0 | ||
| 751 | + :advertise: true | ||
| 752 | + :published: true | ||
| 753 | + :start_date: | ||
| 754 | + :end_date: | ||
| 755 | + :children_count: 0 | ||
| 756 | + :accept_comments: false | ||
| 757 | + :reference_article_id: | ||
| 758 | + :setting: | ||
| 759 | + :notify_comments: true | ||
| 760 | + :hits: 73 | ||
| 761 | + :published_at: 2014-12-04 18:24:31.823160000 Z | ||
| 762 | + :source: | ||
| 763 | + :highlighted: false | ||
| 764 | + :external_link: | ||
| 765 | + :thumbnails_processed: false | ||
| 766 | + :is_image: false | ||
| 767 | + :translation_of_id: | ||
| 768 | + :language: | ||
| 769 | + :source_name: | ||
| 770 | + :license_id: | ||
| 771 | + :image_id: | ||
| 772 | + :position: | ||
| 773 | + :spam_comments_count: 0 | ||
| 774 | + :author_id: | ||
| 775 | + :created_by_id: |
| 1 | +++ a/import_profile | ||
| @@ -0,0 +1,39 @@ | @@ -0,0 +1,39 @@ | ||
| 1 | +#!/usr/bin/env ruby | ||
| 2 | + | ||
| 3 | +require 'rubygems' | ||
| 4 | +require "#{File.dirname(__FILE__)}/../config/environment" | ||
| 5 | + | ||
| 6 | +def import_profile(config) | ||
| 7 | + puts "Importing profile" | ||
| 8 | + config.keys.each do |record_type| | ||
| 9 | + puts record_type.to_s | ||
| 10 | + puts "#{config[record_type].size} registros" | ||
| 11 | + if record_type == :article_version | ||
| 12 | + klass = Article::Version | ||
| 13 | + else | ||
| 14 | + klass = record_type.to_s.camelize.constantize | ||
| 15 | + end | ||
| 16 | + config[record_type.to_sym].each do |attrs| | ||
| 17 | + settings = attrs.keys.select { |k| attrs[k.to_sym].is_a? Hash } | ||
| 18 | + names = attrs.except(*settings).keys | ||
| 19 | + values = names.map {|k| ActiveRecord::Base.send(:sanitize_sql_array, ['?', attrs[k.to_sym]]) } | ||
| 20 | + sql = 'insert into %s(%s) values (%s)' % [klass.table_name, names.join(','), values.join(',')] | ||
| 21 | + klass.connection.execute(sql) | ||
| 22 | + record = klass.find(attrs[:id]) | ||
| 23 | + | ||
| 24 | + settings.each do |setting| | ||
| 25 | + record.send("#{setting}=", attrs[setting.to_sym]) | ||
| 26 | + record.save | ||
| 27 | + end | ||
| 28 | + end | ||
| 29 | + end | ||
| 30 | +end | ||
| 31 | + | ||
| 32 | +if ARGV.blank? | ||
| 33 | + puts "--- Please provide the yaml configuration file ---" | ||
| 34 | + exit 0 | ||
| 35 | +else | ||
| 36 | + $config_file = ARGV[0] | ||
| 37 | + config = YAML::load_file($config_file) | ||
| 38 | + import_profile config | ||
| 39 | +end |