diff --git a/Formula/sourcedocs.rb b/Formula/sourcedocs.rb new file mode 100644 index 0000000000..c7e546f91c --- /dev/null +++ b/Formula/sourcedocs.rb @@ -0,0 +1,32 @@ +class Sourcedocs < Formula + desc "Generate Markdown files from inline source code documentation" + homepage "https://github.com/eneko/SourceDocs" + url "https://github.com/eneko/SourceDocs/archive/0.5.1.tar.gz" + sha256 "3c2e2de695d49dbdd5acb49f8876042bdc97e8d6b95584d3ef6b592b8f10affc" + + depends_on :xcode => ["9.3", :build, :test] + + def install + system "swift", "build", "--disable-sandbox", "-c", "release", "-Xswiftc", "-static-stdlib" + bin.install ".build/release/sourcedocs" + end + + test do + assert_match "SourceDocs v#{version}", shell_output("#{bin}/sourcedocs version") + + # There are some issues with SourceKitten running in sandbox mode in Mojave + # The following test has been disabled on Mojave until that issue is resolved + # - https://github.com/Homebrew/homebrew/pull/50211 + # - https://github.com/Homebrew/homebrew-core/pull/32548 + if MacOS.version < "10.14" + mkdir "foo" do + system "swift", "package", "init" + system "swift", "build", "--disable-sandbox" + system "#{bin}/sourcedocs", "generate", + "--spm-module", "foo", + "--output-folder", testpath/"Documentation/Reference" + assert_predicate testpath/"Documentation/Reference/README.md", :exist? + end + end + end +end