From 495d174002b8c1b83e72bc85b419fcc649f6a0c1 Mon Sep 17 00:00:00 2001 From: "UENO, M." Date: Wed, 25 Sep 2024 11:50:24 +0900 Subject: [PATCH 1/5] Create a formula for mview --- Formula/mview.rb | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Formula/mview.rb diff --git a/Formula/mview.rb b/Formula/mview.rb new file mode 100644 index 000000000..329589ca6 --- /dev/null +++ b/Formula/mview.rb @@ -0,0 +1,36 @@ +class Mview < Formula + desc "Extracts and reformats the results of sequence database searches or multiple alignments" + homepage "https://desmid.github.io/mview" + url "https://github.com/desmid/mview/archive/refs/tags/v1.68.tar.gz" + sha256 "4c3c75ba7f3cead82e641a83f3ad43b38169fef16aa8b9c8414e35f1eb1081c7" + license "GPL-2.0-or-later" + + depends_on "perl" + + def install + # To make MVIEW_HOME and MVIEW_LIB in mview script work + inreplace "bin/mview" do |s| + s.gsub!( + %(\$MVIEW_HOME = "/home/brown/HOME/work/MView/dev";), + %(\$MVIEW_HOME = "#{prefix}";) + ) + s.gsub!( + %(\$MVIEW_LIB = "$MVIEW_HOME/lib";), + %(\$MVIEW_LIB = "$MVIEW_HOME/lib/mview#{version}";) + ) + end + + lib_install_dir = lib/"mview#{version}/Bio" + lib_install_dir.mkpath + (lib_install_dir/"MView").install Dir["lib/Bio/MView/*"] + (lib_install_dir/"Parse").install Dir["lib/Bio/Parse/*"] + (lib_install_dir/"Util").install Dir["lib/Bio/Util/*"] + + bin.install "bin/mview" + end + + test do + system "wget", "https://rest.uniprot.org/uniprotkb/Q16602.fasta" + system "#{bin}/mview", "-in", "fasta", "Q16602.fasta", "-width", "77" + end + end From 38eeeaf97ed9aeec40b209e403630a1661bdcadc Mon Sep 17 00:00:00 2001 From: "UENO, M." Date: Wed, 25 Sep 2024 11:59:43 +0900 Subject: [PATCH 2/5] Format --- Formula/mview.rb | 59 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/Formula/mview.rb b/Formula/mview.rb index 329589ca6..071022ff7 100644 --- a/Formula/mview.rb +++ b/Formula/mview.rb @@ -1,36 +1,37 @@ class Mview < Formula - desc "Extracts and reformats the results of sequence database searches or multiple alignments" - homepage "https://desmid.github.io/mview" - url "https://github.com/desmid/mview/archive/refs/tags/v1.68.tar.gz" - sha256 "4c3c75ba7f3cead82e641a83f3ad43b38169fef16aa8b9c8414e35f1eb1081c7" - license "GPL-2.0-or-later" + desc "Extracts and reformats the results of sequence database searches or multiple alignments" + homepage "https://desmid.github.io/mview" + url "https://github.com/desmid/mview/archive/refs/tags/v1.68.tar.gz" + sha256 "4c3c75ba7f3cead82e641a83f3ad43b38169fef16aa8b9c8414e35f1eb1081c7" + license "GPL-2.0-or-later" - depends_on "perl" + depends_on "perl" - def install - # To make MVIEW_HOME and MVIEW_LIB in mview script work - inreplace "bin/mview" do |s| - s.gsub!( - %(\$MVIEW_HOME = "/home/brown/HOME/work/MView/dev";), - %(\$MVIEW_HOME = "#{prefix}";) - ) - s.gsub!( - %(\$MVIEW_LIB = "$MVIEW_HOME/lib";), - %(\$MVIEW_LIB = "$MVIEW_HOME/lib/mview#{version}";) - ) - end + def install - lib_install_dir = lib/"mview#{version}/Bio" - lib_install_dir.mkpath - (lib_install_dir/"MView").install Dir["lib/Bio/MView/*"] - (lib_install_dir/"Parse").install Dir["lib/Bio/Parse/*"] - (lib_install_dir/"Util").install Dir["lib/Bio/Util/*"] - - bin.install "bin/mview" + # To make MVIEW_HOME and MVIEW_LIB in mview script work + inreplace "bin/mview" do |s| + s.gsub!( + %q($MVIEW_HOME = "/home/brown/HOME/work/MView/dev";), + %Q($MVIEW_HOME = "#{prefix}";), + ) + s.gsub!( + %q($MVIEW_LIB = "$MVIEW_HOME/lib";), + %Q($MVIEW_LIB = "$MVIEW_HOME/lib/mview#{version}";), + ) end - test do - system "wget", "https://rest.uniprot.org/uniprotkb/Q16602.fasta" - system "#{bin}/mview", "-in", "fasta", "Q16602.fasta", "-width", "77" - end + lib_install_dir = lib/"mview#{version}/Bio" + lib_install_dir.mkpath + (lib_install_dir/"MView").install Dir["lib/Bio/MView/*"] + (lib_install_dir/"Parse").install Dir["lib/Bio/Parse/*"] + (lib_install_dir/"Util").install Dir["lib/Bio/Util/*"] + + bin.install "bin/mview" + end + + test do + system "wget", "https://rest.uniprot.org/uniprotkb/Q16602.fasta" + system "#{bin}/mview", "-in", "fasta", "Q16602.fasta", "-width", "77" end +end From 51c61bd4abee4103f666eca8cc3464e9653fcd3d Mon Sep 17 00:00:00 2001 From: "UENO, M." Date: Wed, 25 Sep 2024 12:09:39 +0900 Subject: [PATCH 3/5] Shorten the description --- Formula/mview.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/mview.rb b/Formula/mview.rb index 071022ff7..207b0eb17 100644 --- a/Formula/mview.rb +++ b/Formula/mview.rb @@ -1,5 +1,5 @@ class Mview < Formula - desc "Extracts and reformats the results of sequence database searches or multiple alignments" + desc "Extracts and reformats the results of sequence searches or alignments" homepage "https://desmid.github.io/mview" url "https://github.com/desmid/mview/archive/refs/tags/v1.68.tar.gz" sha256 "4c3c75ba7f3cead82e641a83f3ad43b38169fef16aa8b9c8414e35f1eb1081c7" From 71b5a0c7129d5e192ec50cd7b6f5a1edc9658239 Mon Sep 17 00:00:00 2001 From: "UENO, M." Date: Wed, 25 Sep 2024 12:15:28 +0900 Subject: [PATCH 4/5] Format --- Formula/mview.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Formula/mview.rb b/Formula/mview.rb index 207b0eb17..129aac8c0 100644 --- a/Formula/mview.rb +++ b/Formula/mview.rb @@ -8,15 +8,14 @@ class Mview < Formula depends_on "perl" def install - # To make MVIEW_HOME and MVIEW_LIB in mview script work inreplace "bin/mview" do |s| s.gsub!( - %q($MVIEW_HOME = "/home/brown/HOME/work/MView/dev";), + '$MVIEW_HOME = "/home/brown/HOME/work/MView/dev";', %Q($MVIEW_HOME = "#{prefix}";), ) s.gsub!( - %q($MVIEW_LIB = "$MVIEW_HOME/lib";), + '$MVIEW_LIB = "$MVIEW_HOME/lib";', %Q($MVIEW_LIB = "$MVIEW_HOME/lib/mview#{version}";), ) end From f2a05f167e8374253ee4cfdd48665b7c679635ed Mon Sep 17 00:00:00 2001 From: "UENO, M." Date: Wed, 25 Sep 2024 12:50:39 +0900 Subject: [PATCH 5/5] Alter test commands --- Formula/mview.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Formula/mview.rb b/Formula/mview.rb index 129aac8c0..93563715b 100644 --- a/Formula/mview.rb +++ b/Formula/mview.rb @@ -30,7 +30,13 @@ def install end test do - system "wget", "https://rest.uniprot.org/uniprotkb/Q16602.fasta" - system "#{bin}/mview", "-in", "fasta", "Q16602.fasta", "-width", "77" + resource "homebrew-testdata" do + url "https://rest.uniprot.org/uniprotkb/Q16602.fasta" + sha256 "2505efe05f4b908be942c416b0a5f3dc5e983219258280513b8ac1333d755acf" + end + + resource("homebrew-testdata").stage testpath + output = shell_output("#{bin}/mview -in fasta Q16602.fasta -width 77") + assert_match "MEKKCTLYFLVLLPFFMILVTAELEE", output end end