mercator_legacy_importer 0.0.1 → 0.1

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.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +22 -1
  3. data/app/models/mercator_legacy_importer/asset.rb +6 -3
  4. data/app/models/mercator_legacy_importer/attachable.rb +7 -4
  5. data/app/models/mercator_legacy_importer/category.rb +10 -7
  6. data/app/models/mercator_legacy_importer/category_translation.rb +9 -6
  7. data/app/models/mercator_legacy_importer/cms_node.rb +8 -5
  8. data/app/models/mercator_legacy_importer/cms_node_translation.rb +9 -6
  9. data/app/models/mercator_legacy_importer/connector.rb +8 -5
  10. data/app/models/mercator_legacy_importer/content.rb +7 -4
  11. data/app/models/mercator_legacy_importer/content_item.rb +7 -4
  12. data/app/models/mercator_legacy_importer/country.rb +6 -3
  13. data/app/models/mercator_legacy_importer/page_template.rb +9 -6
  14. data/app/models/mercator_legacy_importer/product.rb +12 -9
  15. data/app/models/mercator_legacy_importer/product_overview_property.rb +6 -3
  16. data/app/models/mercator_legacy_importer/product_property.rb +8 -5
  17. data/app/models/mercator_legacy_importer/product_relation.rb +6 -3
  18. data/app/models/mercator_legacy_importer/product_supply.rb +6 -3
  19. data/app/models/mercator_legacy_importer/product_translation.rb +10 -7
  20. data/app/models/mercator_legacy_importer/property.rb +12 -9
  21. data/app/models/mercator_legacy_importer/property_translation.rb +9 -6
  22. data/app/models/mercator_legacy_importer/recommendation.rb +9 -7
  23. data/app/models/mercator_legacy_importer/recommendation_translation.rb +10 -7
  24. data/app/models/mercator_legacy_importer/user.rb +6 -3
  25. data/app/views/layouts/mercator_legacy_importer/application.html.erb +10 -11
  26. data/db/migrate/20131202162757_add_legacy_ids.rb +10 -6
  27. data/lib/mercator_legacy_importer/version.rb +2 -2
  28. data/lib/tasks/categories.rake +43 -0
  29. data/lib/tasks/categorizations.rake +43 -0
  30. data/lib/tasks/category_images.rake +42 -34
  31. data/lib/tasks/cms_node_images.rake +91 -81
  32. data/lib/tasks/content_elements.rake +66 -44
  33. data/lib/tasks/countries.rake +16 -10
  34. data/lib/tasks/features.rake +25 -17
  35. data/lib/tasks/page_template.rake +16 -9
  36. data/lib/tasks/product_images.rake +25 -8
  37. data/lib/tasks/product_relations.rake +21 -13
  38. data/lib/tasks/products.rake +52 -39
  39. data/lib/tasks/properties.rake +45 -36
  40. data/lib/tasks/recommendations.rake +30 -19
  41. data/lib/tasks/remaining_assets.rake +34 -26
  42. data/lib/tasks/remaining_images.rake +34 -26
  43. data/lib/tasks/supply_relations.rake +23 -13
  44. data/lib/tasks/unlinked_content_items.rake +24 -18
  45. data/lib/tasks/users.rake +43 -10
  46. data/lib/tasks/webpages.rake +34 -0
  47. metadata +30 -39
  48. data/app/helpers/mercator_legacy_importer/application_helper.rb +0 -4
  49. data/config/database.yml +0 -13
  50. data/db/migrate/20131202164442_products_add_legacy_id.rb +0 -9
  51. data/db/migrate/20140103154252_add_legacy_id_to_page.rb +0 -9
  52. data/db/migrate/20140103161205_add_legacy_id_to_page_template.rb +0 -9
  53. data/db/migrate/20140104094617_add_legacy_id_to_feature.rb +0 -9
  54. data/db/migrate/20140107090420_add_legacy_id_to_content_elements.rb +0 -9
  55. data/lib/tasks/categories.rb +0 -32
  56. data/lib/tasks/categorizations.rb +0 -35
  57. data/lib/tasks/mercator_legacy_importer_tasks.rake +0 -34
  58. data/lib/tasks/pages.rake +0 -27
  59. data/lib/tasks/unlinked_content_elements.rake +0 -60
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93068ca5a08c030d63fcb949b9837410e2583b0d
4
- data.tar.gz: ba5c5e67edb049dc22781a4f08796991abf3dea2
3
+ metadata.gz: f34a50c820ad9318809e2ff0838fc2d5b227795f
4
+ data.tar.gz: bb4eba7aecc84afc8d64b60e3546302ba5aa6a9c
5
5
  SHA512:
