Created
April 22, 2016 16:36
-
-
Save ctdk/54545beb47744ffae8f1e9ea522c4e8b to your computer and use it in GitHub Desktop.
grafana formula, in progress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "language/go" | |
class Grafana < Formula | |
desc "Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB." | |
homepage "https://grafana.org" | |
url "https://github.com/grafana/grafana/archive/v3.0-beta5.tar.gz" | |
version "3.0-beta5" | |
sha256 "db9fcc0f4d90236d0cdaba2ab1ddd06bc59264aff93ead5c3a1b680804c8f8cd" | |
head "https://github.com/grafana/grafana.git" | |
depends_on "go" => :build | |
depends_on "nodejs" => :build | |
def install | |
ENV.prepend_path "PATH", "#{Formula["node"].opt_libexec}/npm/bin" | |
ENV["GOPATH"] = buildpath | |
grafana_path = buildpath/"src/github.com/grafana/grafana" | |
grafana_path.install Dir["*"] | |
grafana_path.install ".jscs.json", ".jsfmtrc", ".jshintrc", ".bowerrc" | |
Language::Go.stage_deps resources, buildpath/"src" | |
cd grafana_path do | |
# Might do it differently for head vs. release | |
system "go", "run", "build.go", "setup" | |
system buildpath/"bin/godep", "restore" | |
#(buildpath/"src/github.com/grafana").mkpath | |
#FileUtils.ln_s buildpath, grafana_path | |
system "go", "run", "build.go", "build" | |
system "npm", "install" | |
system "npm", "install", "grunt-cli" | |
#system "node_modules/grunt-cli/bin/grunt" | |
end | |
bin.install grafana_path/"bin/grafana-cli" | |
bin.install grafana_path/"bin/grafana-server" | |
(etc/"grafana").mkpath | |
(var/"lib/grafana").mkpath | |
(share/"grafana").mkpath | |
(share/"grafana").install Dir["conf", "public", "vendor"] | |
etc.install grafana_path/"conf/sample.ini" => "grafana/grafana.ini" | |
end | |
test do | |
# `test do` will create, run in and delete a temporary directory. | |
# | |
# This test will fail and we won't accept that! It's enough to just replace | |
# "false" with the main program this formula installs, but it'd be nice if you | |
# were more thorough. Run the test with `brew test grafana`. Options passed | |
# to `brew install` such as `--HEAD` also need to be provided to `brew test`. | |
# | |
# The installed folder is not in the path, so use the entire path to any | |
# executables being tested: `system "#{bin}/program", "do", "something"`. | |
system "false" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A plist is launchctl's init config, basically. It should be fine, assuming (which seems likely) that it can chdir to /usr/local/share/grafana.