2011-12-18 04:19:38 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Dart < Formula
|
|
|
|
homepage 'http://www.dartlang.org/'
|
2012-08-15 19:56:23 +00:00
|
|
|
|
|
|
|
if MacOS.prefer_64_bit?
|
2012-10-20 21:37:50 +00:00
|
|
|
url 'https://gsdview.appspot.com/dart-editor-archive-integration/13679/dartsdk-macos-64.zip'
|
|
|
|
sha1 'b6f4902cbc48e59799980b2830108ccb2fe8d2b7'
|
2012-08-15 19:56:23 +00:00
|
|
|
else
|
2012-10-20 21:37:50 +00:00
|
|
|
url 'https://gsdview.appspot.com/dart-editor-archive-integration/13679/dartsdk-macos-32.zip'
|
|
|
|
sha1 'aa92ba954aa730e58216520f9ddd7c0489d7ae06'
|
2012-08-15 19:56:23 +00:00
|
|
|
end
|
|
|
|
|
2012-10-20 21:37:50 +00:00
|
|
|
version '13679'
|
2011-12-18 04:19:38 +00:00
|
|
|
|
|
|
|
def shim_script target
|
|
|
|
<<-EOS.undent
|
|
|
|
#!/bin/bash
|
2012-06-08 17:26:55 +00:00
|
|
|
exec dart "#{target}" "$@"
|
2011-12-18 04:19:38 +00:00
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
libexec.install Dir['*']
|
|
|
|
|
2012-06-08 17:26:55 +00:00
|
|
|
bin.install_symlink libexec+'bin/dart'
|
2012-10-20 21:37:50 +00:00
|
|
|
(bin+'dart2js').write shim_script(libexec+'pkg/compiler/implementation/dart2js.dart')
|
|
|
|
(bin+'dartdoc').write shim_script(libexec+'pkg/dartdoc/bin/dartdoc.dart')
|
2012-06-08 17:26:55 +00:00
|
|
|
(bin+'pub').write shim_script(libexec+'util/pub/pub.dart')
|
2011-12-18 04:19:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test
|
2012-04-20 05:01:38 +00:00
|
|
|
mktemp do
|
|
|
|
(Pathname.pwd+'sample.dart').write <<-EOS.undent
|
|
|
|
void main() {
|
|
|
|
Options opts = new Options();
|
|
|
|
for (String arg in opts.arguments) {
|
|
|
|
print(arg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
|
|
|
|
`#{bin}/dart sample.dart test message` == "test\nmessage\n"
|
|
|
|
end
|
2011-12-18 04:19:38 +00:00
|
|
|
end
|
|
|
|
end
|