File tree 1 file changed +39
-0
lines changed
1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ class So < Formula
2
+ desc "Terminal interface for StackOverflow"
3
+ homepage "https://github.com/samtay/so"
4
+ url "https://github.com/samtay/so/archive/v0.3.6.tar.gz"
5
+ sha256 "6d2f541bb00dceb9163faf4cc44ff1bd39e07b46c35d6532e24b47d7ad6d47da"
6
+ license "MIT"
7
+
8
+ depends_on "rust" => :build
9
+
10
+ on_linux do
11
+ depends_on "pkg-config" => :build
12
+ depends_on "openssl@1.1"
13
+ end
14
+
15
+ def install
16
+ system "cargo" , "install" , *std_cargo_args
17
+ end
18
+
19
+ test do
20
+ # try a query
21
+ opts = "--search-engine stackexchange --limit 1 --lucky"
22
+ query = "how do I exit Vim"
23
+ env_vars = "LC_CTYPE=en_US.UTF-8 LANG=en_US.UTF-8 TERM=xterm"
24
+ input , _ , wait_thr = Open3 . popen2 "script -q /dev/null"
25
+ input . puts "stty rows 80 cols 130"
26
+ input . puts "env #{ env_vars } #{ bin } /so #{ opts } #{ query } 2>&1 > output"
27
+ sleep 3
28
+
29
+ # quit
30
+ input . puts "q"
31
+ sleep 2
32
+ input . close
33
+
34
+ # make sure it's the correct answer
35
+ assert_match /:wq/ , File . read ( "output" )
36
+ ensure
37
+ Process . kill ( "TERM" , wait_thr . pid )
38
+ end
39
+ end
You can’t perform that action at this time.
0 commit comments