module NewlineHw::ChromeManifest
Constants
- NAME
Public Instance Methods
binary_path()
click to toggle source
# File lib/newline_hw/chrome_manifest.rb, line 8 def binary_path File.expand_path File.join(NewlineHw.root_path, "exe", "newline_hw_stream_shim") end
generate()
click to toggle source
# File lib/newline_hw/chrome_manifest.rb, line 16 def generate { name: NAME, description: "Quickly Clone and setup basic ruby and JS projects.", path: binary_path, type: "stdio", allowed_origins: [ "chrome-extension://fnhanbdccpjnnoohoppkeejljjljihcc/", "chrome-extension://knldjmfmopnpolahpmmgbagdohdnhkik/" ] } end
native_messaging_manifest_path()
click to toggle source
# File lib/newline_hw/chrome_manifest.rb, line 12 def native_messaging_manifest_path File.expand_path("~/Library/Application Support/Google/Chrome/NativeMessagingHosts/#{NAME}.json") end
remove()
click to toggle source
# File lib/newline_hw/chrome_manifest.rb, line 37 def remove return unless File.file?(native_messaging_manifest_path) FileUtils.rm native_messaging_manifest_path end
write()
click to toggle source
# File lib/newline_hw/chrome_manifest.rb, line 29 def write create_native_messaging_manifest_directory File.open(native_messaging_manifest_path, "w+") do |f| f.write(JSON.pretty_generate(generate)) end end
Private Instance Methods
create_native_messaging_manifest_directory()
click to toggle source
# File lib/newline_hw/chrome_manifest.rb, line 42 def create_native_messaging_manifest_directory return if Dir.exist?(File.dirname(native_messaging_manifest_path)) Dir.mkdir(File.dirname(native_messaging_manifest_path)) end