{"id":16945064,"url":"https://github.com/mattetti/mrstuff","last_synced_at":"2025-03-21T08:15:52.305Z","repository":{"id":749156,"uuid":"401295","full_name":"mattetti/MrStuff","owner":"mattetti","description":"MacRuby experimental wrappers","archived":false,"fork":false,"pushed_at":"2009-12-07T09:39:02.000Z","size":128,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-26T04:44:25.343Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattetti.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-12-06T02:14:24.000Z","updated_at":"2013-10-13T12:26:14.000Z","dependencies_parsed_at":"2022-08-06T10:00:42.401Z","dependency_job_id":null,"html_url":"https://github.com/mattetti/MrStuff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2FMrStuff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2FMrStuff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2FMrStuff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2FMrStuff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattetti","download_url":"https://codeload.github.com/mattetti/MrStuff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244759961,"owners_count":20505716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T21:19:42.734Z","updated_at":"2025-03-21T08:15:52.286Z","avatar_url":"https://github.com/mattetti.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"The MrStuff package provides wrappers for Cocoa APIs that are more familiar to Rubyists.\n\nSo far, there is a wrapper for `NSTask` (`MrTask`), and associated wrappers for `NSNotificationCenter`,\n`NSTask`, and `NSFileHandle`.\n\nMrNotificationCenter integrates with other Cocoa wrappers as follows:\n\n- Wrappers have an `#ns_object` method which returns the original `NSObject`\n- A `NOTIFICATIONS` constant is provided, which provides shorter `Symbol` names\n  for each notification provided by the original Cocoa class.\n\nFor instance, you can do the following:\n\n    task = MrTask.new(\"/usr/bin/ls\")\n    MrNotificationCenter.subscribe(task, :done) do |notification|\n      # notification.object is the MrTask\n      # notification.object.ns_object is the wrapped NSTask\n    end\n\nHowever, the wrapper provides improved async APIs. For instance:\n\n    task = MrTask.new(\"/usr/bin/ls\")\n    task.on_output do |output, notification|\n      # When the task gets data in its stdout, this event\n      # is triggered. A String is provided, rather than\n      # forcing you to extract the data from notification.userInfo\n      # and initializing a new String from the data.\n      #\n      # Note that the block arguments are optional\n    end\n    task.launch(\"/\")\n\nThe above example could be reduced even further to:\n\n    MrTask.launch(\"/usr/bin/ls\", \"/\") do |out, err, notification|\n      # This block is triggered once the task is terminated,\n      # and provides a String for both the standard output and\n      # error.\n      #\n      # The block arguments are optional\n    end\n\nOther events are also available as needed:\n\n    task = MrTask.new(\"/usr/bin/ls\")\n    task.on_done do |notification|\n      # This event is triggered once the task is done.\n      #\n      # You can call notification.object.standard_output\n      # or notification.object.error_output to get a\n      # String for the outputs.\n    end\n\nAs you can see, the APIs are fairly flexible and allow you to approach the\nsame problem in different (asynchronous) ways. At the same time, common\ntasks are wrapped up with appropriate async callbacks.\n\n    task = MrTask.launch(\"/usr/bin/ruby\", \"-e\", \"'sleep'\")\n    task.kill do |notification|\n      # This will be the :done event\n    end","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattetti%2Fmrstuff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattetti%2Fmrstuff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattetti%2Fmrstuff/lists"}