├── Aliases └── io.js ├── Formula └── iojs.rb ├── LICENSE.txt └── README.md /Aliases/io.js: -------------------------------------------------------------------------------- 1 | ../Formula/iojs.rb -------------------------------------------------------------------------------- /Formula/iojs.rb: -------------------------------------------------------------------------------- 1 | class Iojs < Formula 2 | homepage "https://iojs.org/" 3 | url "https://iojs.org/dist/v1.0.4/iojs-v1.0.4.tar.gz" 4 | sha256 "59f4d34eafe70b1e96efba7491556db9ec449e5774352885a73ff41bad7c2965" 5 | 6 | conflicts_with "node", :because => "io.js includes a symlink named node for compatibility." 7 | 8 | option "with-debug", "Build with debugger hooks" 9 | option "without-npm", "npm will not be installed" 10 | option "without-completion", "npm bash completion will not be installed" 11 | 12 | depends_on :python => :build 13 | 14 | resource "npm" do 15 | url "https://registry.npmjs.org/npm/-/npm-2.3.0.tgz" 16 | sha1 "3588ec5c18fb5ac41e5721b0ea8ece3a85ab8b4b" 17 | end 18 | 19 | def install 20 | args = %W[--prefix=#{prefix} --without-npm] 21 | args << "--debug" if build.with? "debug" 22 | 23 | system "./configure", *args 24 | system "make", "install" 25 | 26 | if build.with? "npm" 27 | resource("npm").stage buildpath/"npm_install" 28 | 29 | # make sure npm can find iojs 30 | ENV.prepend_path "PATH", bin 31 | 32 | # set log level temporarily for npm's `make install` 33 | ENV["NPM_CONFIG_LOGLEVEL"] = "verbose" 34 | 35 | cd buildpath/"npm_install" do 36 | system "./configure", "--prefix=#{libexec}/npm" 37 | system "make", "install" 38 | end 39 | 40 | if build.with? "completion" 41 | bash_completion.install \ 42 | buildpath/"npm_install/lib/utils/completion.sh" => "npm" 43 | end 44 | end 45 | end 46 | 47 | def post_install 48 | return if build.without? "npm" 49 | 50 | node_modules = HOMEBREW_PREFIX/"lib/node_modules" 51 | node_modules.mkpath 52 | npm_exec = node_modules/"npm/bin/npm-cli.js" 53 | # Kill npm but preserve all other modules across iojs updates/upgrades. 54 | rm_rf node_modules/"npm" 55 | 56 | cp_r libexec/"npm/lib/node_modules/npm", node_modules 57 | # This symlink doesn't hop into homebrew_prefix/bin automatically so 58 | # remove it and make our own. This is a small consequence of our bottle 59 | # npm make install workaround. All other installs **do** symlink to 60 | # homebrew_prefix/bin correctly. We ln rather than cp this because doing 61 | # so mimics npm's normal install. 62 | ln_sf npm_exec, "#{HOMEBREW_PREFIX}/bin/npm" 63 | 64 | # Let's do the manpage dance. It's just a jump to the left. 65 | # And then a step to the right, with your hand on rm_f. 66 | ["man1", "man3", "man5", "man7"].each do |man| 67 | rm_f Dir[HOMEBREW_PREFIX/"share/man/#{man}/{npm.,npm-,npmrc.}*"] 68 | Dir[libexec/"npm/share/man/#{man}/npm*"].each { |f| ln_sf f, HOMEBREW_PREFIX/"share/man/#{man}" } 69 | end 70 | 71 | npm_root = node_modules/"npm" 72 | npmrc = npm_root/"npmrc" 73 | npmrc.atomic_write("prefix = #{HOMEBREW_PREFIX}\n") 74 | end 75 | 76 | def caveats 77 | s = "" 78 | 79 | if build.with? "npm" 80 | s += <<-EOS.undent 81 | If you update npm itself, do NOT use the npm update command. 82 | The upstream-recommended way to update npm is: 83 | npm install -g npm@latest 84 | EOS 85 | else 86 | s += <<-EOS.undent 87 | Homebrew has NOT installed npm. If you later install it, you should supplement 88 | your NODE_PATH with the npm module folder: 89 | #{HOMEBREW_PREFIX}/lib/node_modules 90 | EOS 91 | end 92 | 93 | s 94 | end 95 | 96 | test do 97 | path = testpath/"test.js" 98 | path.write "console.log('hello');" 99 | 100 | output = `#{bin}/iojs #{path}`.strip 101 | assert_equal "hello", output 102 | assert_equal 0, $?.exitstatus 103 | 104 | if build.with? "npm" 105 | # make sure npm can find node 106 | ENV.prepend_path "PATH", opt_bin 107 | assert_equal which("node"), opt_bin/"node" 108 | assert (HOMEBREW_PREFIX/"bin/npm").exist?, "npm must exist" 109 | assert (HOMEBREW_PREFIX/"bin/npm").executable?, "npm must be executable" 110 | system "#{HOMEBREW_PREFIX}/bin/npm", "--verbose", "install", "npm@latest" 111 | end 112 | end 113 | end 114 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2009-2015 Homebrew contributors. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **NOTE**: Work is ongoing to get an io.js formula into the official Homebrew tap. Follow [the progress here](https://github.com/Homebrew/homebrew/pull/35853)! 2 | 3 | # homebrew-iojs 4 | A Homebrew formula for https://iojs.org. 5 | 6 | ## How do I install this formula? 7 | `brew install smockle/iojs/iojs` 8 | 9 | Or `brew tap smockle/homebrew-iojs` and then `brew install iojs`. 10 | 11 | Or install via URL (which will not receive updates): 12 | 13 | ``` 14 | brew install https://raw.githubusercontent.com/smockle/homebrew-iojs/master/Formula/iojs.rb 15 | ``` 16 | 17 | ## Documentation 18 | `brew help`, `man brew` or check [Homebrew's documentation](https://github.com/Homebrew/homebrew/tree/master/share/doc/homebrew#readme). 19 | --------------------------------------------------------------------------------