class NodeAT6 < Formula desc "Platform built on V8 to build network applications" homepage "https://nodejs.org/" url "https://nodejs.org/dist/v6.14.4/node-v6.14.4.tar.xz" sha256 "9a4bfc99787f8bdb07d5ae8b1f00ec3757e7b09c99d11f0e8a5e9a16a134ec0f" revision 1 bottle do sha256 "5c493aa31e3950ef73fc825c60a152a2653d89ae6a2cad8e4632502ed4738a5d" => :mojave sha256 "be5b70fa6c55407565e6b9bbd913efcd357d7e38175869d8dfe1b97347a2ca99" => :high_sierra sha256 "3393c15c0362128e3579ef41e3dd82d1fb182db60d4fbe2b554088df7f9199ac" => :sierra end keg_only :versioned_formula depends_on "pkg-config" => :build depends_on "python@2" => :build # Per upstream - "Need g++ 4.8 or clang++ 3.4". fails_with :clang if MacOS.version <= :snow_leopard fails_with :gcc_4_0 fails_with :gcc_4_2 ("4.3".."4.7").each do |n| fails_with :gcc => n end resource "icu4c" do url "https://ssl.icu-project.org/files/icu4c/58.2/icu4c-58_2-src.tgz" version "58.2" sha256 "2b0a4410153a9b20de0e20c7d8b66049a72aef244b53683d0d7521371683da0c" end def install resource("icu4c").stage buildpath/"deps/icu" system "./configure", "--prefix=#{prefix}", "--with-intl=full-icu" system "make", "install" end def post_install (lib/"node_modules/npm/npmrc").atomic_write("prefix = #{HOMEBREW_PREFIX}\n") end test do path = testpath/"test.js" path.write "console.log('hello');" output = shell_output("#{bin}/node #{path}").strip assert_equal "hello", output output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"en-EN\").format(1234.56))'").strip assert_equal "1,234.56", output output = shell_output("#{bin}/node -e 'console.log(new Intl.NumberFormat(\"de-DE\").format(1234.56))'").strip assert_equal "1.234,56", output # make sure npm can find node ENV.prepend_path "PATH", opt_bin ENV.delete "NVM_NODEJS_ORG_MIRROR" assert_equal which("node"), opt_bin/"node" assert_predicate bin/"npm", :exist?, "npm must exist" assert_predicate bin/"npm", :executable?, "npm must be executable" npm_args = ["-ddd", "--cache=#{HOMEBREW_CACHE}/npm_cache", "--build-from-source"] system "#{bin}/npm", *npm_args, "install", "npm@latest" system "#{bin}/npm", *npm_args, "install", "bignum" end end