source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
spec/unit/libraries/metadata_util_spec.rb
Ruby
mit
230
master
2,250
require 'spec_helper' include MacOS describe MacOS::MetadataUtil do context 'when passed a root volume that has indexing enabled' do before do allow_any_instance_of(MacOS::MetadataUtil).to receive(:volume_current_state) .and_return('Indexing enabled.') end it 'returns an array containing th...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
spec/unit/libraries/xcversion_spec.rb
Ruby
mit
230
master
1,146
require 'spec_helper' include MacOS describe MacOS::XCVersion do context 'when given an Xcode object with a download url' do it 'returns the appropriate --url syntax containing the url' do xcode = MacOS::Xcode.new('10.0', '/Applications/Xcode.app', 'https://www.apple.com') expect(XCVersion.download_u...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
spec/unit/libraries/command_line_tools_spec.rb
Ruby
mit
230
master
5,513
require 'spec_helper' include MacOS shared_context 'able to create on-demand installation demand' do before do allow(FileUtils).to receive(:touch).and_return(true) allow(FileUtils).to receive(:chown).and_return(true) end end shared_context 'on macOS Mojave' do before do allow_any_instance_of(MacOS::...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
spec/unit/libraries/security_cmd_spec.rb
Ruby
mit
230
master
6,019
require 'spec_helper' include MacOS describe MacOS::SecurityCommand, 'certificate creation commands' do let(:p12_cert) { MacOS::SecurityCommand.new(**{ cert: '/Users/vagrant/Test.p12' }) } let(:p12_cert_kc) { MacOS::SecurityCommand.new(**{ cert: '/Users/vagrant/Test.p12', keychain: 'test.keychain' }) } let(:cer_...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/keychain.rb
Ruby
mit
230
master
1,145
unified_mode true provides :keychain default_action :create property :path, String, name_property: true property :password, String, sensitive: true property :user, String action_class do def security SecurityCommand.new(**{ keychain: new_resource.path }) end end action :create do execute 'create a keychai...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/certificate.rb
Ruby
mit
230
master
1,003
unified_mode true provides :certificate default_action :install property :path, String, name_property: true property :password, String, sensitive: true property :keychain_path, String property :keychain_password, String, sensitive: true property :apps, Array, default: [] property :user, String action :install do c...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/command_line_tools.rb
Ruby
mit
230
master
2,142
unified_mode true provides :command_line_tools property :name, String, default: '' property :compile_time, [true, false], description: 'Install the Xcode Command Line Tools at compile time.', default: false, desired_state: false action :install do if macos.beta? directory 'create CLT folder' do path ...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/system_preference.rb
Ruby
mit
230
master
912
unified_mode true provides :system_preference property :preference, Symbol, required: true, desired_state: false property :setting, String, required: true load_current_value do |desired| get_setting = ['-get', desired.preference.to_s].join('') command = shell_out('/usr/sbin/systemsetup', get_setting) current_s...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/macos_user.rb
Ruby
mit
230
master
7,802
unified_mode true provides :macos_user default_action :create property :username, String, name_property: true property :password, String, sensitive: true property :autologin, [TrueClass] property :admin, [TrueClass] property :fullname, String property :groups, [Array, String] property :hidden, [true, false], default:...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/remote_management.rb
Ruby
mit
230
master
3,760
unified_mode true provides :remote_management default_action :enable property :users, [String, Array], default: 'all', description: 'The user(s) whose ARD privileges will be configured.', coerce: ->(p) { [p].flatten } property :privileges, [String, Array, RemoteManagement...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/xcode.rb
Ruby
mit
230
master
3,077
unified_mode true provides :xcode default_action [:install_gem, :install_xcode, :install_simulators] property :version, String, name_property: true property :path, String, default: '/Applications/Xcode.app' property :ios_simulators, Array property :download_url, String, default: '' property :apple_id, Hash action_cl...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/spotlight.rb
Ruby
mit
230
master
1,058
unified_mode true provides :spotlight default_action :set property :volume, String, name_property: true property :indexed, [true, false], default: true property :searchable, [true, false], default: true action_class do def state new_resource.indexed ? 'on' : 'off' end def search new_resource.searchabl...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/automatic_software_updates.rb
Ruby
mit
230
master
1,499
unified_mode true provides :automatic_software_updates property :check, [true, false] property :download, [true, false] property :install_os, [true, false] property :install_app_store, [true, false] property :install_critical, [true, false] software_update_plist = '/Library/Preferences/com.apple.SoftwareUpdate.plist...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/defaults.rb
Ruby
mit
230
master
1,438
unified_mode true provides :defaults property :domain, String, name_property: true property :option, String, default: 'write' property :read_only, [true, false], default: false property :settings, Hash property :system, [true, false] property :user, String, required: true action_class do def convert_to_string_from...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
resources/pmset.rb
Ruby
mit
230
master
2,015
unified_mode true provides :pmset default_action :run BASE_COMMAND = '/usr/bin/pmset'.freeze property :settings, Hash action :run do new_resource.settings.each do |setting, value| execute BASE_COMMAND do command "#{BASE_COMMAND} #{setting} #{value}" end end end # womp - wake on ethernet magic pac...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/xcode.rb
Ruby
mit
230
master
6,649
include Chef::Mixin::ShellOut include MacOS module MacOS class Xcode attr_reader :version, :intended_path, :download_url def initialize(semantic_version, intended_path, download_url = '') @semantic_version = normalize_version(semantic_version) @intended_path = intended_path @download_url =...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/software_updates.rb
Ruby
mit
230
master
688
module MacOS module SoftwareUpdates def updates_available? no_new_software_pattern = Regexp.union('No new software available.') available_updates_command = shell_out(software_update_command, '--list', '--all') available_updates_command.stderr.chomp.match?(no_new_software_pattern) end de...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/system.rb
Ruby
mit
230
master
1,587
module MacOS module System class FormFactor attr_reader :machine_model def initialize(hardware) @machine_model = hardware.nil? ? nil : hardware['machine_model'] end def desktop? return false if @machine_model.nil? @machine_model.match? Regexp.union ['Macmini', 'Ma...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/xcversion.rb
Ruby
mit
230
master
1,493
include Chef::Mixin::ShellOut module MacOS module XCVersion class << self def xcversion_path Chef::Util::PathHelper.join(Chef::Config.embedded_dir, 'bin', 'xcversion') end def xcversion(command) [xcversion_path, command].join(' ') end def update xcversion '...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/security_cmd.rb
Ruby
mit
230
master
2,249
include Chef::Mixin::ShellOut module MacOS class SecurityCommand attr_reader :cert, :keychain, :security_cmd def initialize(cert: nil, keychain: nil) @cert = cert @keychain = keychain @security_cmd = '/usr/bin/security' end def create_keychain(kc_pass) Chef::Exception.fatal(...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/developer_account.rb
Ruby
mit
230
master
1,138
include Chef::Mixin::ShellOut include MacOS module MacOS class DeveloperAccount attr_reader :credentials def initialize(apple_id_hash, download_url) if download_url.empty? developer_id = validate_apple_id(apple_id_hash) @credentials = { XCODE_INSTALL_USER: developer_id[:usern...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/command_line_tools.rb
Ruby
mit
230
master
2,531
include Chef::Mixin::ShellOut require 'plist' module MacOS class CommandLineTools attr_reader :version def initialize @version = if install_receipts.empty? latest_from_catalog else latest_receipt end end def install_recei...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/metadata_util.rb
Ruby
mit
230
master
769
include Chef::Mixin::ShellOut module MacOS class MetadataUtil attr_reader :status_flags attr_reader :mdutil_output def initialize(volume) mdutil_possible_states = { 'Indexing enabled.' => ['on', ''], 'Indexing disabled.' => ['off', ''], ...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/macos_user.rb
Ruby
mit
230
master
986
module MacOS module MacOSUserHelpers def kcpassword_hash(password) bits = if password.nil? nil_magic_bits else magic_bits end obfuscated = [] padded(password.to_s).each do |char| obfuscated.push(bits[0] ^ char) bits.rotate! ...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/paths.rb
Ruby
mit
230
master
857
module MacOS class UserPath class << self def home(user) SystemPath.directory('Users', user) end def directory(user, *dirs) ::File.join(home(user), dirs) end def library(user) ::File.join(home(user), 'Library') end def preferences(user) ...
github
microsoft/macos-cookbook
https://github.com/microsoft/macos-cookbook
libraries/remote_management.rb
Ruby
mit
230
master
13,301
module MacOS class RemoteManagement class << self def current_mask(users) using_global_privileges? ? Privileges::Value.new(value: global_settings_privilege_value).to_mask : current_user_masks(users).first end def current_user_masks(users) users = all_local_users if users.include...
github
joonty/pessimize
https://github.com/joonty/pessimize
pessimize.gemspec
Ruby
mit
230
master
1,590
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'pessimize/version' Gem::Specification.new do |gem| gem.name = "pessimize" gem.version = Pessimize::VERSION gem.authors = ["Jon Cairns"] gem.email = ...
github
joonty/pessimize
https://github.com/joonty/pessimize
spec/spec_helper.rb
Ruby
mit
230
master
1,509
require 'codeclimate-test-reporter' CodeClimate::TestReporter.start require 'rspec' require 'rspec/its' require 'pessimize' require 'open3' require 'ripper' def data_file(name) File.new(File.dirname(__FILE__) + '/data/' + name) end RSpec.configure do |c| c.filter_run_excluding :exclude_platform => lambda { |platf...
github
joonty/pessimize
https://github.com/joonty/pessimize
spec/integration_spec.rb
Ruby
mit
230
master
11,728
require 'spec_helper' describe "running pessimize" do include IntegrationHelper shared_examples "a working pessimizer" do |gemfile, lockfile, result, cli_args = ""| before do write_gemfile(gemfile) write_gemfile_lock(lockfile) run(cli_args) end context "after execution" do co...
github
joonty/pessimize
https://github.com/joonty/pessimize
spec/version_mapper_spec.rb
Ruby
mit
230
master
2,933
require 'spec_helper' require 'pessimize/version_mapper' require 'pessimize/gem' module Pessimize describe VersionMapper do def gem(name, version = nil) gem_string = %Q{gem "#{name}"} gem_string << %Q{, "#{version}"} if version Gem.new(Ripper.lex(gem_string)) end context "with a gem, v...
github
joonty/pessimize
https://github.com/joonty/pessimize
spec/gemfile_spec.rb
Ruby
mit
230
master
5,241
require 'spec_helper' require 'pessimize/gemfile' module Pessimize describe Gemfile do context "with a single gem definition" do let(:gem_defn) { <<-GEM source "https://rubygems.org" gem "monkey" GEM } subject(:gemfile) { Gemfile.new(gem_defn) } its(:to_s) { should == gem_defn } ...
github
joonty/pessimize
https://github.com/joonty/pessimize
spec/gemfile_lock_version_parser_spec.rb
Ruby
mit
230
master
1,531
require 'spec_helper' require 'pessimize/gemfile_lock_version_parser' module Pessimize describe GemfileLockVersionParser do shared_examples "a gemfile lock parser" do |lock_file, expected_versions| let(:parser) { GemfileLockVersionParser.new } before do parser.call lock_file end ...
github
joonty/pessimize
https://github.com/joonty/pessimize
spec/gem_spec.rb
Ruby
mit
230
master
2,863
require 'spec_helper' require 'pessimize/gem' module Pessimize describe Gem do context "creating a gem with just a name" do let(:gem) { Gem.new(Ripper.lex('gem "monkey"')) } subject { gem } its(:name) { should == "monkey" } its(:version) { should be_nil } its(:to_s) { should == 'ge...
github
joonty/pessimize
https://github.com/joonty/pessimize
lib/pessimize/shell.rb
Ruby
mit
230
master
2,324
require 'pessimize/file_manager' require 'pessimize/pessimizer' require 'optimist' module Pessimize class Shell def initialize self.file_manager = FileManager.new end def run options = cli_options check_options! options verify_files!(options[:backup]) Pessimizer.new(file_ma...
github
joonty/pessimize
https://github.com/joonty/pessimize
lib/pessimize/gemfile_lock_version_parser.rb
Ruby
mit
230
master
569
require 'bundler' module Pessimize class GemfileLockVersionParser attr_reader :versions def initialize self.versions = {} end def call(gemfile_lock_file) parser = Bundler::LockfileParser.new(gemfile_lock_file.read) self.versions = collect_names_and_versions(parser.specs) sel...
github
joonty/pessimize
https://github.com/joonty/pessimize
lib/pessimize/pessimizer.rb
Ruby
mit
230
master
1,153
require 'pessimize/gemfile' require 'pessimize/gemfile_lock_version_parser' require 'pessimize/version_mapper' module Pessimize class Pessimizer def initialize(file_manager, options) self.file_manager = file_manager self.options = options self.lock_parser = GemfileLockVersionParser.new end ...
github
joonty/pessimize
https://github.com/joonty/pessimize
lib/pessimize/gem.rb
Ruby
mit
230
master
1,682
module Pessimize class Gem attr_reader :name, :original_tokens attr_accessor :version def initialize(gem_tokens) self.original_tokens = gem_tokens parse_name parse_version end def tokens compiled_tokens = original_tokens.dup if version_index compiled_tokens[...
github
joonty/pessimize
https://github.com/joonty/pessimize
lib/pessimize/file_manager.rb
Ruby
mit
230
master
589
module Pessimize class FileManager def gemfile 'Gemfile' end def gemfile_lock 'Gemfile.lock' end def gemfile? File.exist? gemfile end def gemfile_contents File.read gemfile end def gemfile_lock? File.exist? gemfile_lock end def backup_gemf...
github
joonty/pessimize
https://github.com/joonty/pessimize
lib/pessimize/gemfile.rb
Ruby
mit
230
master
1,732
require 'ripper' require 'pessimize/gem' module Pessimize class Gemfile attr_reader :gems def initialize(contents) self.tokens = Ripper.lex(contents) self.gems = [] self.gem_token_map = [] parse_gems_from_tokens! end def to_s TokenCompiler.new(tokens)....
github
joonty/pessimize
https://github.com/joonty/pessimize
lib/pessimize/version_mapper.rb
Ruby
mit
230
master
541
module Pessimize class VersionMapper def call(gems, versions, version_constraint) gems.each do |gem| if versions.has_key? gem.name version = versions[gem.name] if !::Gem::Version.new(version).prerelease? version_parts = versions[gem.name].split('.') versio...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
Gemfile
Ruby
mit
230
main
205
source 'https://rubygems.org' # Specify your gem's dependencies in libui.gemspec gemspec gem 'minitest' gem 'rake' gem 'rubyzip' # group :development do # gem 'chunky_png' # gem 'numo-narray' # end
github
kojix2/LibUI
https://github.com/kojix2/LibUI
Rakefile
Ruby
mit
230
main
6,298
# frozen_string_literal: true require 'rake/testtask' require 'rbconfig' require 'fileutils' require 'zip' require 'bundler/gem_tasks' require_relative 'lib/libui/version' # Configuration COMMIT_HASH = ENV['LIBUI_NG_COMMIT_HASH'] || 'd37a4d8' # Path constants BUILD_DIR = 'builddir' MESON_OUT_DIR = "#{BUILD_DIR}/mes...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
libui.gemspec
Ruby
mit
230
main
1,307
require_relative 'lib/libui/version' Gem::Specification.new do |spec| spec.name = 'libui' spec.version = LibUI::VERSION spec.summary = 'Ruby bindings to libui' spec.homepage = 'https://github.com/kojix2/libui' spec.license = 'MIT' spec.authors = ['kojix2'] spec.emai...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/password_entry.rb
Ruby
mit
230
main
2,215
# ============================================================================ # # This example (password_entry.rb) shall demonstrate the following functionality # (6 components), as well as their implementation-status in regards to # this file: # # :new_entry # [DONE] # :entry_on_changed ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/editable_combobox.rb
Ruby
mit
230
main
4,931
# ============================================================================ # # This example (editable_combobox.rb) shall demonstrate the following # functionality (5 components), as well as their implementation-status in # regards to this file: # # :new_editable_combobox # [DONE] # :editable_com...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/progress_bar.rb
Ruby
mit
230
main
1,033
# ============================================================================ # # This example (progress_bar.rb) shall demonstrate the following # functionality (2 components), as well as their implementation-status # in regards to this file: # # :progress_bar_set_value # [DONE] # :progress_bar_value ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/combobox.rb
Ruby
mit
230
main
3,994
# ============================================================================ # # This example (combobox.rb) shall demonstrate the following functionality # (9 components), as well as their implementation-status in regards to # this file: # # :new_combobox [DONE] # :combobox_append ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/slider.rb
Ruby
mit
230
main
2,355
# ============================================================================ # # This example (slider.rb) shall demonstrate the following functionality # (8 components), as well as their implementation-status in regards to # this file: # # :new_slider # [DONE] # :slider_has_tool_ti...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/checkbox.rb
Ruby
mit
230
main
1,665
# ============================================================================ # # This example (checkbox.rb) shall demonstrate the following functionality # (6 components), as well as their implementation-status in regards to # this file: # # :new_checkbox # [DONE] # :checkbox_checked # [DONE...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/button.rb
Ruby
mit
230
main
1,376
# ============================================================================ # # This example (button.rb) shall demonstrate the following functionality # (4 components), as well as their implementation-status in regards to # this file: # # :new_button # [DONE] # :button_on_clicked ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/grid.rb
Ruby
mit
230
main
4,468
# ============================================================================ # # This example (grid.rb) shall demonstrate the following functionality # (8 components), as well as their implementation-status in regards to # this file: # # :new_grid # [DONE] # :grid_append ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/font_button.rb
Ruby
mit
230
main
1,159
# ============================================================================ # # This example (font_button.rb) shall demonstrate the following # functionality (5 components), as well as their implementation-status # in regards to this file: # # :new_font_button # [DONE] # :font_button_font ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/color_button.rb
Ruby
mit
230
main
2,304
# ============================================================================ # # This example (color_button.rb) shall demonstrate the following # functionality (4 components), as well as their implementation-status # in regards to this file: # # :new_color_button # [DONE] # :color_button_color ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/entry.rb
Ruby
mit
230
main
1,903
# ============================================================================ # # This example (entry.rb) shall demonstrate the following functionality # (6 components), as well as their implementation-status in regards to # this file: # # :new_entry # [DONE] # :entry_on_changed # [DON...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/multiline_entry.rb
Ruby
mit
230
main
1,655
# ============================================================================ # # This example (multiline_entry.rb) shall demonstrate the following functionality # (6 components), as well as their implementation-status in regards to # this file: # # :multiline_entry_append # [DONE] # :multiline_entry_on_cha...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/window.rb
Ruby
mit
230
main
5,146
# ============================================================================ # # This example (window.rb) shall demonstrate the following functionality # (18 components), as well as their implementation-status in regards to # this file: # # :new_window # [DONE] # :window_borderless...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/date_picker.rb
Ruby
mit
230
main
1,649
# ============================================================================ # # === DatePicker - a widget to allow the user to enter a date # # This example (date_picker.rb) shall demonstrate the following functionality # (3 components), as well as their implementation-status in regards to # this file: # # :new_da...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples2/search_entry.rb
Ruby
mit
230
main
2,305
# ============================================================================ # # This example (search_entry.rb) shall demonstrate the following functionality # (6 components), as well as their implementation-status in regards to # this file: # # :new_entry # [DONE] # :entry_on_changed ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
lib/libui.rb
Ruby
mit
230
main
7,124
require_relative 'libui/version' require_relative 'libui/utils' require_relative 'libui/error' require 'rbconfig' module LibUI class << self attr_accessor :ffi_lib end host_cpu = case RbConfig::CONFIG['host_cpu'] when /i\d86/ 'x86' else RbConfig::CONFI...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
lib/libui/ffi.rb
Ruby
mit
230
main
29,529
require 'fiddle/import' require_relative 'fiddle_patch' require_relative 'error' module LibUI module FFI extend Fiddle::Importer extend FiddlePatch if LibUI.ffi_lib.nil? raise LibraryNotFoundError, 'Could not find libui shared library. LibUI.ffi_lib is nil.' elsif !File.exist?(LibUI.ffi_lib) ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
lib/libui/libui_base.rb
Ruby
mit
230
main
1,950
module LibUI module LibUIBase FFI.func_map.each_key do |original_method_name| name = Utils.convert_to_ruby_method(original_method_name) func = FFI.func_map[original_method_name] define_method(name) do |*args, &blk| # Assume that block is the last argument. args << blk if blk ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
lib/libui/fiddle_patch.rb
Ruby
mit
230
main
3,621
module LibUI # This module overrides Fiddle's mtehods # - Fiddle::Importer#extern # - Fiddle::CParser#parse_signature # Original methods are in # - https://github.com/ruby/fiddle/blob/master/lib/fiddle/import.rb # - https://github.com/ruby/fiddle/blob/master/lib/fiddle/cparser.rb # These changes add the a...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
lib/libui/utils.rb
Ruby
mit
230
main
589
module LibUI module Utils class << self def convert_to_ruby_method(original_method_name) underscore(original_method_name.delete_prefix('ui')) end # Converting camel case to underscore case in ruby # https://stackoverflow.com/questions/1509915/converting-camel-case-to-underscore-ca...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
lib/libui/error.rb
Ruby
mit
230
main
232
module LibUI # base error class class Error < StandardError; end # LibUI shared library not found error class LibraryNotFoundError < Error; end # LibUI shared library load error class LibraryLoadError < Error; end end
github
kojix2/LibUI
https://github.com/kojix2/LibUI
scripts/ui_ffi.rb
Ruby
mit
230
main
636
#!/usr/bin/env ruby libui_ffi_path = File.expand_path('../lib/libui/ffi.rb', __dir__) libui_path = File.expand_path('../lib/libui.rb', __dir__) # Read the files into arrays by each line ffi_lines = File.readlines(libui_ffi_path).map(&:strip) libui_lines = File.readlines(libui_path) # Count try_extern matches = ffi_l...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
scripts/ui_h.rb
Ruby
mit
230
main
1,023
#!/usr/bin/env ruby require 'open-uri' require 'tempfile' UI_H_URL = 'https://raw.githubusercontent.com/libui-ng/libui-ng/master/ui.h'.freeze ui_h = [] Tempfile.open(['ui', '.h']) do |tf| tf.write URI.open(UI_H_URL).read tf.close cmd_gcc = 'gcc -fpreprocessed -P -dD -E' ui_h = `#{cmd_gcc} #{tf.path}` # Rem...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/basic_window.rb
Ruby
mit
230
main
216
require 'libui' UI = LibUI UI.init main_window = UI.new_window('hello world', 300, 200, 1) UI.control_show(main_window) UI.window_on_closing(main_window) do puts 'Bye Bye' UI.quit 1 end UI.main UI.uninit
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/basic_table_image.rb
Ruby
mit
230
main
2,124
# NOTE: # This example displays images that can be freely downloaded from the Studio Ghibli website. # https://www.ghibli.jp/works/red-turtle/ # "Please feel free to use them within the scope of common sense." Toshio Suzuki (producer) require 'libui' require 'chunky_png' require 'open-uri' UI = LibUI UI.init main_w...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/basic_entry.rb
Ruby
mit
230
main
619
require 'libui' UI = LibUI UI.init main_window = UI.new_window('Basic Entry', 300, 50, 1) UI.window_on_closing(main_window) do puts 'Bye Bye' UI.quit 1 end hbox = UI.new_horizontal_box UI.window_set_child(main_window, hbox) entry = UI.new_entry UI.entry_on_changed(entry) do puts UI.entry_text(entry).to_s ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/date_time_picker.rb
Ruby
mit
230
main
755
require 'libui' UI = LibUI UI.init vbox = UI.new_vertical_box date_time_picker = UI.new_date_time_picker time = UI::FFI::TM.malloc time.to_ptr.free = Fiddle::RUBY_FREE UI.date_time_picker_on_changed(date_time_picker) do UI.date_time_picker_time(date_time_picker, time) p sec: time.tm_sec, min: time.tm_min,...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/histogram.rb
Ruby
mit
230
main
5,870
# https://github.com/jamescook/libui-ruby/blob/master/example/histogram.rb require 'libui' UI = LibUI X_OFF_LEFT = 20 Y_OFF_TOP = 20 X_OFF_RIGHT = 20 Y_OFF_BOTTOM = 20 POINT_RADIUS = 5 init = UI.init handler = UI::FFI::AreaHandler.malloc handler.to_ptr.free = Fiddle::RUBY_FREE histogram = UI.n...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/basic_area.rb
Ruby
mit
230
main
1,276
require 'libui' UI = LibUI UI.init handler = UI::FFI::AreaHandler.malloc handler.to_ptr.free = Fiddle::RUBY_FREE area = UI.new_area(handler) brush = UI::FFI::DrawBrush.malloc brush.to_ptr.free = Fiddle::RUBY_FREE handler_draw_event = Fiddle::Closure::BlockCaller.new(0, [1, 1, 1]) do |_, _, area_draw_params| ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/control_gallery.rb
Ruby
mit
230
main
5,300
require 'libui' UI = LibUI UI.init # File menu menu = UI.new_menu('File') open_menu_item = UI.menu_append_item(menu, 'Open') UI.menu_item_on_clicked(open_menu_item) do pt = UI.open_file(MAIN_WINDOW) puts pt unless pt.null? end save_menu_item = UI.menu_append_item(menu, 'Save') UI.menu_item_on_clicked(save_menu_it...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/spectrum.rb
Ruby
mit
230
main
2,884
#!/usr/bin/env ruby # Please play your favorite music or video on your computer # when running this spectrum example. require 'libui' require 'ffi-portaudio' # https://github.com/nanki/ffi-portaudio require 'numo/pocketfft' # https://github.com/yoshoku/numo-pocketfft # ----------------------------------------------...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/basic_draw_text.rb
Ruby
mit
230
main
3,568
require 'libui' UI = LibUI UI.init handler = UI::FFI::AreaHandler.malloc handler.to_ptr.free = Fiddle::RUBY_FREE area = UI.new_area(handler) # Michael Ende (1929-1995) # The Neverending Story is a fantasy novel by German writer Michael Ende, # The English version, translated by Ralph Manheim, was published in 19...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/midi_player.rb
Ruby
mit
230
main
2,815
#!/usr/bin/env ruby require 'libui' UI = LibUI class TinyMidiPlayer VERSION = '0.0.1' def initialize UI.init @pid = nil @music_directory = File.expand_path(ARGV[0] || '~/Music/') @midi_files = Dir.glob(File.join(@music_directory, '**/*.mid')) .sort_by { |path| File....
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/basic_button.rb
Ruby
mit
230
main
395
require 'libui' UI = LibUI UI.init main_window = UI.new_window('hello world', 300, 200, 1) button = UI.new_button('Button') UI.button_on_clicked(button) do UI.msg_box(main_window, 'Information', 'You clicked the button') end UI.window_on_closing(main_window) do puts 'Bye Bye' UI.quit 1 end UI.window_set_...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/gpt2_notepad.rb
Ruby
mit
230
main
2,442
#!/usr/bin/env ruby # frozen_string_literal: true require 'libui' require 'onnxruntime' require 'blingfire' require 'numo/narray' # GPT-2 model # Transformer-based language model for text generation. # https://github.com/onnx/models/tree/main/text/machine_comprehension/gpt-2 Dir.chdir(__dir__) do %w[ https://g...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/draw_text.rb
Ruby
mit
230
main
6,060
require 'libui' UI = LibUI def append_with_attribute(attr_str, what, attr1, attr2) start_pos = UI.attributed_string_len(attr_str) end_pos = start_pos + what.length UI.attributed_string_append_unattributed(attr_str, what) UI.attributed_string_set_attribute(attr_str, attr1, start_pos, end_pos) UI.attributed_s...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/turing_pattern.rb
Ruby
mit
230
main
15,158
#!/usr/bin/env ruby # https://en.wikipedia.org/wiki/Turing_pattern # # > The Turing pattern is a concept introduced by English mathematician Alan Turing # in a 1952 paper titled "The Chemical Basis of Morphogenesis" which describes # how patterns in nature, such as stripes and spots, can arise naturally and # autonomo...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/simple_notepad.rb
Ruby
mit
230
main
373
#!/usr/bin/env ruby require 'libui' UI = LibUI UI.init main_window = UI.new_window('Notepad', 500, 300, 1) UI.window_on_closing(main_window) do puts 'Bye Bye' UI.quit 1 end vbox = UI.new_vertical_box UI.window_set_child(main_window, vbox) entry = UI.new_non_wrapping_multiline_entry UI.box_append(vbox, entry...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/basic_table.rb
Ruby
mit
230
main
1,517
require 'libui' UI = LibUI UI.init main_window = UI.new_window('Animal sounds', 300, 200, 1) hbox = UI.new_horizontal_box UI.window_set_child(main_window, hbox) data = [ %w[cat meow], %w[dog woof], %w[chicken cock-a-doodle-doo], %w[horse neigh], %w[cow moo] ] # Protects BlockCaller objects from garbage ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
examples/font_button.rb
Ruby
mit
230
main
673
require 'libui' UI = LibUI UI.init main_window = UI.new_window('hello world', 300, 200, 1) font_button = UI.new_font_button font_descriptor = UI::FFI::FontDescriptor.malloc font_descriptor.to_ptr.free = Fiddle::RUBY_FREE UI.font_button_on_changed(font_button) do UI.font_button_font(font_button, font_descriptor) ...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
test/libui_test.rb
Ruby
mit
230
main
830
require 'test_helper' class LibUITest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::LibUI::VERSION end def test_ffi_method_call pt = LibUI::FFI::InitOptions.malloc pt.to_ptr.free = Fiddle::RUBY_FREE assert_kind_of Fiddle::Pointer, LibUI::FFI.uiInit(pt) assert_nil LibUI:...
github
kojix2/LibUI
https://github.com/kojix2/LibUI
test/utils_test.rb
Ruby
mit
230
main
441
require 'test_helper' class LibUIUtilsTest < Minitest::Test def test_convert_to_ruby_method rbmethod1 = LibUI::Utils.convert_to_ruby_method('uiNewMatz') rbmethod2 = LibUI::Utils.convert_to_ruby_method('AINewMatz') assert_equal 'new_matz', rbmethod1 assert_equal 'ai_new_matz', rbmethod2 end def t...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
Rakefile
Ruby
mit
230
master
3,117
require 'rubygems' require 'bundler' begin Bundler.setup(:default, :development) rescue Bundler::BundlerError => e $stderr.puts e.message $stderr.puts "Run `bundle install` to install missing gems" exit e.status_code end require 'rake' begin jeweler_required = require 'jeweler' rescue Exception jeweler_req...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
Gemfile
Ruby
mit
230
master
819
source 'http://rubygems.org' gem 'glimmer', '~> 2.8.2' #, path: '../glimmer' gem 'glimmer-dsl-xml', '~> 1.4.0' gem 'glimmer-dsl-css', '~> 1.5.2' gem 'opal', '1.8.2' gem 'opal-rails', '>= 2.0.4', '< 4.0.0' gem 'opal-async', '~> 1.4.1' gem 'opal-jquery', '~> 0.5.2' gem 'to_collection', '>= 2.0.1', '< 3.0.0' group :deve...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
glimmer-dsl-web.gemspec
Ruby
mit
230
master
8,378
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- # stub: glimmer-dsl-web 0.9.0 ruby lib Gem::Specification.new do |s| s.name = "glimmer-dsl-web".freeze s.version = "0.9.0".freeze s.required_rubygems_version = Gem...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
config.ru
Ruby
mit
230
master
546
require 'opal/rspec' require 'opal-async' require 'opal-jquery' Opal.use_gem 'glimmer-dsl-web' # or use Opal::RSpec::SprocketsEnvironment.new(spec_pattern='spec-opal/**/*_spec.{rb,opal}') to customize the pattern sprockets_env = Opal::RSpec::SprocketsEnvironment.new run Opal::Server.new(sprockets: sprockets_env) { |s...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/spec_helper.rb
Ruby
mit
230
master
897
ENV['RUBY_ENV'] = 'test' RSpec.configure do |config| # Run specs in random order to surface order dependencies. If you find an # order dependency and want to debug it, you can fix the order by providing # the seed, which is printed after each run. # --seed 1234 config.order = :random # Seed global ran...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/shell_spec.rb
Ruby
mit
230
master
2,079
require 'spec_helper' module GlimmerSpec RSpec.describe 'shell keyword' do include Glimmer let(:title) {'Hello, World!'} it 'renders empty shell with title and CSS shell-style div' do Document.ready? do @target = shell { text title } @target.open ...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/tab_spec.rb
Ruby
mit
230
master
4,585
require 'spec_helper' module GlimmerSpec RSpec.describe 'tab' do include Glimmer it 'renders tabs with first one selected by default' do Document.ready? do @target = shell { @tab_folder = tab_folder { @tab_item1 = tab_item { text "English" ...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/message_box_spec.rb
Ruby
mit
230
master
573
require 'spec_helper' module GlimmerSpec RSpec.describe 'message_box keyword' do include Glimmer let(:title) {'Hello, World!'} let(:message) {'Welcome to Glimmer DSL for Opal!'} it 'renders empty shell with title and CSS shell-style div' do Document.ready? do @target = shel...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/combo_spec.rb
Ruby
mit
230
master
3,071
# require 'spec_helper' # # module GlimmerSpec # RSpec.describe 'combo keyword' do # include Glimmer # # it 'renders shell with composite containing combo (read only)' do # Document.ready? do # @target = shell { # @composite = composite { # @combo = combo(:read_only) ...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/text_spec.rb
Ruby
mit
230
master
1,890
require 'spec_helper' module GlimmerSpec RSpec.describe 'text keyword' do include Glimmer let(:title) {'Hello, World!'} it 'renders text widget' do Document.ready? do @target = shell { @text = text { text title } } @target.ope...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/list_spec.rb
Ruby
mit
230
master
2,805
require 'spec_helper' module GlimmerSpec RSpec.describe 'list keyword' do include Glimmer it 'renders and binds list widget for single selection' do person = Person.new Document.ready? do @target = shell { @list = list { selection bind(person, :country) ...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/table_spec.rb
Ruby
mit
230
master
4,165
require 'spec_helper' module GlimmerSpec RSpec.describe 'table' do include Glimmer it 'renders and binds table widget with support for editing' do contact_manager_presenter = ContactManager::ContactManagerPresenter.new contact_manager_presenter.list Document.ready? do @target =...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/composite_spec.rb
Ruby
mit
230
master
580
require 'spec_helper' module GlimmerSpec RSpec.describe 'composite keyword' do include Glimmer it 'renders shell with composite containing combo (read only)' do Document.ready? do @target = shell { @composite = composite { } } @target.open ...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/label_spec.rb
Ruby
mit
230
master
628
require 'spec_helper' module GlimmerSpec RSpec.describe 'label keyword' do include Glimmer let(:title) {'Hello, World!'} it 'renders shell with label content' do Document.ready? do @target = shell { @label = label { text title } } ...
github
AndyObtiva/glimmer-dsl-web
https://github.com/AndyObtiva/glimmer-dsl-web
spec-opal/lib/glimmer/dsl/opal/browser_spec.rb
Ruby
mit
230
master
637
require 'spec_helper' module GlimmerSpec RSpec.describe 'browser keyword' do include Glimmer it 'renders browser widget' do Document.ready? do @target = shell { @browser = browser { url 'http://brightonresort.com/about' } } @target.open ...