Class: RailsMcpServer::ResourceImporter
- Inherits:
-
ResourceBase
- Object
- ResourceBase
- RailsMcpServer::ResourceImporter
- Defined in:
- lib/rails-mcp-server/helpers/resource_importer.rb
Defined Under Namespace
Classes: ImportError
Instance Attribute Summary
Attributes inherited from ResourceBase
#config_dir, #manifest_file, #resource_folder, #resource_name
Instance Method Summary collapse
- #import ⇒ Object
-
#initialize(resource_name, config_dir:, source_path:, force: false, verbose: false) ⇒ ResourceImporter
constructor
A new instance of ResourceImporter.
Constructor Details
#initialize(resource_name, config_dir:, source_path:, force: false, verbose: false) ⇒ ResourceImporter
Returns a new instance of ResourceImporter.
7 8 9 10 11 |
# File 'lib/rails-mcp-server/helpers/resource_importer.rb', line 7 def initialize(resource_name, config_dir:, source_path:, force: false, verbose: false) @source_path = source_path super(resource_name, config_dir: config_dir, force: force, verbose: verbose) validate_source end |
Instance Method Details
#import ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rails-mcp-server/helpers/resource_importer.rb', line 13 def import setup_directories load_manifest log "Importing custom files from #{@source_path}..." results = {imported: 0, skipped: 0, failed: 0} files = collect_files if files.empty? log "No markdown files found" save_manifest return results end files.each do |file_path| result = import_file(file_path) results[result] += 1 end save_manifest results end |