Class: ExternalSkillsImporter
- Inherits:
-
Object
- Object
- ExternalSkillsImporter
- Defined in:
- lib/clacky/default_skills/onboard/scripts/import_external_skills.rb
Overview
Base class for a single-source importer
Direct Known Subclasses
Instance Method Summary collapse
-
#errors ⇒ Array<String>
Errors encountered during this import run.
-
#imported ⇒ Array<Hash>
Imported skill records for reporting.
-
#initialize(target_skills_dir:, category_subdir:, dry_run: false) ⇒ ExternalSkillsImporter
constructor
A new instance of ExternalSkillsImporter.
-
#run ⇒ Integer
Run the import for this source.
Constructor Details
#initialize(target_skills_dir:, category_subdir:, dry_run: false) ⇒ ExternalSkillsImporter
Returns a new instance of ExternalSkillsImporter.
36 37 38 39 40 41 42 |
# File 'lib/clacky/default_skills/onboard/scripts/import_external_skills.rb', line 36 def initialize(target_skills_dir:, category_subdir:, dry_run: false) @target_skills_dir = target_skills_dir @target_import_dir = target_skills_dir.join(category_subdir) @dry_run = dry_run @imported = [] @errors = [] end |
Instance Method Details
#errors ⇒ Array<String>
Errors encountered during this import run.
65 66 67 |
# File 'lib/clacky/default_skills/onboard/scripts/import_external_skills.rb', line 65 def errors @errors.dup end |
#imported ⇒ Array<Hash>
Imported skill records for reporting.
71 72 73 |
# File 'lib/clacky/default_skills/onboard/scripts/import_external_skills.rb', line 71 def imported @imported.dup end |
#run ⇒ Integer
Run the import for this source.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/clacky/default_skills/onboard/scripts/import_external_skills.rb', line 46 def run unless source_available? puts "[INFO] #{source_label} not found - skipping." return 0 end skills = discover_skills if skills.empty? puts "[INFO] No #{source_label} skills found - nothing to import." return 0 end skills.each { |skill| process_skill(skill) } @imported.size end |