Show desktop notifications on Windows with Ruby - ruby

is there a way to display desktop notifications on Ruby when something happened? Something like notify-send. I saw one gem to do this with Ruby but I'm not sure if it works on Windows. Do I have to explicitly use C# to do this on Windows?

Related

Ruby for vscode without Gem and Ruby installed on the system

I am searching for simple Ruby gem that would be able to find definitions of methods.
First I installed this:
But it requires some gems(rubocop, ruby-debug-ide or solargraph) to be installed in order to work. It provides a lot of features as debugging etc, but I dont need them. I only want to be able to find methods definition.
I am using Vscode to access Rails project on network directory. So I don't want to install Ruby on my host OS (Windoiws 10 x64). Instead I provide a network directory to a guest Guiless Ubuntu (as Guest OS). The Rails server is run on the Ubuntu OS.
VSCode works perfectly well with network directories, but the extensions need Ruby environment that is pretty sad.
For example Sublime Text 3 does this painlessly and donesn't complain for gems. Even without having any Ruby stuff on the OS it is running on:
I want to stick with VSCode because it is the best I have used so far.
So the question is: Is there a Ruby extension for VSCODE that works without Ruby installed?
The only thing that can really parse Ruby is Ruby, so you need Ruby when working with Ruby code. Same goes for a lot of other languages in Visual Studio Code. Sublime provides a "good enough" reflector based on a very simplistic syntax parse. Visual Studio Code uses Solargraph which does way more.
If you don't like that requirement you can always use or write a different Ruby plugin that has no such dependencies. As someone who does a lot of Ruby work, though, the installation is a minor inconvenience for all the benefits it provides.
#Hairi have you tried the ruby-symbols extension?
https://github.com/rubyide/vscode-ruby/issues/40
Keyboard shortcut for Windows is Ctrl + Shift + O.
And for Macs, it's Cmd + Shift + O.

How can I run Win32OLE calls from ubuntu?

I have some simple sinatra apps that make use of the OTA COM dll for talking to Quality Center.
I want to move those sites into docker images, so I can host them on my docker server.
It occurred to me that theoretically I should be able to get this working with strategic use of wine.
Hint: I remember reading somewhere that to get Win32OLE working in Ruby from linux you can install the windows version of ruby using wine, then run your scripts through the windows version of ruby.
https://www.ruby-forum.com/topic/88576 says
i've managed this before. i installed the one-click installer under
crossover office and the used that. another option is installing
msys, compiling ruby under that, and then using that ruby. in any
case you need to install/build another ruby under the crossover environment.
and later
In the end I installed office 2000 with Crossover, then I used the
windows installer to install windows ruby into the same bottle as
office. Finally I put the following bash script in my /usr/bin directory
so I can run my ruby files with '#> wruby some_script.rb'
==/usr/bin/wruby
#!/usr/bin/env ruby
`/opt/cxofficebeta/bin/wine --bottle myBottle --cx-app ruby.exe #{ARGV.join(" ")}`
I know nothing about Wine or crossover or bottles(?), so I'm out of my depth.
How would I do this? What would a Dockerfile I could use as a base image look like?
Note: I found some docker images that claim to install wine (which may make a good starting point)
https://registry.hub.docker.com/u/ambakshi/wine-x11-vcpython27/
https://registry.hub.docker.com/u/monokrome/wine/
https://registry.hub.docker.com/u/yantis/wine/
http://www.perlmonks.org/?node_id=430194 talks about getting Win32::OLE working under ubuntu.
Don't forget to use a USER xx in your Dockerfile as it is important to use a non privileged user in wine. You will find in registry.hub.docker.com several examples of wine with such a user.

Simple way to install Ruby with gems on a customer site

What's the simplest way -- ideally a single click -- to set up a ruby (not rails) runtime environment on a local Windows system (not a web site), with specific gems?
I have code for a customer that runs on their local system. I've been sending them ocra executables, and that sorta, kinda, usually works, but is showing more problems all the time.
So I want to set up a native ruby environment there -- actually I want them to set it up -- so I can just send straight ruby code. But it's got to have the specific gems I use (FxRuby, several others).
Most important, it's gotta be dead simple for them -- ideally a single click. I'm trying to avoid a physical trip to their site.
Thanks.
As they are running Windows why not go to the ruby-lang.org website and download the windows installer - depending on the edition they do come with gems - some with FXRuby (which I use myself) you can then send the app to them and they can install Ruby - It is quiite simple to do.
In the ruby code before you make it an ocra file put
`gem install mygem`
`gem install myothergem`
in backsticks...
This will run in the command line of the receiving computer. Then require the gems later in your script.
Let me know if this works.

growl example windows 7

I grabbed the growl for .NET on this page http://www.growlforwindows.com/gfw/developers.aspx
i ran the examples and nothing happened. Am i suppose to do something before running the example? I am using windows 7.
that project is an example of how to send a notification. in order for anything to happen, you also have to have something to receive the notification. in other words, you have to have Growl for Windows installed and running as well.

Vista Console App?

I'm doing a fair bit of work in Ruby recently, and using
ruby script/console
Is absolutely critical. However, I'm really disappointed with the default Windows console in Vista, especially in that there's a really annoying bug where moving the cursor back when at the bottom of the screen irregularly causes it to jump back. Anyone have a decent console app they use in Windows?
I use Console2.
I like the tabbed interface and that copy works properly if text breaks at the end of a line.
Are you resizing the console window? I've found that the ruby scripts (irb, etc) that use the readline library don't work correctly with resized console windows (in XP or Vista).
Effectively I believe that the readline library expects the console window to be 80 characters wide, anything else and it goes bezerk. So far I haven't found a way to fix it on windows without giving up other nice features.
I have had some pleasant experiences with rxvt (comes with cygwin, does not need an x server running). Putty is also often mentioned as a good alternative.
You could also try to get xterm working :)
Powershell
Windows PowerShell is Microsoft's task automation framework, consisting of a command-line shell and associated scripting language built on top of, and integrated with the .NET Framework. PowerShell provides full access to COM and WMI, enabling administrators to perform administrative tasks on both local and remote Windows systems.

Resources