Skip to content

Commit

Permalink
Feature/3985 pm manifest support for copied files (#4075)
Browse files Browse the repository at this point in the history
Subclass Manifest class for projects (ProjectManifest) to extend without impacting objects that use the Manifest class.
  • Loading branch information
euler-room authored Jan 16, 2025
1 parent 2456c97 commit 56679ec
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
5 changes: 5 additions & 0 deletions apps/dashboard/app/apps/ProjectManifest.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ProjectManifest < Manifest
def files
manifest_options[:files] || []
end
end
3 changes: 2 additions & 1 deletion apps/dashboard/test/models/manifest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ class ManifestTest < ActiveSupport::TestCase
metadata: { some_key: 'value' },
new_window: false,
caption: 'some caption',
invalid_key: 'invalid value'
invalid_key: 'invalid value',
files: ['file1', 'file2']
}

valid_manifest = <<~HEREDOC
Expand Down
24 changes: 24 additions & 0 deletions apps/dashboard/test/models/project_manifest_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'test_helper'

class ProjectManifestTest < ActiveSupport::TestCase

test 'ProjectManifest writes files entries' do
opts = { files: ['file1', 'file2'] }

valid_manifest = <<~HEREDOC
---
files:
- file1
- file2
HEREDOC

manifest = ProjectManifest.new(opts)

Dir.mktmpdir do |dir|
path = dir << '/manifest.yml'
manifest.save(path)

assert_equal valid_manifest, File.read(path)
end
end
end

0 comments on commit 56679ec

Please sign in to comment.