# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# Copyright (C) 2022-2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/jekyll
profile jekyll @{exec_path} {
  include <abstractions/base>
  include <abstractions/ruby>
  include <abstractions/nameservice-strict>

  @{exec_path} r,
  @{bin}/ruby[0-9].@{int} rix,

  @{lib}/ruby/gems/*/specifications/ r,
  @{lib}/ruby/gems/*/specifications/** r,
  @{lib}/ruby/gems/*/specifications/**.gemspec rwk,

  /usr/share/rubygems-integration/*/specifications/ r,
  /usr/share/rubygems-integration/*/specifications/*.gemspec rwk,

  /usr/share/ruby-addressable/unicode.data r,

  owner @{user_projects_dirs}/{,**} r,
  owner @{user_projects_dirs}/**/_site/{,**} rw,
  owner @{user_projects_dirs}/**/.sass-cache/** rw,

  @{PROC}/version r,

  include if exists <local/jekyll>
}
