Sha256: 8102f5ca169c0798ae6c69e1fb11cad18cfc489316dde67d1a253972e0bed9e6
Contents?: true
Size: 540 Bytes
Versions: 17
Compression:
Stored size: 540 Bytes
Contents
# frozen_string_literal: true require 'json' unless defined?(JSON) module Prettier PLUGIN = -File.expand_path('..', __dir__) BINARY = -File.join(PLUGIN, 'node_modules', 'prettier', 'bin-prettier.js') VERSION = -JSON.parse(File.read(File.join(PLUGIN, 'package.json')))['version'] class << self def run(args) quoted = args.map { |arg| arg.start_with?('-') ? arg : "\"#{arg}\"" } command = "node #{BINARY} --plugin \"#{PLUGIN}\" #{quoted.join(' ')}" system({ 'RBPRETTIER' => '1' }, command) end end end
Version data entries
17 entries across 17 versions & 1 rubygems