cdm_migrator 3.2.0 → 3.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -20
  3. data/README.md +41 -41
  4. data/Rakefile +38 -38
  5. data/app/assets/config/cdm_migrator_manifest.js +2 -2
  6. data/app/assets/javascripts/cdm_migrator/application.js +13 -13
  7. data/app/assets/stylesheets/cdm_migrator/application.css +15 -15
  8. data/app/assets/stylesheets/cdm_migrator/csv_checker.css +36 -36
  9. data/app/controllers/cdm_migrator/application_controller.rb +10 -10
  10. data/app/controllers/cdm_migrator/cdm_controller.rb +216 -213
  11. data/app/controllers/cdm_migrator/csv_controller.rb +428 -371
  12. data/app/helpers/cdm_migrator/application_helper.rb +4 -4
  13. data/app/jobs/cdm_migrator/application_job.rb +4 -4
  14. data/app/jobs/cdm_migrator/batch_create_files_job.rb +32 -20
  15. data/app/jobs/cdm_migrator/batch_create_files_with_ordered_members_job.rb +45 -0
  16. data/app/jobs/cdm_migrator/batch_create_works_job.rb +20 -14
  17. data/app/jobs/cdm_migrator/cdm_ingest_files_job.rb +35 -35
  18. data/app/jobs/cdm_migrator/create_work_job.rb +36 -25
  19. data/app/jobs/cdm_migrator/restart_upload_from_middle_job.rb +36 -0
  20. data/app/jobs/cdm_migrator/update_object_job.rb +10 -10
  21. data/app/mailers/cdm_migrator/application_mailer.rb +6 -6
  22. data/app/models/cdm_migrator/application_record.rb +5 -5
  23. data/app/models/cdm_migrator/batch_ingest.rb +33 -33
  24. data/app/models/cdm_migrator/ingest_work.rb +7 -16
  25. data/app/views/cdm_migrator/cdm/collection.html.erb +11 -11
  26. data/app/views/cdm_migrator/cdm/mappings.html.erb +54 -53
  27. data/app/views/cdm_migrator/csv/_batches_list.html.erb +4 -4
  28. data/app/views/cdm_migrator/csv/_default_group.html.erb +17 -17
  29. data/app/views/cdm_migrator/csv/_error_list.html.erb +21 -0
  30. data/app/views/cdm_migrator/csv/_list_batches.html.erb +21 -21
  31. data/app/views/cdm_migrator/csv/_tabs.html.erb +8 -8
  32. data/app/views/cdm_migrator/csv/csv_checker.html.erb +45 -45
  33. data/app/views/cdm_migrator/csv/edit.html.erb +17 -18
  34. data/app/views/cdm_migrator/csv/index.html.erb +19 -19
  35. data/app/views/cdm_migrator/csv/upload.html.erb +18 -18
  36. data/app/views/layouts/cdm_migrator/application.html.erb +14 -14
  37. data/config/routes.rb +19 -19
  38. data/db/migrate/20191211193859_create_batch_ingests.rb +19 -19
  39. data/db/migrate/20191212192315_create_ingest_works.rb +18 -18
  40. data/lib/cdm_migrator/engine.rb +29 -29
  41. data/lib/cdm_migrator/version.rb +3 -3
  42. data/lib/cdm_migrator.rb +5 -5
  43. data/lib/generators/cdm_migrator/install/install_generator.rb +79 -79
  44. data/lib/generators/cdm_migrator/install/templates/config/cdm_migrator.yml +53 -50
  45. data/lib/generators/cdm_migrator/install/templates/presenters/hyku/menu_presenter.rb +47 -47
  46. data/lib/generators/cdm_migrator/install/templates/presenters/hyrax/menu_presenter.rb +66 -66
  47. data/lib/generators/cdm_migrator/install/templates/sidebar/_tasks.html.erb +55 -55
  48. data/lib/tasks/cdm_migrator_tasks.rake +4 -4
  49. metadata +6 -6
  50. data/app/views/cdm_migrator/csv/_path_list.html.erb +0 -19
  51. data/app/views/cdm_migrator/csv/_results_pagination.html.erb +0 -9
