Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/3985 pm manifest support for copied files #4075

Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/dashboard/app/apps/manifest.rb
Original file line number Diff line number Diff line change
@@ -233,4 +233,10 @@ def save(path)
false
end
end

class Template < Manifest
def files
manifest_options[:files] || []
end
end
euler-room marked this conversation as resolved.
Show resolved Hide resolved
end
46 changes: 45 additions & 1 deletion apps/dashboard/test/models/manifest_test.rb
Original file line number Diff line number Diff line change
@@ -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']
euler-room marked this conversation as resolved.
Show resolved Hide resolved
}

valid_manifest = <<~HEREDOC
@@ -165,4 +166,47 @@ class ManifestTest < ActiveSupport::TestCase
assert_equal valid_manifest, File.read(path)
end
end

test 'Manifest::Template writes files entries' do
opts = { name: 'Ruby',
description: 'test hash',
icon: 'fas://cog',
url: '/some/location',
category: 'some category',
subcategory: 'some subcategory',
role: 'some role',
metadata: { some_key: 'value' },
new_window: false,
caption: 'some caption',
invalid_key: 'invalid value',
files: ['file1', 'file2']
}

valid_manifest = <<~HEREDOC
---
name: Ruby
description: test hash
icon: fas://cog
url: "/some/location"
category: some category
subcategory: some subcategory
role: some role
metadata:
some_key: value
new_window: false
caption: some caption
files:
- file1
- file2
HEREDOC

manifest = Manifest::Template.new(opts)

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

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