libui 0.1.3.pre-x86_64-darwin → 0.2.0.pre-x86_64-darwin

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6a349bb223eda3eecb772bf46d1d98085e4bcc0a8dc4decd5deedbfb898bde8
4
- data.tar.gz: 57e565d3989a659066e1565b7522dd108ac160fb19d7938c004f97e060ea3def
3
+ metadata.gz: 4f93f77a77f68890634f59988823870d3f80baac5820856ac551dac128c47228
4
+ data.tar.gz: 0aa9e66cbf90e9a5c3cfb1d86f11e82200f82eac2c9e88d21b2aeb1ad60d3275
5
5
  SHA512:
6
- metadata.gz: fdef3e3c972f1e369f1636abdd5ba19281145fc5ef17bca0b1fc5308190b388d636ec67f73978671e3ce43f853813d842693d0ff719e64cbbe6ca52a65d87b26
7
- data.tar.gz: 3b1071796e70357282109896c91bad0e448f547a91f0ca9e9f1c318a31cafa71d8c9e8ce44fd8f7e9daa6e997c9dfc648fb087548a0b3061be5aa122128fa7c8
6
+ metadata.gz: abcecf91a66544d8d5365eb98c72b89b5fb8a638dbf7940f4a1fa5232c04b0d37c445ce49994bbec583926e63d6b008d9c519e4ca6f6ca5d390b8a24960bb972
7
+ data.tar.gz: 1b22d167e1a2b692f5634390856274a9171b129ea1b8509cf381ea5f75ce06ecc3ade77808135bd78fb13637f7a327a3d2a8d386e1b85171313f0c09569f568e
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2020 kojix2
3
+ Copyright (c) 2020-2025 kojix2
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -4,21 +4,32 @@
4
4
  [![Gem Version](https://badge.fury.io/rb/libui.svg)](https://badge.fury.io/rb/libui)
5
5
  <a href="https://github.com/AndyObtiva/glimmer-dsl-libui"><img alt="glimmer-dsl-libui" src="https://github.com/AndyObtiva/glimmer/blob/master/images/glimmer-logo-hi-res.svg" width="50" height="50" align="right"></a>
6
6
  [![Pre-build](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml/badge.svg?branch=pre-build)](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml)
7
+ [![Lines of Code](https://img.shields.io/endpoint?url=https%3A%2F%2Ftokei.kojix2.net%2Fbadge%2Fgithub%2Fkojix2%2FLibUI%2Flines)](https://tokei.kojix2.net/github/kojix2/LibUI)
7
8
 
8
- LibUI is a Ruby wrapper for libui and libui-ng.
9
+ LibUI is a Ruby wrapper for libui family.
9
10
 
10
11
  :rocket: [libui-ng](https://github.com/libui-ng/libui-ng) - A cross-platform portable GUI library
11
12
 
13
+ :wrench: [libui-dev](https://github.com/petabyt/libui-dev) - Native UI library for C - with some extras
14
+
12
15
  :radio_button: [libui](https://github.com/andlabs/libui) - Original version by andlabs.
13
16
 
14
17
  ## Installation
15
18
 
19
+ It is recommended to use libui-ng, via the --pre commandline flag:
20
+
21
+ ```sh
22
+ gem install libui --pre # libui-ng; this will fetch libui-0.1.3.pre-x86_64-linux.gem
23
+ ```
24
+
25
+ If for some reason you would like to install the slightly older libui-0.1.2.gem release, issue:
26
+
16
27
  ```sh
17
28
  gem install libui
18
29
  ```
19
30
 
20
- - The gem package includes the [official release](https://github.com/andlabs/libui/releases/tag/alpha4.1) of the libui shared library version 4.1 for Windows, Mac, and Linux.
21
- - Namely `libui.dll`, `libui.dylib`, and `libui.so` (only 1.8MB in total).
31
+ - The gem package includes the libui-ng shared library for Windows, Mac, and Linux.
32
+ - Namely `libui.dll`, `libui.dylib`, or `libui.so`.
22
33
  - No dependencies required.
23
34
  - The libui gem uses the standard Ruby library [Fiddle](https://github.com/ruby/fiddle) to call C functions.
24
35
 
@@ -204,6 +215,19 @@ Another simple approach is to replace the shared libraries in the gem vendor dir
204
215
 
205
216
  ### Publishing gems
206
217
 
218
+ #### Automated Publishing
219
+
220
+ Push a version tag to automatically publish platform-specific gems:
221
+
222
+ ```sh
223
+ git tag v0.1.3
224
+ git push origin v0.1.3
225
+ ```
226
+
227
+ Requires `RUBYGEMS_API_KEY` repository secret with scoped API key.
228
+
229
+ #### Manual Publishing
230
+
207
231
  ```sh
208
232
  ls vendor # check the vendor directory
209
233
  rm -rf pkg # remove previously built gems
@@ -0,0 +1,10 @@
1
+ module LibUI
2
+ # base error class
3
+ class Error < StandardError; end
4
+
5
+ # LibUI shared library not found error
6
+ class LibraryNotFoundError < Error; end
7
+
8
+ # LibUI shared library load error
9
+ class LibraryLoadError < Error; end
10
+ end
data/lib/libui/ffi.rb CHANGED
@@ -1,15 +1,24 @@
1
1
  require 'fiddle/import'
2
2
  require_relative 'fiddle_patch'
3
+ require_relative 'error'
3
4
 
4
5
  module LibUI
6
+ class Error < StandardError; end
7
+
5
8
  module FFI
6
9
  extend Fiddle::Importer
7
10
  extend FiddlePatch
8
11
 
9
- begin
10
- dlload LibUI.ffi_lib
11
- rescue LoadError
12
- raise LoadError, 'Could not find libui shared library'
12
+ if LibUI.ffi_lib.nil?
13
+ raise LibraryNotFoundError, 'Could not find libui shared library. LibUI.ffi_lib is nil.'
14
+ elsif !File.exist?(LibUI.ffi_lib)
15
+ raise LibraryNotFoundError, "Could not find libui shared library: #{LibUI.ffi_lib}"
16
+ else
17
+ begin
18
+ dlload LibUI.ffi_lib
19
+ rescue LoadError
20
+ raise LibraryLoadError, "Could not load libui shared library: #{LibUI.ffi_lib}"
21
+ end
13
22
  end
14
23
 
15
24
  class << self
@@ -18,6 +27,8 @@ module LibUI
18
27
  def try_extern(signature, *opts)
19
28
  extern(signature, *opts)
20
29
  rescue StandardError => e
30
+ # Do not raise error when the function is not found
31
+ # because some functions may not be available on older versions of libui.
21
32
  warn "#{e.class.name}: #{e.message}"
22
33
  end
23
34
 
data/lib/libui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module LibUI
2
- VERSION = '0.1.3.pre'
2
+ VERSION = '0.2.0.pre'
3
3
  end
data/lib/libui.rb CHANGED
@@ -1,16 +1,26 @@
1
1
  require_relative 'libui/version'
2
2
  require_relative 'libui/utils'
3
+ require_relative 'libui/error'
3
4
  require 'rbconfig'
4
5
 
5
6
  module LibUI
6
- class Error < StandardError; end
7
-
8
7
  class << self
9
8
  attr_accessor :ffi_lib
10
9
  end
11
10
 
11
+ host_cpu = case RbConfig::CONFIG['host_cpu']
12
+ when /i\d86/
13
+ 'x86'
14
+ else
15
+ RbConfig::CONFIG['host_cpu']
16
+ end
17
+
12
18
  lib_name = [
19
+ # For libui-ng shared libraries compiled with (rake vendor:build)
13
20
  "libui.#{RbConfig::CONFIG['host_cpu']}.#{RbConfig::CONFIG['SOEXT']}",
21
+ # For libui-ng shared library downloaded from RubyGems.org
22
+ "libui.#{host_cpu}.#{RbConfig::CONFIG['SOEXT']}",
23
+ # For backward compatibility or manual compilation of libui-ng
14
24
  "libui.#{RbConfig::CONFIG['SOEXT']}"
15
25
  ]
16
26
 
Binary file
metadata CHANGED
@@ -1,16 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3.pre
4
+ version: 0.2.0.pre
5
5
  platform: x86_64-darwin
6
6
  authors:
7
7
  - kojix2
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-09 00:00:00.000000000 Z
12
- dependencies: []
13
- description:
11
+ date: 2025-08-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fiddle
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
14
28
  email:
15
29
  - 2xijok@gmail.com
16
30
  executables: []
@@ -20,6 +34,7 @@ files:
20
34
  - LICENSE.txt
21
35
  - README.md
22
36
  - lib/libui.rb
37
+ - lib/libui/error.rb
23
38
  - lib/libui/ffi.rb
24
39
  - lib/libui/fiddle_patch.rb
25
40
  - lib/libui/libui_base.rb
@@ -32,7 +47,7 @@ homepage: https://github.com/kojix2/libui
32
47
  licenses:
33
48
  - MIT
34
49
  metadata: {}
35
- post_install_message:
50
+ post_install_message:
36
51
  rdoc_options: []
37
52
  require_paths:
38
53
  - lib
@@ -43,12 +58,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
58
  version: '2.6'
44
59
  required_rubygems_version: !ruby/object:Gem::Requirement
45
60
  requirements:
46
- - - ">"
61
+ - - ">="
47
62
  - !ruby/object:Gem::Version
48
- version: 1.3.1
63
+ version: '0'
49
64
  requirements: []
50
- rubygems_version: 3.4.20
51
- signing_key:
65
+ rubygems_version: 3.5.22
66
+ signing_key:
52
67
  specification_version: 4
53
68
  summary: Ruby bindings to libui
54
69
  test_files: []