@@ -0,0 +1,21 @@
1
+ <% if @error_list && @error_list.any? %>
2
+ <%#= @error_list.inspect %>
3
+ <table class="table table-striped">
4
+ <thead>
5
+ <tr>
6
+ <th scope="col" style="min-width: 100px;">Line No.</th>
7
+ <th scope="col" style="margin-right: 0.5em;">Column(s)</th>
8
+ <th scope="col">Issue</th>
9
+ </tr>
10
+ </thead>
11
+ <tbody>
12
+ <% @error_list.keys.each do |line_number| %>
13
+ <tr>
14
+ <td><%= line_number %></td>
15
+ <td><%= @error_list[line_number].keys.join("<br />").html_safe %></td>
16
+ <td><%= @error_list[line_number].values.join("<br />").html_safe %></td>
17
+ </tr>
18
+ <% end %>
19
+ </tbody>
20
+ </table>
21
+ <% end %>
@@ -1,21 +1,21 @@
1
- <tr id="batch_<%= batch.id %>">
2
-
3
- <td><%= batch.name %></td>
4
-
5
- <td class="date"><%= batch.created_at %></td>
6
-
7
- <td><%= batch.username %></td>
8
-
9
-
10
- <td><%= batch.progress %></td>
11
- <td><%= batch.message? ? "<button onclick=\"alert('#{batch.message.html_safe}');\">View Message</button>".html_safe : "No Message" %></td>
12
-
13
- <td>
14
- <%= link_to(
15
- "Run Again",
16
- main_app.csv_rerun_path(id: batch.id),
17
- data: { 'create-type' => 'batch' },
18
- class: 'btn btn-primary'
19
- ) if batch.complete? && (current_ability.admin? || current_page?(main_app.csv_my_batches_path(locale: nil))) %>
20
- </td>
21
- </tr>
1
+ <tr id="batch_<%= batch.id %>">
2
+
3
+ <td><%= batch.name %></td>
4
+
5
+ <td class="date"><%= batch.created_at %></td>
6
+
7
+ <td><%= batch.username %></td>
8
+
9
+
10
+ <td><%= batch.progress %></td>
11
+ <td><%= batch.message? ? "<button onclick=\"alert('#{batch.message.html_safe}');\">View Message</button>".html_safe : "No Message" %></td>
12
+
13
+ <td>
14
+ <%= link_to(
15
+ "Run Again",
16
+ main_app.csv_rerun_path(id: batch.id),
17
+ data: { 'create-type' => 'batch' },
18
+ class: 'btn btn-primary'
19
+ ) if batch.complete? && (current_ability.admin? || current_page?(main_app.csv_my_batches_path(locale: nil))) %>
20
+ </td>
21
+ </tr>
@@ -1,8 +1,8 @@
1
- <ul class="nav nav-tabs" id="my_nav" role="navigation">
2
- <li<%= ' class="active"'.html_safe if current_page?(main_app.csv_all_batches_path(locale: nil)) %>>
3
- <%= link_to "All CSV Batches", main_app.csv_all_batches_path %>
4
- </li>
5
- <li<%= ' class="active"'.html_safe if current_page?(main_app.csv_my_batches_path(locale: nil)) %>>
6
- <%= link_to "My CSV Batches", main_app.csv_my_batches_path %>
7
- </li>
8
- </ul>
1
+ <ul class="nav nav-tabs" id="my_nav" role="navigation">
2
+ <li<%= ' class="active"'.html_safe if current_page?(main_app.csv_all_batches_path(locale: nil)) %>>
3
+ <%= link_to "All CSV Batches", main_app.csv_all_batches_path %>
4
+ </li>
5
+ <li<%= ' class="active"'.html_safe if current_page?(main_app.csv_my_batches_path(locale: nil)) %>>
6
+ <%= link_to "My CSV Batches", main_app.csv_my_batches_path %>
7
+ </li>
8
+ </ul>
@@ -1,46 +1,46 @@
1
- <% provide :page_title, "CSV Checker" %>
2
-
3
- <%#= flash[:alert].join("<br/>") if flash[:alert] %>
4
-
5
- <h1>CSV Checker</h1>
6
-
7
- <!-- <div class="row"> -->
8
- <p>This tool validates CSV data and creates a table listing any errors.</p>
9
-
10
- <a role="button" class="collapse-toggle collapsed csv-collapse-link" data-toggle="collapse" data-target="#errors-explanation" aria-expanded="false">
11
- <span id="csv-collapse-link-text">Expand for more details</span>
12
- </a>
13
- <div class="collapse" id="errors-explanation">
14
- <ul>
15
- <li><strong>File paths: </strong>The url field contains a valid path to a file.</li>
16
- <li><strong>Multi-value separator: </strong>Configured fields with URIs contain the right separator character (e.g. |).</li>
17
- <% if @path_to_drive.present? %>
18
- <li><strong>Mounted drive: </strong>A mounted directory (folder) exists and is not empty.</li>
19
- <% end %>
20
- <% if @edtf_fields.present? %>
21
- <li><strong>EDTF dates: </strong>Configured fields contain valid <a href="https://www.loc.gov/standards/datetime/" target="_blank">EDTF</a> dates or "unknown."</li>
22
- <% end %>
23
- <% if @uri_fields.present? %>
24
- <li><strong>Valid URIs ("page" vs "vocab"): </strong>Configured fields with URIs link to the "vocab" address rather than the "page" address. For example, rights_statement should be "http://rightsstatement.org/vocab/..." and not "https://rightsstatement.org/page/..."</li>
25
- <% end %>
26
- </ul>
27
- </div>
28
-
29
-
30
-
31
- <%= form_tag(check_csv_path, remote: true, method: :post, multipart: true, id: "csv-form") do %>
32
- <div class="input-group">
33
- <%= label_tag :multi_value_separator %>
34
- <%= text_field_tag(:multi_value_separator, @separator, size: 1) %>
35
- <%= file_field_tag(:file, class: "form-control-file") %>
36
- <%= hidden_field_tag :authenticity_token, value: form_authenticity_token %>
37
- <%= button_tag(type: :submit, class: "btn btn-large btn-primary", style: "margin-top: 1em;") do %>
38
- Check CSV
39
- <% end %>
40
- <% end %>
41
- </div>
42
- <!-- </div> -->
43
-
44
- <div id="error_list" class="col-md-10 offset-md-1">
45
- <%= render 'error_list' %>
1
+ <% provide :page_title, "CSV Checker" %>
2
+
3
+ <%#= flash[:alert].join("<br/>") if flash[:alert] %>
4
+
5
+ <h1>CSV Checker</h1>
6
+
7
+ <!-- <div class="row"> -->
8
+ <p>This tool validates CSV data and creates a table listing any errors.</p>
9
+
10
+ <a role="button" class="collapse-toggle collapsed csv-collapse-link" data-toggle="collapse" data-target="#errors-explanation" aria-expanded="false">
11
+ <span id="csv-collapse-link-text">Expand for more details</span>
12
+ </a>
13
+ <div class="collapse" id="errors-explanation">
14
+ <ul>
15
+ <li><strong>File paths: </strong>The url field contains a valid path to a file.</li>
16
+ <li><strong>Multi-value separator: </strong>Configured fields with URIs contain the right separator character (e.g. |).</li>
17
+ <% if @path_to_drive.present? %>
18
+ <li><strong>Mounted drive: </strong>A mounted directory (folder) exists and is not empty.</li>
19
+ <% end %>
20
+ <% if @edtf_fields.present? %>
21
+ <li><strong>EDTF dates: </strong>Configured fields contain valid <a href="https://www.loc.gov/standards/datetime/" target="_blank">EDTF</a> dates or "unknown."</li>
22
+ <% end %>
23
+ <% if @uri_fields.present? %>
24
+ <li><strong>Valid URIs ("page" vs "vocab"): </strong>Configured fields with URIs link to the "vocab" address rather than the "page" address. For example, rights_statement should be "http://rightsstatement.org/vocab/..." and not "https://rightsstatement.org/page/..."</li>
25
+ <% end %>
26
+ </ul>
27
+ </div>
28
+
29
+
30
+
31
+ <%= form_tag(check_csv_path, remote: true, method: :post, multipart: true, id: "csv-form") do %>
32
+ <div class="input-group">
33
+ <%= label_tag :multi_value_separator %>
34
+ <%= text_field_tag(:multi_value_separator, @separator, size: 1) %>
35
+ <%= file_field_tag(:file, class: "form-control-file") %>
36
+ <%= hidden_field_tag :authenticity_token, value: form_authenticity_token %>
37
+ <%= button_tag(type: :submit, class: "btn btn-large btn-primary", style: "margin-top: 1em;") do %>
38
+ Check CSV
39
+ <% end %>
40
+ <% end %>
41
+ </div>
42
+ <!-- </div> -->
43
+
44
+ <div id="error_list" class="col-md-10 offset-md-1">
45
+ <%= render 'error_list' %>
46
46
  </div>
