Class: RosettAi::Migration::NnccProjectMigrator
- Inherits:
-
Object
- Object
- RosettAi::Migration::NnccProjectMigrator
- Defined in:
- lib/rosett_ai/migration/nncc_project_migrator.rb
Overview
Migrates legacy .nncc/ project directories to .rosett-ai/.
Can operate on a single project root or scan an entire workspace for projects containing .nncc/ directories.
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
-
#detect(workspace) ⇒ Array<String>
Detect projects with .nncc/ in a workspace (dry-run).
-
#initialize ⇒ NnccProjectMigrator
constructor
A new instance of NnccProjectMigrator.
-
#migrate_project(project_root) ⇒ Hash
Migrate a single project's .nncc/ to .rosett-ai/.
-
#migrate_workspace(workspace) ⇒ Array<Hash>
Scan a workspace for projects with .nncc/ and migrate them.
Constructor Details
#initialize ⇒ NnccProjectMigrator
Returns a new instance of NnccProjectMigrator.
20 21 22 |
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 20 def initialize @results = [] end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
18 19 20 |
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 18 def results @results end |
Instance Method Details
#detect(workspace) ⇒ Array<String>
Detect projects with .nncc/ in a workspace (dry-run).
48 49 50 |
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 48 def detect(workspace) find_nncc_projects(workspace) end |
#migrate_project(project_root) ⇒ Hash
Migrate a single project's .nncc/ to .rosett-ai/.
28 29 30 31 32 33 |
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 28 def migrate_project(project_root) root = Pathname.new(project_root) perform_migration(root) rescue Errno::EACCES => e record_result(root, :error, "Permission denied: #{e.}") end |
#migrate_workspace(workspace) ⇒ Array<Hash>
Scan a workspace for projects with .nncc/ and migrate them.
39 40 41 42 |
# File 'lib/rosett_ai/migration/nncc_project_migrator.rb', line 39 def migrate_workspace(workspace) find_nncc_projects(workspace).each { |path| migrate_project(path) } @results end |