Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newnode 2.1.5 (new formula) #162683

Closed
wants to merge 23 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions Formula/n/newnode.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
class Newnode < Formula
desc "Web proxy that uses a distributed p2p network to circumvent censorship"
homepage "https://www.newnode.com/newnode-vpn"
url "https://github.com/clostra/newnode.git",
tag: "2.1.5",
revision: "18a3f713267b2a08e34cbe04253df891889997a2"
Comment on lines +5 to +6
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
tag: "2.1.5",
revision: "18a3f713267b2a08e34cbe04253df891889997a2"
tag: "2.1.5",
revision: "18a3f713267b2a08e34cbe04253df891889997a2"

Align the arguments of url. Though, we really should use a tarball instead of a Git checkout.

license "GPL-2.0-only"

depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "coreutils" => :build
depends_on "libtool" => :build
depends_on "pkg-config" => :build

on_macos do
depends_on xcode: ["9.3", :build]
end
Comment on lines +15 to +17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need the on_macos block here.


on_linux do
depends_on "gnu-sed" => :build
depends_on "grep" => :build
Comment on lines +20 to +21
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
depends_on "gnu-sed" => :build
depends_on "grep" => :build

It's unlikely that these are needed, since sed and grep are POSIX commands.

depends_on "llvm" => :build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes this

uses_from_macos "llvm" => :build

(outside of the on_linux block.

depends_on "wget"
end

fails_with :gcc do
cause "Requires -fblocks support"
end

def install
if OS.linux?
inreplace "https_wget.c", "/usr/bin/wget", "#{Formula["wget"].opt_bin}/wget"
ENV.prepend_path "PATH", Formula["gnu-sed"].opt_libexec/"gnubin"
end
Comment on lines +31 to +34
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if OS.linux?
inreplace "https_wget.c", "/usr/bin/wget", "#{Formula["wget"].opt_bin}/wget"
ENV.prepend_path "PATH", Formula["gnu-sed"].opt_libexec/"gnubin"
end
inreplace "https_wget.c", "/usr/bin/wget", "#{Formula["wget"].opt_bin}/wget" if OS.linux?

unless brew complains about the line being too long, in which case,

Suggested change
if OS.linux?
inreplace "https_wget.c", "/usr/bin/wget", "#{Formula["wget"].opt_bin}/wget"
ENV.prepend_path "PATH", Formula["gnu-sed"].opt_libexec/"gnubin"
end
if OS.linux?
inreplace "https_wget.c", "/usr/bin/wget", "#{Formula["wget"].opt_bin}/wget"
end

system "./build.sh"
bin.install "client" => "newnode"
path = (var/"cache/newnode")
path.mkpath
path.chmod 0775
SMillerDev marked this conversation as resolved.
Show resolved Hide resolved
Comment on lines +37 to +39
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be in a post_install method.

end

service do
run [opt_bin/"newnode", "-p", "8006"]
keep_alive true
working_dir var/"cache/newnode"
log_path var/"log/newnode.log"
error_log_path var/"log/newnode-error.log"
end

test do
port = free_port
pid = fork do
exec bin/"newnode", "-p", port.to_s
end
sleep 5

ENV["https_proxy"] = "http://localhost:#{port}"
begin
system "curl", "https://brew.sh"
ensure
sleep 5
Process.kill("TERM", pid)
end
Comment on lines +58 to +63
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
begin
system "curl", "https://brew.sh"
ensure
sleep 5
Process.kill("TERM", pid)
end
system "curl", "https://brew.sh"
sleep 5
ensure
Process.kill("TERM", pid)

I don't think you need the begin block here.

end
end
Loading