Opened 10 months ago

Last modified 5 months ago

#6757 new change

Static assets automation in metadata.chrome

Reported by: agiammarchi Assignee:
Priority: Unknown Milestone:
Module: Automation Keywords:
Cc: greiner, saroyanm, sebastian, tlucas, erikvold Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: no Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by agiammarchi)

Background

Beside logic oriented files such .js, .css, or even .html, we are manually maintaining, and updating, with needs for synchronization, all static assets that ABP web extension needs to publish.

Not only this is potentially error prone (forgotten asset, not caught by the meta file but failing in production), this also requires needlessly more effort.

What to change

Generate the metadata.chrome file on features freeze through a template and an automation for at least ABP UI assets.

Example, given the following bash script:

#!/usr/bin/env bash

outputMeta() {
  local file
  local index
  local path
  local folder="$1"
  local startfrom="$2"
  local length=${#startfrom}
  cd $folder > /dev/null
  for file in $(ls $folder); do
    if [ -d $folder/$file ]; then
      outputMeta $folder/$file $startfrom
    elif [[ ! "$file" =~ \.js$|\.css$|\.html$ ]]; then
      index=$(strindex "$folder/$file" "$startfrom")
      path="$folder/$file"
      echo "${path:($index + $length + 1)} = ${path:($index)}"
    fi
  done
  cd - > /dev/null
}

strindex() { 
  x="${1%%$2*}"
  [[ "$x" = "$1" ]] && echo -1 || echo "${#x}"
}

# outputMeta ~/git/adblockplusui/skin adblockplusui
outputMeta $1 $2

it is possible to generate all skin related assets in output, after a chmod a+x skin.sh, via:

./skin.sh ~/git/adblockplusui/skin adblockplus

passing where is the current/desired adblockplusui/skin folder, and outputting automatically the list of assets.

Change History (6)

comment:1 Changed 10 months ago by tlucas

  • Cc greiner saroyanm sebastian kzar tlucas added

comment:2 Changed 10 months ago by kzar

  • Cc kzar removed

comment:3 Changed 10 months ago by agiammarchi

  • Description modified (diff)

comment:4 Changed 10 months ago by agiammarchi

  • Description modified (diff)

comment:5 Changed 10 months ago by agiammarchi

  • Description modified (diff)

comment:6 Changed 5 months ago by erikvold

  • Cc erikvold added
Note: See TracTickets for help on using tickets.