6
- metadata.gz: 072da834941eacb560bc4988b07373105d3f3f4297c7e0fc84cf073779da34c6c47bc34da7efb591b89fc6f84fafc75ed681b8840c6bbb40976c2fa2cee92aad
7
- data.tar.gz: 8b8e39f91604552f98dd59863a28e3e615ebf3663e62906eb43f32ea4dc2883c9b3a861fb0d6d26667cc1cd9d4ba1c3f6723556b7388e788c5510dfada5b35c9
6
+ metadata.gz: 19949f645e147de206c5b6c164f688b584035eb18293fc1b00401a3846b49cf0f2736c88982f4f3581881f459ba5e182be2f74b0921bd8041c51bbccaa9d35b3
7
+ data.tar.gz: 2a2e4b838ca3b0c1b45cada56727d83544bff2e0afeb9f2923adaaa50c8e7645da140a4adf5b3ff230dbd3f26c86e418eafc293bee95544c604b88b5c19a6ac6
data/README.rdoc CHANGED
@@ -3,4 +3,25 @@
3
3
  This is am sample engine for importing data from a legacy MYSQL database.
4
4
  Look into the models and the lib/tasks folder for examples for connecting to a database and importing data.
5
5
 
6
- This project uses the GPL V3 license. See file LICENSE in the same directory for details about the GPL V3.
6
+ This project uses the GPL V3 license. See file LICENSE in the same directory for details about the GPL V3.
7
+
8
+ # Installation instructions
9
+
10
+ 1. Put in your Gemfile
11
+ '''ruby
12
+ gem "mercator_legacy_importer"
13
+ '''
14
+ 2. Instell gem by running
15
+ '''ruby
16
+ bundle install
17
+ '''
18
+ 3.2 Get all migrations into your app by running in your ipp directory
19
+ '''ruby
20
+ rake mercator_legacy_importer:install:migrations
21
+ '''
22
+ 4. Run Migrations added
23
+ '''ruby
24
+ rake db:migrate
25
+ '''
26
+ 5. Mount the Engine in your routes.rb
27
+ mount MercatorLegacyImporter::Engine => "/mercator_legacy_importer"
@@ -1,4 +1,7 @@
1
- class Legacy::Asset < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'assets'
1
+ module MercatorLegacyImporter
2
+ class Asset < ActiveRecord::Base
3
+
4
+ establish_connection "import_development"
5
+ self.table_name = 'assets'
6
+ end
4
7
  end
@@ -1,6 +1,9 @@
1
- class Legacy::Attachable < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'attachables'
1
+ module MercatorLegacyImporter
2
+ class Attachable < ActiveRecord::Base
4
3
 
5
- belongs_to :asset
4
+ establish_connection "import_development"
5
+ self.table_name = 'attachables'
6
+
7
+ belongs_to :asset
8
+ end
6
9
  end
@@ -1,10 +1,13 @@
1
- class Legacy::Category < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'categories'
1
+ module MercatorLegacyImporter
4
2
 
5
- # The following two lines fix the migration issues
6
- hobo_model
7
- fields
3
+ class Category < ActiveRecord::Base
4
+ establish_connection "import_development"
5
+ self.table_name = 'categories'
8
6
 
9
- has_many :category_translations
7
+ # The following two lines fix the migration issues
8
+ hobo_model
9
+ fields
10
+
11
+ has_many :category_translations
12
+ end
10
13
  end
@@ -1,8 +1,11 @@
1
- class Legacy::CategoryTranslation < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'category_translations'
1
+ module MercatorLegacyImporter
2
+ class CategoryTranslation < ActiveRecord::Base
4
3
 
5
- belongs_to :category
6
- scope :german, -> { where(locale: "de") }
7
- scope :english, -> { where(locale: "en") }
4
+ establish_connection "import_development"
5
+ self.table_name = 'category_translations'
6
+
7
+ belongs_to :category
8
+ scope :german, -> { where(locale: "de") }
9
+ scope :english, -> { where(locale: "en") }
10
+ end
8
11
  end
@@ -1,7 +1,10 @@
1
- class Legacy::CmsNode < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'cms_nodes'
1
+ module MercatorLegacyImporter
2
+ class CmsNode < ActiveRecord::Base
4
3
 
5
- has_many :cms_node_translations
6
- has_many :connectors
4
+ establish_connection "import_development"
5
+ self.table_name = 'cms_nodes'
6
+
7
+ has_many :cms_node_translations
8
+ has_many :connectors
9
+ end
7
10
  end
