14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/package_protections/rspec/application_fixture_helper.rb', line 14
def write_package_yml(
pack_name,
dependencies: [],
enforce_dependencies: true,
enforce_privacy: true,
protections: {}
)
defaults = {
'prevent_this_package_from_violating_its_stated_dependencies' => 'fail_on_new',
'prevent_other_packages_from_using_this_packages_internals' => 'fail_on_new',
'prevent_this_package_from_exposing_an_untyped_api' => 'fail_on_new',
'prevent_this_package_from_creating_other_namespaces' => 'fail_on_new',
'prevent_this_package_from_exposing_instance_method_public_apis' => 'fail_never'
}
protections_with_defaults = defaults.merge(protections)
metadata = { 'protections' => protections_with_defaults }
package = ParsePackwerk::Package.new(
name: pack_name,
dependencies: dependencies,
enforce_dependencies: enforce_dependencies,
enforce_privacy: enforce_privacy,
metadata: metadata
)
ParsePackwerk.write_package_yml!(package)
end
|