@@ -1,18 +1,17 @@
1
-
2
- <h1><span class="fa fa-map"></span> Export </h1>
3
-
4
- <%= form_tag main_app.csv_export_path, method: :post do %>
5
- <%= select_tag 'collection_id', options_for_select(@collections), include_blank: true %>
6
- <%= submit_tag "Download CSV", class: 'btn btn-primary' %>
7
- <% end %>
8
-
9
- <h1><span class="fa fa-map"></span> Update </h1>
10
-
11
- <%= form_for :csv_update, url: csv_update_path do |f| %>
12
- <%= f.label 'Multi-value Separator:' %>
13
- <%= f.text_field 'mvs' %>
14
- <br />
15
- <%= f.file_field 'csv_file' %>
16
- <br />
17
- <%= f.submit 'Save' %>
18
- <% end %>
1
+
2
+ <h1><span class="fa fa-map"></span> Export </h1>
3
+
4
+ <%= form_tag main_app.csv_export_path, method: :post do %>
5
+ <%= select_tag 'collection_id', options_for_select(@collections.sort { |x,y| x[0].downcase <=> y[0].downcase }), include_blank: true %>
6
+ <%= submit_tag "Download CSV", class: 'btn btn-primary' %>
7
+ <% end %>
8
+ <h1><span class="fa fa-map"></span> Update </h1>
9
+
10
+ <%= form_for :csv_update, url: csv_update_path do |f| %>
11
+ <%= f.label 'Multi-value Separator:' %>
12
+ <%= f.text_field 'mvs' %>
13
+ <br />
14
+ <%= f.file_field 'csv_file' %>
15
+ <br />
16
+ <%= f.submit 'Save' %>
17
+ <% end %>
@@ -1,19 +1,19 @@
1
- <% provide :page_title, "Batches" %>
2
-
3
-
4
- <% provide :page_header do %>
5
- <h1><span class="fa fa-database" aria-hidden="true"></span> <%= "Batches" %></h1>
6
- <% end %>
7
-
8
- <div class="row">
9
- <div class="col-md-12">
10
- <div class="panel panel-default tabs">
11
- <%= render 'tabs' %>
12
- <div class="panel-body">
13
- <%= render 'batches_list' %>
14
-
15
- <%#= render 'results_pagination' %>
16
- </div>
17
- </div>
18
- </div>
19
- </div>
1
+ <% provide :page_title, "Batches" %>
2
+
3
+
4
+ <% provide :page_header do %>
5
+ <h1><span class="fa fa-database" aria-hidden="true"></span> <%= "Batches" %></h1>
6
+ <% end %>
7
+
8
+ <div class="row">
9
+ <div class="col-md-12">
10
+ <div class="panel panel-default tabs">
11
+ <%= render 'tabs' %>
12
+ <div class="panel-body">
13
+ <%= render 'batches_list' %>
14
+
15
+ <%#= render 'results_pagination' %>
16
+ </div>
17
+ </div>
18
+ </div>
19
+ </div>
@@ -1,18 +1,18 @@
1
- <h1><span class="fa fa-angle-double-up"></span> <%= default_page_title %></h1>
2
-
3
- <%= form_for :csv_import, url: csv_create_path do |f| %>
4
- <%= f.label 'Multi-value Separator:' %>
5
- <%= f.text_field 'mvs' %>
6
- <br />
7
- <%= f.file_field 'csv_file' %>
8
- <br />
9
- <%= f.label 'Admin Set:' %>
10
- <%= select_tag "admin_set", options_for_select(@admin_sets), :include_blank => true %>
11
- <br />
12
- <%= f.label 'Collection:' %>
13
- <%= select_tag "collection", options_for_select(@collections), :include_blank => true %>
14
- <br />
15
- <%= f.submit 'Save' %>
16
- <% end %>
17
- <br />
18
- <%= link_to "template", csv_generate_path %>
1
+ <h1><span class="fa fa-angle-double-up"></span> <%= default_page_title %></h1>
2
+
3
+ <%= form_for :csv_import, url: csv_create_path do |f| %>
4
+ <%= f.label 'Multi-value Separator:' %>
5
+ <%= f.text_field 'mvs' %>
6
+ <br />
7
+ <%= f.file_field 'csv_file' %>
8
+ <br />
9
+ <%= f.label 'Admin Set:' %>
10
+ <%= select_tag "admin_set", options_for_select(@admin_sets), :include_blank => true %>
11
+ <br />
12
+ <%= f.label 'Collection:' %>
13
+ <%= select_tag "collection", options_for_select(@collections.sort { |x,y| x[0].downcase <=> y[0].downcase }), :include_blank => true %>
14
+ <br />
15
+ <%= f.submit 'Save', data: { disable_with: 'Submitting CSV...' } %>
16
+ <% end %>
17
+ <br />
18
+ <%= link_to "template", csv_generate_path %>
@@ -1,14 +1,14 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Cdm migrator</title>
5
- <%= stylesheet_link_tag "cdm_migrator/application", media: "all" %>
6
- <%= javascript_include_tag "cdm_migrator/application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
-
11
- <%= yield %>
12
-
13
- </body>
14
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Cdm migrator</title>
5
+ <%= stylesheet_link_tag "cdm_migrator/application", media: "all" %>
6
+ <%= javascript_include_tag "cdm_migrator/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
data/config/routes.rb CHANGED
@@ -1,19 +1,19 @@
1
- Rails.application.routes.draw do
2
- get '/cdm_migrator/upload', to: 'cdm_migrator/csv#upload', as: 'csv_upload'
3
- post '/cdm_migrator/upload', to: 'cdm_migrator/csv#create', as: 'csv_create'
4
- get '/cdm_migrator/generate', to: 'cdm_migrator/csv#generate', as: 'csv_generate'
5
- get '/cdm_migrator/my/batches', to: 'cdm_migrator/csv#index', as: 'csv_my_batches'
6
- get '/cdm_migrator/batches', to: 'cdm_migrator/csv#index', as: 'csv_all_batches'
7
- get '/cdm_migrator/rerun/:id', to: 'cdm_migrator/csv#rerun', as: 'csv_rerun'
8
- get '/cdm_migrator/edit', to: 'cdm_migrator/csv#edit', as: 'csv_edit'
9
- post '/cdm_migrator/export', to: 'cdm_migrator/csv#export', as: 'csv_export'
10
- post '/cdm_migrator/update', to: 'cdm_migrator/csv#update', as: 'csv_update'
11
-
12
- get '/cdm_migrator/csv_checker', to: 'cdm_migrator/csv#csv_checker', as: 'csv_checker'
13
- post '/cdm_migrator/csv_checker', to: 'cdm_migrator/csv#csv_checker', as: 'check_csv'
14
-
15
- get '/cdm_migrator/collection', to: 'cdm_migrator/cdm#collection', as: 'cdm_start'
16
- post '/cdm_migrator/mappings/', to: 'cdm_migrator/cdm#mappings', as: 'cdm_mappings'
17
- post '/cdm_migrator/generate/', to: 'cdm_migrator/cdm#generate', as: 'cdm_generate'
18
- post '/cdm_migrator/template', to: 'cdm_migrator/cdm#template', as: 'cdm_template'
19
- end
1
+ Rails.application.routes.draw do
2
+ get '/cdm_migrator/upload', to: 'cdm_migrator/csv#upload', as: 'csv_upload'
3
+ post '/cdm_migrator/upload', to: 'cdm_migrator/csv#create', as: 'csv_create'
4
+ get '/cdm_migrator/generate', to: 'cdm_migrator/csv#generate', as: 'csv_generate'
5
+ get '/cdm_migrator/my/batches', to: 'cdm_migrator/csv#index', as: 'csv_my_batches'
6
+ get '/cdm_migrator/batches', to: 'cdm_migrator/csv#index', as: 'csv_all_batches'
7
+ get '/cdm_migrator/rerun/:id', to: 'cdm_migrator/csv#rerun', as: 'csv_rerun'
8
+ get '/cdm_migrator/edit', to: 'cdm_migrator/csv#edit', as: 'csv_edit'
9
+ post '/cdm_migrator/export', to: 'cdm_migrator/csv#export', as: 'csv_export'
10
+ post '/cdm_migrator/update', to: 'cdm_migrator/csv#update', as: 'csv_update'
11
+
12
+ get '/cdm_migrator/csv_checker', to: 'cdm_migrator/csv#csv_checker', as: 'csv_checker'
13
+ post '/cdm_migrator/csv_checker', to: 'cdm_migrator/csv#csv_checker', as: 'check_csv'
14
+
15
+ get '/cdm_migrator/collection', to: 'cdm_migrator/cdm#collection', as: 'cdm_start'
16
+ post '/cdm_migrator/mappings/', to: 'cdm_migrator/cdm#mappings', as: 'cdm_mappings'
17
+ post '/cdm_migrator/generate/', to: 'cdm_migrator/cdm#generate', as: 'cdm_generate'
18
+ post '/cdm_migrator/template', to: 'cdm_migrator/cdm#template', as: 'cdm_template'
19
+ end
@@ -1,20 +1,20 @@
1
- class CreateBatchIngests < ActiveRecord::Migration[5.0]
2
- def up
3
- create_table :batch_ingests do |t|
4
- t.text :data
5
- t.string :admin_set_id
6
- t.string :collection_id
7
- t.text :message
8
- t.integer :size
9
- t.string :csv
10
- t.references :user, foreign_key: true
11
- t.boolean :complete, default: false
12
-
13
- t.timestamps
14
- end
15
- end
16
-
17
- def down
18
- drop_table :batch_ingests
19
- end
1
+ class CreateBatchIngests < ActiveRecord::Migration[5.0]
2
+ def up
3
+ create_table :batch_ingests do |t|
4
+ t.text :data
5
+ t.string :admin_set_id
6
+ t.string :collection_id
7
+ t.text :message
8
+ t.integer :size
9
+ t.string :csv
10
+ t.references :user, foreign_key: true
11
+ t.boolean :complete, default: false
12
+
13
+ t.timestamps
14
+ end
15
+ end
16
+
17
+ def down
18
+ drop_table :batch_ingests
19
+ end
20
20
  end