@@ -1,8 +1,11 @@
1
- class Legacy::CmsNodeTranslation < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'cms_node_translations'
1
+ module MercatorLegacyImporter
2
+ class CmsNodeTranslation < ActiveRecord::Base
4
3
 
5
- belongs_to :cms_node
6
- scope :german, -> { where(locale: "de") }
7
- scope :english, -> { where(locale: "en") }
4
+ establish_connection "import_development"
5
+ self.table_name = 'cms_node_translations'
6
+
7
+ belongs_to :cms_node
8
+ scope :german, -> { where(locale: "de") }
9
+ scope :english, -> { where(locale: "en") }
10
+ end
8
11
  end
@@ -1,7 +1,10 @@
1
- class Legacy::Connector < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'connectors'
1
+ module MercatorLegacyImporter
2
+ class Connector < ActiveRecord::Base
4
3
 
5
- belongs_to :content
6
- belongs_to :cms_node
4
+ establish_connection "import_development"
5
+ self.table_name = 'connectors'
6
+
7
+ belongs_to :content
8
+ belongs_to :cms_node
9
+ end
7
10
  end
@@ -1,6 +1,9 @@
1
- class Legacy::Content < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'contents'
1
+ module MercatorLegacyImporter
2
+ class Content < ActiveRecord::Base
4
3
 
5
- has_many :connectors
4
+ establish_connection "import_development"
5
+ self.table_name = 'contents'
6
+
7
+ has_many :connectors
8
+ end
6
9
  end
@@ -1,6 +1,9 @@
1
- class Legacy::ContentItem < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'content_items'
1
+ module MercatorLegacyImporter
2
+ class ContentItem < ActiveRecord::Base
4
3
 
5
- belongs_to :content
4
+ establish_connection "import_development"
5
+ self.table_name = 'content_items'
6
+
7
+ belongs_to :content
8
+ end
6
9
  end
@@ -1,4 +1,7 @@
1
- class Legacy::Country < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'zones'
1
+ module MercatorLegacyImporter
2
+ class Country < ActiveRecord::Base
3
+
4
+ establish_connection "import_development"
5
+ self.table_name = 'zones'
6
+ end
4
7
  end
@@ -1,8 +1,11 @@
1
- class Legacy::PageTemplate < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'page_templates'
1
+ module MercatorLegacyImporter
2
+ class PageTemplate < ActiveRecord::Base
4
3
 
5
- # The following two lines fix the migration issues
6
- hobo_model
7
- fields
4
+ establish_connection "import_development"
5
+ self.table_name = 'page_templates'
6
+
7
+ # The following two lines fix the migration issues
8
+ hobo_model
9
+ fields
10
+ end
8
11
  end
@@ -1,12 +1,15 @@
1
- class Legacy::Product < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'products'
1
+ module MercatorLegacyImporter
2
+ class Product < ActiveRecord::Base
4
3
 
5
- # The following two lines fix the migration issues
6
- hobo_model
7
- fields
4
+ establish_connection "import_development"
5
+ self.table_name = 'products'
8
6
 
9
- has_many :product_translations
10
- has_many :product_properties
11
- has_many :properties , :through => :product_properties
7
+ # The following two lines fix the migration issues
8
+ hobo_model
9
+ fields
10
+
11
+ has_many :product_translations
12
+ has_many :product_properties
13
+ has_many :properties , :through => :product_properties
14
+ end
12
15
  end
@@ -1,4 +1,7 @@
1
- class Legacy::ProductOverviewProperty < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'product_overview_properties'
1
+ module MercatorLegacyImporter
2
+ class ProductOverviewProperty < ActiveRecord::Base
3
+
4
+ establish_connection "import_development"
5
+ self.table_name = 'product_overview_properties'
6
+ end
4
7
  end
@@ -1,7 +1,10 @@
1
- class Legacy::ProductProperty < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'products_properties'
1
+ module MercatorLegacyImporter
2
+ class ProductProperty < ActiveRecord::Base
4
3
 
5
- belongs_to :product
6
- belongs_to :property
4
+ establish_connection "import_development"
5
+ self.table_name = 'products_properties'
6
+
7
+ belongs_to :product
8
+ belongs_to :property
9
+ end
7
10
  end
@@ -1,4 +1,7 @@
1
- class Legacy::ProductRelation < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'product_relations'
1
+ module MercatorLegacyImporter
2
+ class ProductRelation < ActiveRecord::Base
3
+
4
+ establish_connection "import_development"
5
+ self.table_name = 'product_relations'
6
+ end
4
7
  end
