Skip to content

Commit

Permalink
Stop Zeitwerk complaining about wrong GitHub importer directory name
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-hank committed Sep 12, 2024
1 parent 3e9efab commit 8c4ffc0
Show file tree
Hide file tree
Showing 17 changed files with 47 additions and 47 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'loggy'
require 'gh_importer/mapping/dmca'
require 'github_importer/mapping/dmca'

module GithubImporter
class GithubImporter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'gh_importer/entity_notice_role_builder'
require 'github_importer/entity_notice_role_builder'

module GithubImporter
module Mapping
Expand Down
6 changes: 3 additions & 3 deletions lib/tasks/lumen.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module YtImporter
module YoutubeImporter
class EntityNoticeRoleBuilder
def initialize(role_name, name, address = {})
@role_name = role_name
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 '<counterfeit\+' #{file_to_process}")
mapper_class = "YtImporter::Mapping::#{format_class}::Defamation" if system("grep -q '<defamation\+' #{file_to_process}")
mapper_class = "YtImporter::Mapping::#{format_class}::OtherLegal" if system("grep -q '<other-legal\+' #{file_to_process}")
mapper_class = "YtImporter::Mapping::#{format_class}::TrademarkD" if system("grep -q '<trademark\+' #{file_to_process}")
mapper_class = "YoutubeImporter::Mapping::#{format_class}::Counterfeit" if system("grep -q '<counterfeit\+' #{file_to_process}")
mapper_class = "YoutubeImporter::Mapping::#{format_class}::Defamation" if system("grep -q '<defamation\+' #{file_to_process}")
mapper_class = "YoutubeImporter::Mapping::#{format_class}::OtherLegal" if system("grep -q '<other-legal\+' #{file_to_process}")
mapper_class = "YoutubeImporter::Mapping::#{format_class}::TrademarkD" if system("grep -q '<trademark\+' #{file_to_process}")

if mapper_class.nil?
@number_failed_imports += 1
Expand Down

0 comments on commit 8c4ffc0

Please sign in to comment.