Module: NewlineHw::ChromeManifest
- Defined in:
- lib/newline_hw/chrome_manifest.rb
Constant Summary collapse
- NAME =
"com.theironyard.newlinecli.hw".freeze
Class Method Summary collapse
- .binary_path ⇒ Object
- .generate ⇒ Object
- .native_messaging_manifest_path ⇒ Object
- .remove ⇒ Object
- .write ⇒ Object
Class Method Details
.binary_path ⇒ Object
8 9 10 |
# File 'lib/newline_hw/chrome_manifest.rb', line 8 def binary_path File. File.join(NewlineHw.root_path, "exe", "newline_hw_stream_shim") end |
.generate ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# 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 ⇒ Object
12 13 14 |
# File 'lib/newline_hw/chrome_manifest.rb', line 12 def native_messaging_manifest_path File.("~/Library/Application Support/Google/Chrome/NativeMessagingHosts/#{NAME}.json") end |
.remove ⇒ Object
37 38 39 40 |
# 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 ⇒ Object
29 30 31 32 33 34 35 |
# 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 |