Try using Cocoa from Ruby

Try using Cocoa (macOS API) from Ruby. There used to be something called RubyCocoa. It seems to be stuck now. A close one is a gem package called cocoa. https://github.com/patrickhno/cocoa/

install.

% gem install cocoa Successfully installed cocoa-0.1.6 Parsing documentation for cocoa-0.1.6 Done installing documentation for cocoa after 3 seconds 1 gem installed

Try running the sample program.

test1.rb


require 'cocoa'
Cocoa::NSAutoreleasePool.new
app = Cocoa::NSApplication.sharedApplication
app.setActivationPolicy Cocoa::NSApplicationActivationPolicyRegular
app.activateIgnoringOtherApps true
alert = Cocoa::NSAlert.alloc.init.autorelease
alert.setMessageText "Hello world!"
alert.runModal

% ruby test1.rb /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Fixnum is deprecated /usr/local/lib/ruby/gems/2.7.0/gems/cocoa-0.1.6/lib/cocoa/objc/method_def.rb:154: warning: constant ::Bignum is deprecated

It runs safely, but don't worry about the warning. Let's fix it next time.

Recommended Posts

Try using Cocoa from Ruby
Try using gRPC in Ruby
[Programming Encyclopedia] §2 Try using Ruby
Try using libGDX
Try using Maven
Try using powermock-mockito2-2.0.2
Try using GraalVM
Try using jmockit 1.48
Try using sql-migrate
Try using SwiftLint
Try using Log4j 2.0
Try Ruby Minitest
Try using the Emotion API from Android
[ruby] Create DHT11 / 22 class from scratch using datasheet
Try using GPS receiver kit with RaspberryPi3 (Ruby)
Try accessing the dataset from Java using JZOS
Try using Axon Framework
Try using java.lang.Math methods
Try using PowerMock's WhiteBox
Try using Talend Part 2
From Java to Ruby !!
Try using Talend Part 1
Try using F # list
Try using each_with_index method
Try using Spring JDBC
Try using the query attribute of Ruby on Rails
Try using RocksDB in Java
Try Spring Boot from 0 to 100.
Try using GloVe with Deeplearning4j
Try using view_component with rails
Try scraping using java [Notes]
Try using letter_opener_web for inquiries
Try creating APNG from JavaFX
Creating a calendar using Ruby
[Swift] Try using Collection View
Use C program from Ruby
Use Face API from Ruby
Statically typed Ruby using Sorbet
Create a fortune using Ruby
[Ruby] Receive input from console
Try using IntelliJ IDEA once
CHATBOT (Dialogflow) used from Ruby
Try using Spring Boot Security
Using Docker from Java Gradle
[Rails] Try using Faraday middleware
[Processing] Try using GT Force.
People using docker Try using docker-compose
Try passing values from Java Servlet to iPhone app using JSON
Easily try Ruby 3.0.0 type checking (rbs)
[Ruby on Rails] Read try (: [],: key)
Write Ruby methods using C (Part 1)
Try to implement Yubaba in Ruby
Try using Redmine on Mac docker
Install Ruby 2.5 on CentOS 7 using SCL
[Ruby] Escape from multiple loops [Nest]
Try using Redis with Java (jar)
Introduction to Ruby (from other languages)
[Java] Try to implement using generics
Try using the messaging system Pulsar
[Complete programming] §3 Let's calculate using Ruby!
Try file locking in Ruby directory