-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmynewt-newtmgr@1.4.rb
48 lines (39 loc) · 1.53 KB
/
mynewt-newtmgr@1.4.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# typed: false
# frozen_string_literal: true
class MynewtNewtmgrAT14 < Formula
desc "Tool to manage devices running Mynewt OS via the Newtmgr Protocol"
homepage "https://mynewt.apache.org"
url "https://github.com/apache/mynewt-newtmgr/archive/mynewt_1_4_1_tag.tar.gz"
version "1.4.1"
sha256 "4b77e6f5dad6d94f9aef93b5722789be3293c693c128fe7db6fe78749f3f9568"
bottle do
root_url "https://github.com/runtimeco/binary-releases/raw/master/mynewt-newt-tools_1.4.1"
sha256 cellar: :any_skip_relocation, sierra: "018ce99dcfc7fed1bd567f8082666a885403b4bcadce3234b598398e3544d12c"
end
keg_only :versioned_formula
depends_on "go" => :build
depends_on arch: :x86_64
def install
contents = Dir["{*,.git,.gitignore}"]
gopath = buildpath/"gopath"
(gopath/"src/mynewt.apache.org/newtmgr").install contents
ENV["GOPATH"] = gopath
ENV.prepend_create_path "PATH", gopath/"bin"
# We are not able to vendor these packages due to a "go get" bug in
# vendoring packages with platform dependent code. So we have to get
# these packages for the buid.
cd gopath/"src" do
system "go", "get", "github.com/currantlabs/ble"
system "go", "get", "github.com/raff/goble"
system "go", "get", "github.com/mgutz/logxi/v1"
end
cd gopath/"src/mynewt.apache.org/newtmgr/newtmgr" do
system "go", "install"
bin.install gopath/"bin/newtmgr"
end
end
test do
# Check for Newtmgr in first word of output.
assert_match "Newtmgr", shell_output("#{bin}/newtmgr").split.first
end
end