lib/invoker.rb in invoker-1.4.1 vs lib/invoker.rb in invoker-1.5.1

- old
+ new

@@ -42,10 +42,14 @@ def darwin? ruby_platform.downcase.include?("darwin") end + def linux? + ruby_platform.downcase.include?("linux") + end + def ruby_platform RUBY_PLATFORM end def load_invoker_config(file, port) @@ -98,22 +102,31 @@ yield end end def notify_user(message) - run_without_bundler { check_and_notify_with_terminal_notifier(message) } + if Invoker.darwin? + run_without_bundler { check_and_notify_with_terminal_notifier(message) } + elsif Invoker.linux? + notify_with_libnotify(message) + end end def check_and_notify_with_terminal_notifier(message) - return unless Invoker.darwin? - command_path = `which terminal-notifier` if command_path && !command_path.empty? system("terminal-notifier -message '#{message}' -title Invoker") end end + def notify_with_libnotify(message) + begin + require "libnotify" + Libnotify.show(body: message, summary: "Invoker", timeout: 2.5) + rescue LoadError; end + end + def migrate_old_config(old_config, config_location) new_config = File.join(config_location, 'config') File.open(new_config, 'w') do |file| file.write(old_config) end @@ -128,8 +141,12 @@ if File.writable?(Dir.home) Dir.home else Etc.getpwuid(Process.uid).dir end + end + + def default_tld + 'dev' end end end