2014-09-28 01:30:19 +00:00
|
|
|
class Moco < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Stub server with Maven, Gradle, Scala, and shell integration"
|
2014-09-28 01:30:19 +00:00
|
|
|
homepage "https://github.com/dreamhead/moco"
|
2015-06-08 11:39:44 +00:00
|
|
|
url "http://central.maven.org/maven2/com/github/dreamhead/moco-runner/0.10.1/moco-runner-0.10.1-standalone.jar"
|
|
|
|
version "0.10.1"
|
|
|
|
sha256 "77996c0c5518beec0179fcdef83c2c606c5704073efc4ab6f9af80fc7756efbe"
|
2014-09-28 01:30:19 +00:00
|
|
|
|
2015-06-08 11:52:22 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
|
|
|
sha256 "c3ade71eea4010c60bc478e9a89fe888762b46f22855219148ede03bf952d62a" => :yosemite
|
|
|
|
sha256 "bd91b8f2dcc6d373a0d4e3a0639582c84c2b783927a1765543e5d333475cf02c" => :mavericks
|
|
|
|
sha256 "baf157a25988a5b80e3efeaa265d1f6032c183fa1e6a3fe8c3338e8246573b65" => :mountain_lion
|
|
|
|
end
|
|
|
|
|
2014-09-28 01:30:19 +00:00
|
|
|
def install
|
2015-06-08 11:39:44 +00:00
|
|
|
libexec.install "moco-runner-0.10.1-standalone.jar"
|
|
|
|
bin.write_jar_script libexec/"moco-runner-0.10.1-standalone.jar", "moco"
|
2014-09-28 01:30:19 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2014-10-06 10:35:18 +00:00
|
|
|
require "net/http"
|
|
|
|
|
|
|
|
(testpath/"config.json").write <<-EOS.undent
|
2014-09-28 01:30:19 +00:00
|
|
|
[
|
|
|
|
{
|
|
|
|
"response" :
|
|
|
|
{
|
|
|
|
"text" : "Hello, Moco"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
2014-10-06 10:35:18 +00:00
|
|
|
EOS
|
|
|
|
|
|
|
|
port = 12306
|
|
|
|
thread = Thread.new do
|
|
|
|
system bin/"moco", "start", "-p", port, "-c", testpath/"config.json"
|
2014-09-28 01:30:19 +00:00
|
|
|
end
|
2014-10-06 10:35:18 +00:00
|
|
|
|
|
|
|
# Wait for Moco to start.
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
response = Net::HTTP.get URI "http://localhost:#{port}"
|
|
|
|
assert_equal "Hello, Moco", response
|
|
|
|
thread.exit
|
2014-09-28 01:30:19 +00:00
|
|
|
end
|
|
|
|
end
|