2014-12-23 15:30:04 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Wellington < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Adds file awareness to SASS"
|
2014-12-23 15:30:04 +00:00
|
|
|
homepage "https://github.com/wellington/wellington"
|
2015-04-29 20:33:38 +00:00
|
|
|
url "https://github.com/wellington/wellington/archive/v0.8.1.tar.gz"
|
|
|
|
sha256 "77b41ee1b3e0095dd54a8575c6b05fdef7bf7bc059b46e534b3d06f84ab2422c"
|
2014-12-23 15:30:04 +00:00
|
|
|
head "https://github.com/wellington/wellington.git"
|
|
|
|
|
2015-01-05 17:54:34 +00:00
|
|
|
bottle do
|
2015-02-20 15:38:28 +00:00
|
|
|
cellar :any
|
2015-05-19 09:05:31 +00:00
|
|
|
sha256 "c997930e1d617e3bc0f09136c3d102c592634cec1d9ef8c9e26c1592af58619f" => :yosemite
|
|
|
|
sha256 "fed8ce27ec30e8d648fd148dc83d7ad937456b04a7b1d5eb435ed0db4fae6698" => :mavericks
|
|
|
|
sha256 "e3fa0c5f9dea85b93b43f4cc4681c8e67dcfbf4dae34a51d0a59f81c6fed063a" => :mountain_lion
|
2015-01-05 17:54:34 +00:00
|
|
|
end
|
|
|
|
|
2014-12-23 15:30:04 +00:00
|
|
|
needs :cxx11
|
|
|
|
|
|
|
|
depends_on "go" => :build
|
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
|
2015-04-29 20:33:38 +00:00
|
|
|
stable do
|
|
|
|
depends_on "libsass"
|
2014-12-23 15:30:04 +00:00
|
|
|
end
|
|
|
|
|
2015-04-29 20:33:38 +00:00
|
|
|
devel do
|
|
|
|
url "https://github.com/wellington/wellington/archive/c574754c39806e8c52682f15f49c8ff819d0f962.tar.gz"
|
|
|
|
sha256 "92c5d4bdd6260f96aed0e20fa06c6200b1c57281dbd32dbd00b1c06636ef6e10"
|
|
|
|
|
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "libtool" => :build
|
|
|
|
end
|
|
|
|
|
|
|
|
head do
|
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "libtool" => :build
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/tools/godep" do
|
|
|
|
url "https://github.com/tools/godep.git", :revision => "58d90f262c13357d3203e67a33c6f7a9382f9223"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/kr/fs" do
|
|
|
|
url "https://github.com/kr/fs.git", :revision => "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "golang.org/x/tools" do
|
|
|
|
url "https://github.com/golang/tools.git", :revision => "473fd854f8276c0b22f17fb458aa8f1a0e2cf5f5"
|
2014-12-23 15:30:04 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2015-04-29 20:33:38 +00:00
|
|
|
version = File.read("version.txt").chomp
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
|
|
|
|
cd "src/github.com/tools/godep" do
|
|
|
|
system "go", "install"
|
|
|
|
end
|
|
|
|
system "bin/godep", "restore"
|
|
|
|
|
|
|
|
# Build libsass from source for devel build
|
|
|
|
unless stable?
|
|
|
|
ENV.cxx11
|
|
|
|
ENV["PKG_CONFIG_PATH"] = buildpath/"src/github.com/wellington/go-libsass/lib/pkgconfig"
|
|
|
|
|
|
|
|
ENV.append "CGO_LDFLAGS", "-stdlib=libc++" if ENV.compiler == :clang
|
|
|
|
cd "src/github.com/wellington/go-libsass/" do
|
|
|
|
system "make", "deps"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# symlink into $GOPATH so builds work
|
2014-12-23 15:30:04 +00:00
|
|
|
mkdir_p buildpath/"src/github.com/wellington"
|
|
|
|
ln_s buildpath, buildpath/"src/github.com/wellington/wellington"
|
|
|
|
|
2015-04-29 20:33:38 +00:00
|
|
|
system "go", "build", "-ldflags", "-X main.version #{version}", "-o", "dist/wt", "wt/main.go"
|
2014-12-23 15:30:04 +00:00
|
|
|
bin.install "dist/wt"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
s = "div { p { color: red; } }"
|
|
|
|
expected = <<-EOS.undent
|
|
|
|
Reading from stdin, -h for help
|
2015-04-29 20:33:38 +00:00
|
|
|
/* line 1, stdin */
|
2014-12-23 15:30:04 +00:00
|
|
|
div p {
|
|
|
|
color: red; }
|
|
|
|
EOS
|
|
|
|
output = `echo '#{s}' | #{bin}/wt`
|
|
|
|
assert_equal(expected, output)
|
|
|
|
end
|
|
|
|
end
|