@@ -1,18 +1,18 @@
1
- class CreateIngestWorks < ActiveRecord::Migration[5.0]
2
- def up
3
- create_table :ingest_works do |t|
4
- t.string :work_type
5
- t.text :data
6
- t.text :files
7
- t.boolean :complete, :default => false
8
-
9
- t.references :batch_ingest, foreign_key: true
10
-
11
- t.timestamps
12
- end
13
- end
14
-
15
- def down
16
- drop_table :ingest_works
17
- end
18
- end
1
+ class CreateIngestWorks < ActiveRecord::Migration[5.0]
2
+ def up
3
+ create_table :ingest_works do |t|
4
+ t.string :work_type
5
+ t.text :data
6
+ t.text :files
7
+ t.boolean :complete, :default => false
8
+
9
+ t.references :batch_ingest, foreign_key: true
10
+
11
+ t.timestamps
12
+ end
13
+ end
14
+
15
+ def down
16
+ drop_table :ingest_works
17
+ end
18
+ end
@@ -1,29 +1,29 @@
1
- module CdmMigrator
2
- class Engine < ::Rails::Engine
3
-
4
- initializer :append_migrations do |app|
5
- unless app.root.to_s.match root.to_s
6
- config.paths["db/migrate"].expanded.each do |expanded_path|
7
- app.config.paths["db/migrate"] << expanded_path
8
- end
9
- end
10
- end
11
-
12
- #isolate_namespace CdmMigrator
13
- class << self
14
-
15
- def config
16
- file = File.open(File.join(::Rails.root, "/config/cdm_migrator.yml"))
17
- @config ||= YAML.safe_load(file)
18
- end
19
-
20
- # loads a yml file with the configuration options
21
- #
22
- # @param file [String] path to the yml file
23
- #
24
- def load_config(file)
25
- @config = YAML.load_file(file)
26
- end
27
- end
28
- end
29
- end
1
+ module CdmMigrator
2
+ class Engine < ::Rails::Engine
3
+
4
+ initializer :append_migrations do |app|
5
+ unless app.root.to_s.match root.to_s
6
+ config.paths["db/migrate"].expanded.each do |expanded_path|
7
+ app.config.paths["db/migrate"] << expanded_path
8
+ end
9
+ end
10
+ end
11
+
12
+ #isolate_namespace CdmMigrator
13
+ class << self
14
+
15
+ def config
16
+ file = File.open(File.join(::Rails.root, "/config/cdm_migrator.yml"))
17
+ @config ||= YAML.safe_load(file)
18
+ end
19
+
20
+ # loads a yml file with the configuration options
21
+ #
22
+ # @param file [String] path to the yml file
23
+ #
24
+ def load_config(file)
25
+ @config = YAML.load_file(file)
26
+ end
27
+ end
28
+ end
29
+ end
@@ -1,3 +1,3 @@
1
- module CdmMigrator
2
- VERSION = '3.2.0'
3
- end
1
+ module CdmMigrator
2
+ VERSION = '3.3.1'
3
+ end
data/lib/cdm_migrator.rb CHANGED
@@ -1,5 +1,5 @@
1
- require "cdm_migrator/engine"
2
-
3
- module CdmMigrator
4
- # Your code goes here...
5
- end
1
+ require "cdm_migrator/engine"
2
+
3
+ module CdmMigrator
4
+ # Your code goes here...
5
+ end