diff --git a/lib/gh_importer/entity_notice_role_builder.rb b/lib/github_importer/entity_notice_role_builder.rb similarity index 100% rename from lib/gh_importer/entity_notice_role_builder.rb rename to lib/github_importer/entity_notice_role_builder.rb diff --git a/lib/gh_importer/gh_importer.rb b/lib/github_importer/github_importer.rb similarity index 98% rename from lib/gh_importer/gh_importer.rb rename to lib/github_importer/github_importer.rb index b960efd99..e9b3adad0 100644 --- a/lib/gh_importer/gh_importer.rb +++ b/lib/github_importer/github_importer.rb @@ -1,5 +1,5 @@ require 'loggy' -require 'gh_importer/mapping/dmca' +require 'github_importer/mapping/dmca' module GithubImporter class GithubImporter diff --git a/lib/gh_importer/mapping/dmca.rb b/lib/github_importer/mapping/dmca.rb similarity index 98% rename from lib/gh_importer/mapping/dmca.rb rename to lib/github_importer/mapping/dmca.rb index 042c5cf42..4cedabe86 100644 --- a/lib/gh_importer/mapping/dmca.rb +++ b/lib/github_importer/mapping/dmca.rb @@ -1,4 +1,4 @@ -require 'gh_importer/entity_notice_role_builder' +require 'github_importer/entity_notice_role_builder' module GithubImporter module Mapping diff --git a/lib/tasks/lumen.rake b/lib/tasks/lumen.rake index 032e90271..9d2c53171 100644 --- a/lib/tasks/lumen.rake +++ b/lib/tasks/lumen.rake @@ -5,8 +5,8 @@ require 'csv' require 'comfy/blog_post_factory' require 'loggy' require 'court_order_reporter' -require 'yt_importer/yt_importer' -require 'gh_importer/gh_importer' +require 'youtube_importer/youtube_importer' +require 'github_importer/github_importer' require 'fileutils' require 'uri' @@ -568,7 +568,7 @@ where works.id in ( loggy.info('Starting importing YT notices from old chill') - importer = YtImporter::YtImporter.new + importer = YoutubeImporter::YoutubeImporter.new importer.import loggy.info('Finished importing YT notices from old chill') diff --git a/lib/yt_importer/entity_notice_role_builder.rb b/lib/youtube_importer/entity_notice_role_builder.rb similarity index 98% rename from lib/yt_importer/entity_notice_role_builder.rb rename to lib/youtube_importer/entity_notice_role_builder.rb index 6c5513226..a46d065a6 100644 --- a/lib/yt_importer/entity_notice_role_builder.rb +++ b/lib/youtube_importer/entity_notice_role_builder.rb @@ -1,4 +1,4 @@ -module YtImporter +module YoutubeImporter class EntityNoticeRoleBuilder def initialize(role_name, name, address = {}) @role_name = role_name diff --git a/lib/yt_importer/mapping/base.rb b/lib/youtube_importer/mapping/base.rb similarity index 97% rename from lib/yt_importer/mapping/base.rb rename to lib/youtube_importer/mapping/base.rb index 6589cf5db..aa9c6b772 100644 --- a/lib/yt_importer/mapping/base.rb +++ b/lib/youtube_importer/mapping/base.rb @@ -1,6 +1,6 @@ -require 'yt_importer/entity_notice_role_builder' +require 'youtube_importer/entity_notice_role_builder' -module YtImporter +module YoutubeImporter module Mapping class Base def initialize(notice_text, raw_file_path) diff --git a/lib/yt_importer/mapping/html/base.rb b/lib/youtube_importer/mapping/html/base.rb similarity index 87% rename from lib/yt_importer/mapping/html/base.rb rename to lib/youtube_importer/mapping/html/base.rb index c6b8ee993..163ac73db 100644 --- a/lib/yt_importer/mapping/html/base.rb +++ b/lib/youtube_importer/mapping/html/base.rb @@ -1,10 +1,10 @@ require 'nokogiri' -require 'yt_importer/mapping/base' +require 'youtube_importer/mapping/base' -module YtImporter +module YoutubeImporter module Mapping module Html - class Base < YtImporter::Mapping::Base + class Base < YoutubeImporter::Mapping::Base def initialize(notice_text, data_from_legacy_database, raw_file_path) @notice_parsed = Nokogiri::HTML(notice_text) @notice_paragraphs = @notice_parsed.css('p').to_a diff --git a/lib/yt_importer/mapping/html/counterfeit.rb b/lib/youtube_importer/mapping/html/counterfeit.rb similarity index 91% rename from lib/yt_importer/mapping/html/counterfeit.rb rename to lib/youtube_importer/mapping/html/counterfeit.rb index 9cc4f8420..e1ff200f3 100644 --- a/lib/yt_importer/mapping/html/counterfeit.rb +++ b/lib/youtube_importer/mapping/html/counterfeit.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/html/trademark_d' +require 'youtube_importer/mapping/html/trademark_d' -module YtImporter +module YoutubeImporter module Mapping module Html class Counterfeit < TrademarkD diff --git a/lib/yt_importer/mapping/html/defamation.rb b/lib/youtube_importer/mapping/html/defamation.rb similarity index 90% rename from lib/yt_importer/mapping/html/defamation.rb rename to lib/youtube_importer/mapping/html/defamation.rb index 89c1dbb2f..45545d4b7 100644 --- a/lib/yt_importer/mapping/html/defamation.rb +++ b/lib/youtube_importer/mapping/html/defamation.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/html/base' +require 'youtube_importer/mapping/html/base' -module YtImporter +module YoutubeImporter module Mapping module Html class Defamation < Base diff --git a/lib/yt_importer/mapping/html/other_legal.rb b/lib/youtube_importer/mapping/html/other_legal.rb similarity index 93% rename from lib/yt_importer/mapping/html/other_legal.rb rename to lib/youtube_importer/mapping/html/other_legal.rb index ba4fa571f..3db27073d 100644 --- a/lib/yt_importer/mapping/html/other_legal.rb +++ b/lib/youtube_importer/mapping/html/other_legal.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/html/trademark_d' +require 'youtube_importer/mapping/html/trademark_d' -module YtImporter +module YoutubeImporter module Mapping module Html class OtherLegal < TrademarkD diff --git a/lib/yt_importer/mapping/html/trademark_d.rb b/lib/youtube_importer/mapping/html/trademark_d.rb similarity index 93% rename from lib/yt_importer/mapping/html/trademark_d.rb rename to lib/youtube_importer/mapping/html/trademark_d.rb index 1b987b11e..46142aed1 100644 --- a/lib/yt_importer/mapping/html/trademark_d.rb +++ b/lib/youtube_importer/mapping/html/trademark_d.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/html/base' +require 'youtube_importer/mapping/html/base' -module YtImporter +module YoutubeImporter module Mapping module Html class TrademarkD < Base diff --git a/lib/yt_importer/mapping/plain_new/base.rb b/lib/youtube_importer/mapping/plain_new/base.rb similarity index 83% rename from lib/yt_importer/mapping/plain_new/base.rb rename to lib/youtube_importer/mapping/plain_new/base.rb index 49c85e7a4..cdc29ccf9 100644 --- a/lib/yt_importer/mapping/plain_new/base.rb +++ b/lib/youtube_importer/mapping/plain_new/base.rb @@ -1,10 +1,10 @@ -require 'yt_importer/mapping/base' +require 'youtube_importer/mapping/base' require 'uri' -module YtImporter +module YoutubeImporter module Mapping module PlainNew - class Base < YtImporter::Mapping::Base + class Base < YoutubeImporter::Mapping::Base def language get_single_line_field('Language') end diff --git a/lib/yt_importer/mapping/plain_new/counterfeit.rb b/lib/youtube_importer/mapping/plain_new/counterfeit.rb similarity index 93% rename from lib/yt_importer/mapping/plain_new/counterfeit.rb rename to lib/youtube_importer/mapping/plain_new/counterfeit.rb index cdb5ec796..3ca46a785 100644 --- a/lib/yt_importer/mapping/plain_new/counterfeit.rb +++ b/lib/youtube_importer/mapping/plain_new/counterfeit.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/plain_new/trademark_d' +require 'youtube_importer/mapping/plain_new/trademark_d' -module YtImporter +module YoutubeImporter module Mapping module PlainNew class Counterfeit < TrademarkD diff --git a/lib/yt_importer/mapping/plain_new/defamation.rb b/lib/youtube_importer/mapping/plain_new/defamation.rb similarity index 96% rename from lib/yt_importer/mapping/plain_new/defamation.rb rename to lib/youtube_importer/mapping/plain_new/defamation.rb index aab7309fb..f2c61e4ec 100644 --- a/lib/yt_importer/mapping/plain_new/defamation.rb +++ b/lib/youtube_importer/mapping/plain_new/defamation.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/plain_new/base' +require 'youtube_importer/mapping/plain_new/base' -module YtImporter +module YoutubeImporter module Mapping module PlainNew class Defamation < Base diff --git a/lib/yt_importer/mapping/plain_new/other_legal.rb b/lib/youtube_importer/mapping/plain_new/other_legal.rb similarity index 95% rename from lib/yt_importer/mapping/plain_new/other_legal.rb rename to lib/youtube_importer/mapping/plain_new/other_legal.rb index ab200e7f7..6224f0f9d 100644 --- a/lib/yt_importer/mapping/plain_new/other_legal.rb +++ b/lib/youtube_importer/mapping/plain_new/other_legal.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/plain_new/trademark_d' +require 'youtube_importer/mapping/plain_new/trademark_d' -module YtImporter +module YoutubeImporter module Mapping module PlainNew class OtherLegal < TrademarkD diff --git a/lib/yt_importer/mapping/plain_new/trademark_d.rb b/lib/youtube_importer/mapping/plain_new/trademark_d.rb similarity index 95% rename from lib/yt_importer/mapping/plain_new/trademark_d.rb rename to lib/youtube_importer/mapping/plain_new/trademark_d.rb index 34e19b433..16621df01 100644 --- a/lib/yt_importer/mapping/plain_new/trademark_d.rb +++ b/lib/youtube_importer/mapping/plain_new/trademark_d.rb @@ -1,6 +1,6 @@ -require 'yt_importer/mapping/plain_new/base' +require 'youtube_importer/mapping/plain_new/base' -module YtImporter +module YoutubeImporter module Mapping module PlainNew class TrademarkD < Base diff --git a/lib/yt_importer/yt_importer.rb b/lib/youtube_importer/youtube_importer.rb similarity index 83% rename from lib/yt_importer/yt_importer.rb rename to lib/youtube_importer/youtube_importer.rb index c96766b61..effcfc859 100644 --- a/lib/yt_importer/yt_importer.rb +++ b/lib/youtube_importer/youtube_importer.rb @@ -1,20 +1,20 @@ require 'loggy' -require 'yt_importer/mapping/html/counterfeit' -require 'yt_importer/mapping/html/defamation' -require 'yt_importer/mapping/html/other_legal' -require 'yt_importer/mapping/html/trademark_d' -require 'yt_importer/mapping/plain_new/counterfeit' -require 'yt_importer/mapping/plain_new/defamation' -require 'yt_importer/mapping/plain_new/other_legal' -require 'yt_importer/mapping/plain_new/trademark_d' - -module YtImporter - class YtImporter +require 'youtube_importer/mapping/html/counterfeit' +require 'youtube_importer/mapping/html/defamation' +require 'youtube_importer/mapping/html/other_legal' +require 'youtube_importer/mapping/html/trademark_d' +require 'youtube_importer/mapping/plain_new/counterfeit' +require 'youtube_importer/mapping/plain_new/defamation' +require 'youtube_importer/mapping/plain_new/other_legal' +require 'youtube_importer/mapping/plain_new/trademark_d' + +module YoutubeImporter + class YoutubeImporter FILES_DIRECTORY = ENV['BASE_DIRECTORY'] IMPORT_FILE_BATCH_SIZE = 500 def initialize - @logger = Loggy.new('YtImporter', true, true) + @logger = Loggy.new('YoutubeImporter', true, true) if FILES_DIRECTORY.nil? @logger.info('The BASE_DIRECTORY env variable must be set to continue') @@ -53,7 +53,7 @@ def import_date_to end def import_files_list_file - ENV['YT_IMPORT_FILES_LIST_FILE'] || 'tmp/yt_importer_files_list' + ENV['YT_IMPORT_FILES_LIST_FILE'] || 'tmp/youtube_importer_files_list' end def generate_yt_files_list @@ -90,10 +90,10 @@ def import_single_notice(file_to_process) file_data = read_file(file_to_process) mapper_class = nil - mapper_class = "YtImporter::Mapping::#{format_class}::Counterfeit" if system("grep -q '