github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/misc/list-gnophers/main.sh (about)

     1  #!/bin/sh
     2  
     3  main() {
     4      cd "$(dirname "$0")"
     5      cd ../..
     6      fname="$(mktemp --tmpdir gno_file_commits.XXXXXXXXXX.csv)"
     7      for file in $(list_gno_files); do
     8          extract_file_metadata $file
     9      done > "$fname"
    10      cat "$fname" | sort_by_date | unique_by_author
    11  }
    12  
    13  list_gno_files() {
    14      # list .gno file in examples/, remove tests and unit tests
    15      find ./examples -name "*.gno" | grep -v _filetest.gno | grep -v _test.gno | grep -v gno.land/r/demo/tests
    16  }
    17  
    18  extract_file_metadata() {
    19      file=$1
    20      # get the first commit date of the file
    21      first_commit_date=$(git log --pretty=format:%ct --follow $file | tail -n 1)
    22      # get the email of the first contributor of the file
    23      email=$(git log --mailmap --pretty=format:%aE --follow $file | tail -n 1)
    24      # print the file name, first commit date, and email
    25      echo "$first_commit_date,$email,$file"
    26  }
    27  
    28  sort_by_date() {
    29      sort -t, -k1
    30  }
    31  
    32  unique_by_author() {
    33      awk -F, '!seek[$2]++'
    34  }
    35  
    36  main