libui 0.1.3.pre-x86_64-linux → 0.2.0.pre-x86_64-linux
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 +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +27 -3
- data/lib/libui/error.rb +10 -0
- data/lib/libui/ffi.rb +15 -4
- data/lib/libui/version.rb +1 -1
- data/lib/libui.rb +12 -2
- data/vendor/libui.x86_64.so +0 -0
- metadata +21 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e2f1063859dcd312d95a5a8323b887b39034adb9cc26043f07250c035c1f183a
         | 
| 4 | 
            +
              data.tar.gz: c7b2a52f517cc31074f847289e9115d6e25aa5d42a7659080c2cc71e9fdc523e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c71a46bbd71bc27335fca0eee6665ac33381f420ac814487b6ddfa7bbac17f22a4d495db70507a8f55f50229600f430a239b60b31d4fc4850cb5f0f9a393eafd
         | 
| 7 | 
            +
              data.tar.gz: c9d03fd78a230349e7694add8c2054186ab2289215781380fa4e1ded2abe2fa2d9d9343a5247f699ef55e2a3907b33fa42762d2f9c623b25c44cab01b7d4d9ef
         | 
    
        data/LICENSE.txt
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -4,21 +4,32 @@ | |
| 4 4 | 
             
            [](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 | 
             
            [](https://github.com/kojix2/libui-ng/actions/workflows/pre-build.yml)
         | 
| 7 | 
            +
            [](https://tokei.kojix2.net/github/kojix2/LibUI)
         | 
| 7 8 |  | 
| 8 | 
            -
            LibUI is a Ruby wrapper for libui  | 
| 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  | 
| 21 | 
            -
              - Namely `libui.dll`, `libui.dylib`,  | 
| 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
         | 
    
        data/lib/libui/error.rb
    ADDED
    
    
    
        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 | 
            -
                 | 
| 10 | 
            -
                   | 
| 11 | 
            -
                 | 
| 12 | 
            -
                  raise  | 
| 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
    
    
    
        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 |  | 
    
        data/vendor/libui.x86_64.so
    CHANGED
    
    | Binary file | 
    
        metadata
    CHANGED
    
    | @@ -1,15 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: libui
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0.pre
         | 
| 5 5 | 
             
            platform: x86_64-linux
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - kojix2
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 12 | 
            -
            dependencies: | 
| 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'
         | 
| 13 27 | 
             
            description:
         | 
| 14 28 | 
             
            email:
         | 
| 15 29 | 
             
            - 2xijok@gmail.com
         | 
| @@ -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
         | 
| @@ -43,11 +58,11 @@ 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:  | 
| 63 | 
            +
                  version: '0'
         | 
| 49 64 | 
             
            requirements: []
         | 
| 50 | 
            -
            rubygems_version: 3. | 
| 65 | 
            +
            rubygems_version: 3.5.22
         | 
| 51 66 | 
             
            signing_key:
         | 
| 52 67 | 
             
            specification_version: 4
         | 
| 53 68 | 
             
            summary: Ruby bindings to libui
         |