@@ -1,4 +1,7 @@
1
- class Legacy::ProductSupply < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'product_supplies'
1
+ module MercatorLegacyImporter
2
+ class ProductSupply < ActiveRecord::Base
3
+
4
+ establish_connection "import_development"
5
+ self.table_name = 'product_supplies'
6
+ end
4
7
  end
@@ -1,8 +1,11 @@
1
- class Legacy::ProductTranslation < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'product_translations'
1
+ module MercatorLegacyImporter
2
+ class ProductTranslation < ActiveRecord::Base
4
3
 
5
- belongs_to :product
6
- scope :german, -> { where(locale: "de") }
7
- scope :english, -> { where(locale: "en") }
8
- end
4
+ establish_connection "import_development"
5
+ self.table_name = 'product_translations'
6
+
7
+ belongs_to :product
8
+ scope :german, -> { where(locale: "de") }
9
+ scope :english, -> { where(locale: "en") }
10
+ end
11
+ end
@@ -1,13 +1,16 @@
1
- class Legacy::Property < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'properties'
1
+ module MercatorLegacyImporter
2
+ class Property < ActiveRecord::Base
4
3
 
5
- # The following two lines fix the migration issues
6
- hobo_model
7
- fields
4
+ establish_connection "import_development"
5
+ self.table_name = 'properties'
8
6
 
9
- has_many :property_translations
7
+ # The following two lines fix the migration issues
8
+ hobo_model
9
+ fields
10
10
 
11
- has_many :product_properties
12
- has_many :products, :through => :product_properties
11
+ has_many :property_translations
12
+
13
+ has_many :product_properties
14
+ has_many :products, :through => :product_properties
15
+ end
13
16
  end
@@ -1,8 +1,11 @@
1
- class Legacy::PropertyTranslation < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'property_translations'
1
+ module MercatorLegacyImporter
2
+ class PropertyTranslation < ActiveRecord::Base
4
3
 
5
- belongs_to :property
6
- scope :german, -> { where(locale: "de") }
7
- scope :english, -> { where(locale: "en") }
4
+ establish_connection "import_development"
5
+ self.table_name = 'property_translations'
6
+
7
+ belongs_to :property
8
+ scope :german, -> { where(locale: "de") }
9
+ scope :english, -> { where(locale: "en") }
10
+ end
8
11
  end
@@ -1,10 +1,12 @@
1
- class Legacy::Recommendation < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'recommendations'
1
+ module MercatorLegacyImporter
2
+ class Recommendation < ActiveRecord::Base
3
+ establish_connection "import_development"
4
+ self.table_name = 'recommendations'
4
5
 
5
- # The following two lines fix the migration issues
6
- hobo_model
7
- fields
6
+ # The following two lines fix the migration issues
7
+ hobo_model
8
+ fields
8
9
 
9
- has_many :recommendation_translations
10
+ has_many :recommendation_translations
11
+ end
10
12
  end
@@ -1,8 +1,11 @@
1
- class Legacy::RecommendationTranslation < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'recommendation_translations'
1
+ module MercatorLegacyImporter
2
+ class RecommendationTranslation < ActiveRecord::Base
4
3
 
5
- belongs_to :recommendation
6
- scope :german, -> { where(locale: "de") }
7
- scope :english, -> { where(locale: "en") }
8
- end
4
+ establish_connection "import_development"
5
+ self.table_name = 'recommendation_translations'
6
+
7
+ belongs_to :recommendation
8
+ scope :german, -> { where(locale: "de") }
9
+ scope :english, -> { where(locale: "en") }
10
+ end
11
+ end
@@ -1,4 +1,7 @@
1
- class Legacy::User < ActiveRecord::Base
2
- establish_connection "import_development"
3
- self.table_name = 'ivellio_vellin_customers'
1
+ module MercatorLegacyImporter
2
+ class User < ActiveRecord::Base
3
+
4
+ establish_connection "import_development"
5
+ self.table_name = 'ivellio_vellin_customers'
6
+ end
4
7
  end
@@ -1,14 +1,13 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>MercatorLegacyImporter</title>
5
- <%= stylesheet_link_tag "mercator_legacy_importer/application", media: "all" %>
6
- <%= javascript_include_tag "mercator_legacy_importer/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
3
+ <head>
4
+ <title>Mercator Legacy Importer</title>
5
+ <%= stylesheet_link_tag "mercator_legacy_importer/application", media: "all" %>
6
+ <%= javascript_include_tag "mercator_legacy_importer/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
10
9
 
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>