Skip to content

Instantly share code, notes, and snippets.

@chrmoritz
Last active April 26, 2019 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrmoritz/1dbb5d753cf3399efc368d3264585faa to your computer and use it in GitHub Desktop.
Save chrmoritz/1dbb5d753cf3399efc368d3264585faa to your computer and use it in GitHub Desktop.
require "language/node"
class Joplin < Formula
desc "Note taking and to-do application with synchronisation capabilities"
homepage "https://joplin.cozic.net/"
url "https://registry.npmjs.org/joplin/-/joplin-1.0.124.tgz"
sha256 "6da64d5ff859d2e6648ebcdc4e99486461db4eba13d4827f0261ac4d5be8de35"
revision 1
bottle do
sha256 "3799db4cb2158b10df411b3fda68d8d15da46cabdd83c9b6b06cf7572eb5f1e4" => :mojave
sha256 "e03b68edfeb93e86fbb308df5c09287d559cf662e8544c64467ead0473a662e2" => :high_sierra
sha256 "1b50e730bcf3de2d3acbb7b759b5fa46082802a34a3591bdc19e022dcc59c57d" => :sierra
end
depends_on "python@2" => :build
depends_on "node"
def install
# upgrade native addons to a version already compatible with the node 12 abi
inreplace "package.json" do |s|
s.gsub! "\"sharp\": \"^0.20.8\",", "\"sharp\": \"^0.22.1\","
s.gsub! "\"sqlite3\": \"^4.0.1\",", "\"sqlite3\": \"github:mapbox/node-sqlite3\#723de4ca\","
end
# replaced usage of the in sharp@0.22.0 removed deprecated functions with their suggested alternatives
inreplace "lib/shim-init-node.js",
".resize(Resource.IMAGE_MAX_DIMENSION, Resource.IMAGE_MAX_DIMENSION)\n .max()\n .withoutEnlargement()",
".resize(Resource.IMAGE_MAX_DIMENSION, Resource.IMAGE_MAX_DIMENSION, {fit: 'inside', withoutEnlargement: true})"
system "npm", "install", *Language::Node.std_npm_install_args(libexec)
bin.install_symlink Dir["#{libexec}/bin/*"]
end
test do
system bin/"joplin", "config", "editor", "subl"
assert_match "editor = subl", shell_output("#{bin}/joplin config")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment