teek 0.1.4 → 0.1.5
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/Gemfile +2 -0
- data/README.md +26 -0
- data/Rakefile +21 -91
- data/ext/teek/extconf.rb +15 -0
- data/lib/teek/version.rb +1 -1
- data/teek.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7fdcad5500b3501e3d2b83d29678b76f8cc043b2f44e5e0af66a300fd8fa03ac
|
|
4
|
+
data.tar.gz: ca0b209ebe033d7e246271bda5491c8192279e063fdb5e45f2bb719fcd0cb5dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d69b03be50a1ad912ba7f8f0610ae7ba6163b19bc342a9f763112a467ddef39f2b8d0e5e2317463c91096d02674f6641d345370c35c09b71f37055d40ceab926
|
|
7
|
+
data.tar.gz: b720547bd7a11f6a3f7c15ec33c78d2c86c42e80ea9b273dd50803e5d2012c6dd286ae2ebd30275ca9b85eaa26866da00df8d0982a21cde97361d8fa98a1df10
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -242,3 +242,29 @@ task.stop # Stop completely
|
|
|
242
242
|
The work block runs in a background Ractor and cannot access Tk directly. Use `t.yield()` to send results to `on_progress`, which runs on the main thread where Tk is available. Callbacks (`on_progress`, `on_done`) can be chained in any order.
|
|
243
243
|
|
|
244
244
|
See [`sample/threading_demo.rb`](sample/threading_demo.rb) for a complete file hasher example.
|
|
245
|
+
|
|
246
|
+
## File Drop Target
|
|
247
|
+
|
|
248
|
+
Register any widget as a file drop target to receive OS-native drag-and-drop:
|
|
249
|
+
|
|
250
|
+
```ruby
|
|
251
|
+
app = Teek::App.new(title: "Drop Demo")
|
|
252
|
+
app.show
|
|
253
|
+
|
|
254
|
+
app.register_drop_target('.')
|
|
255
|
+
|
|
256
|
+
app.bind('.', '<<DropFile>>', :data) do |data|
|
|
257
|
+
paths = app.split_list(data)
|
|
258
|
+
puts "Dropped: #{paths.inspect}"
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
app.mainloop
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
Dropped files arrive as a Tcl list in the `:data` substitution. Use `split_list` to get a Ruby array of paths. Works on macOS (Cocoa), Windows (OLE IDropTarget), and Linux (X11 XDND).
|
|
265
|
+
|
|
266
|
+
See [`sample/drop_demo.rb`](sample/drop_demo.rb) for a complete example.
|
|
267
|
+
|
|
268
|
+
## Known Issues
|
|
269
|
+
|
|
270
|
+
- **File drop on Linux/Wayland** — `register_drop_target` does not yet work under Wayland. The current implementation uses the X11 XDND protocol, which is not compatible with Wayland's native drag-and-drop. Workaround: select an Xorg/X11 session at the login screen (e.g., "GNOME on Xorg"). Native Wayland support via `wl_data_device` is planned.
|
data/Rakefile
CHANGED
|
@@ -2,9 +2,8 @@ require "bundler/gem_tasks"
|
|
|
2
2
|
require 'rake/testtask'
|
|
3
3
|
require 'rake/clean'
|
|
4
4
|
|
|
5
|
-
# Sub-project Rakefiles (define sdl2:compile
|
|
5
|
+
# Sub-project Rakefiles (define sdl2:compile)
|
|
6
6
|
import 'teek-sdl2/Rakefile'
|
|
7
|
-
import 'teek-mgba/Rakefile'
|
|
8
7
|
|
|
9
8
|
# Documentation tasks - all doc gems are in docs_site/Gemfile
|
|
10
9
|
namespace :docs do
|
|
@@ -112,7 +111,6 @@ task yard: 'docs:yard'
|
|
|
112
111
|
CLEAN.include('ext/teek/config_list')
|
|
113
112
|
CLOBBER.include('tmp', 'lib/*.bundle', 'lib/*.so', 'ext/**/*.o', 'ext/**/*.bundle', 'ext/**/*.bundle.dSYM')
|
|
114
113
|
CLOBBER.include('teek-sdl2/lib/*.bundle', 'teek-sdl2/lib/*.so', 'teek-sdl2/ext/**/*.o', 'teek-sdl2/ext/**/*.bundle')
|
|
115
|
-
CLOBBER.include('teek-mgba/lib/*.bundle', 'teek-mgba/lib/*.so', 'teek-mgba/ext/**/*.o', 'teek-mgba/ext/**/*.bundle')
|
|
116
114
|
|
|
117
115
|
# Clean coverage artifacts before test runs to prevent accumulation
|
|
118
116
|
CLEAN.include('coverage/.resultset.json', 'coverage/results')
|
|
@@ -219,84 +217,45 @@ namespace :sdl2 do
|
|
|
219
217
|
task test: 'sdl2:compile'
|
|
220
218
|
end
|
|
221
219
|
|
|
222
|
-
namespace :mgba do
|
|
223
|
-
Rake::TestTask.new(:test) do |t|
|
|
224
|
-
t.libs << 'teek-mgba/test' << 'teek-mgba/lib' << 'teek-sdl2/lib'
|
|
225
|
-
t.test_files = FileList['teek-mgba/test/**/test_*.rb'] - FileList['teek-mgba/test/test_helper.rb']
|
|
226
|
-
t.ruby_opts << '-r test_helper'
|
|
227
|
-
t.verbose = true
|
|
228
|
-
end
|
|
229
|
-
task test: ['mgba:compile', 'sdl2:compile']
|
|
230
|
-
|
|
231
|
-
desc "Download and build libmgba from source (for macOS / platforms without libmgba-dev)"
|
|
232
|
-
task :deps do
|
|
233
|
-
require 'fileutils'
|
|
234
|
-
require 'etc'
|
|
235
|
-
|
|
236
|
-
vendor_dir = File.expand_path('teek-mgba/vendor')
|
|
237
|
-
mgba_src = File.join(vendor_dir, 'mgba')
|
|
238
|
-
build_dir = File.join(vendor_dir, 'build')
|
|
239
|
-
install_dir = File.join(vendor_dir, 'install')
|
|
240
|
-
|
|
241
|
-
unless File.directory?(mgba_src)
|
|
242
|
-
FileUtils.mkdir_p(vendor_dir)
|
|
243
|
-
sh "git clone --depth 1 --branch 0.10.3 https://github.com/mgba-emu/mgba.git #{mgba_src}"
|
|
244
|
-
end
|
|
245
|
-
|
|
246
|
-
FileUtils.mkdir_p(build_dir)
|
|
247
|
-
cmake_flags = %W[
|
|
248
|
-
-DBUILD_SHARED=OFF
|
|
249
|
-
-DBUILD_STATIC=ON
|
|
250
|
-
-DBUILD_QT=OFF
|
|
251
|
-
-DBUILD_SDL=OFF
|
|
252
|
-
-DBUILD_GL=OFF
|
|
253
|
-
-DBUILD_GLES2=OFF
|
|
254
|
-
-DBUILD_GLES3=OFF
|
|
255
|
-
-DBUILD_LIBRETRO=OFF
|
|
256
|
-
-DSKIP_FRONTEND=ON
|
|
257
|
-
-DUSE_SQLITE3=OFF
|
|
258
|
-
-DUSE_ELF=OFF
|
|
259
|
-
-DUSE_LZMA=OFF
|
|
260
|
-
-DUSE_EDITLINE=OFF
|
|
261
|
-
-DCMAKE_INSTALL_PREFIX=#{install_dir}
|
|
262
|
-
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
|
263
|
-
].join(' ')
|
|
264
|
-
|
|
265
|
-
sh "cmake -S #{mgba_src} -B #{build_dir} #{cmake_flags}"
|
|
266
|
-
sh "cmake --build #{build_dir} -j #{Etc.nprocessors}"
|
|
267
|
-
sh "cmake --install #{build_dir}"
|
|
268
|
-
|
|
269
|
-
puts "libmgba built and installed to #{install_dir}"
|
|
270
|
-
end
|
|
271
|
-
end
|
|
272
|
-
|
|
273
220
|
task :default => :compile
|
|
274
221
|
|
|
275
222
|
namespace :release do
|
|
276
|
-
desc "
|
|
223
|
+
desc "Clean-slate smoke test: clobber, build gems, install fresh, verify"
|
|
277
224
|
task :smoke do
|
|
278
225
|
require 'tmpdir'
|
|
279
226
|
require 'fileutils'
|
|
280
227
|
|
|
228
|
+
# Clean slate — nuke compiled extensions so nothing local leaks in
|
|
229
|
+
puts "Clobbering local build artifacts..."
|
|
230
|
+
Rake::Task['clobber'].invoke
|
|
231
|
+
Rake::Task['sdl2:clobber'].invoke
|
|
232
|
+
|
|
281
233
|
Dir.mktmpdir('teek-smoke') do |tmpdir|
|
|
282
234
|
gem_home = File.join(tmpdir, 'gems')
|
|
283
235
|
|
|
284
236
|
# Build both gems
|
|
285
|
-
puts "
|
|
237
|
+
puts "\nBuilding gems..."
|
|
286
238
|
sh "gem build teek.gemspec -o #{tmpdir}/teek.gem 2>&1"
|
|
287
239
|
Dir.chdir('teek-sdl2') { sh "gem build teek-sdl2.gemspec -o #{tmpdir}/teek-sdl2.gem 2>&1" }
|
|
288
240
|
|
|
289
|
-
# Install into isolated GEM_HOME
|
|
290
|
-
puts "\nInstalling gems..."
|
|
241
|
+
# Install into isolated GEM_HOME (no system gems, no stale versions)
|
|
242
|
+
puts "\nInstalling gems into #{gem_home}..."
|
|
291
243
|
sh "GEM_HOME=#{gem_home} gem install #{tmpdir}/teek.gem --no-document 2>&1"
|
|
292
244
|
sh "GEM_HOME=#{gem_home} gem install #{tmpdir}/teek-sdl2.gem --no-document 2>&1"
|
|
293
245
|
|
|
294
246
|
# Run smoke test using only the installed gems (no -I, no bundle)
|
|
295
|
-
puts "\nRunning
|
|
247
|
+
puts "\nRunning smoke test..."
|
|
296
248
|
smoke = <<~'RUBY'
|
|
297
249
|
require "teek"
|
|
298
250
|
require "teek/sdl2"
|
|
299
251
|
|
|
252
|
+
# Verify native extensions loaded from gem path, not local source
|
|
253
|
+
%w[tcltklib teek_sdl2].each do |ext|
|
|
254
|
+
path = $LOADED_FEATURES.find { |f| f.include?(ext) && f.end_with?(".bundle", ".so", ".dll") }
|
|
255
|
+
abort "#{ext}: native extension not found in $LOADED_FEATURES" unless path
|
|
256
|
+
abort "#{ext}: loaded from local source (#{path}), not installed gem" if path.include?("/ext/")
|
|
257
|
+
end
|
|
258
|
+
|
|
300
259
|
app = Teek::App.new
|
|
301
260
|
app.set_window_title("Release Smoke Test")
|
|
302
261
|
app.set_window_geometry("320x240")
|
|
@@ -305,6 +264,7 @@ namespace :release do
|
|
|
305
264
|
|
|
306
265
|
vp = Teek::SDL2::Viewport.new(app, width: 300, height: 200)
|
|
307
266
|
vp.pack
|
|
267
|
+
app.update
|
|
308
268
|
|
|
309
269
|
vp.render do |r|
|
|
310
270
|
r.clear(30, 30, 30)
|
|
@@ -319,7 +279,7 @@ namespace :release do
|
|
|
319
279
|
|
|
320
280
|
app.after(500) { vp.destroy; app.destroy }
|
|
321
281
|
app.mainloop
|
|
322
|
-
puts "
|
|
282
|
+
puts "release:smoke OK — teek #{Teek::VERSION}, teek-sdl2 #{Teek::SDL2::VERSION}"
|
|
323
283
|
RUBY
|
|
324
284
|
|
|
325
285
|
smoke_file = File.join(tmpdir, 'smoke.rb')
|
|
@@ -474,32 +434,7 @@ namespace :docker do
|
|
|
474
434
|
sh cmd
|
|
475
435
|
end
|
|
476
436
|
|
|
477
|
-
desc "Run teek-
|
|
478
|
-
task mgba: :build do
|
|
479
|
-
tcl_version = tcl_version_from_env
|
|
480
|
-
ruby_version = ruby_version_from_env
|
|
481
|
-
image_name = docker_image_name(tcl_version, ruby_version)
|
|
482
|
-
|
|
483
|
-
require 'fileutils'
|
|
484
|
-
FileUtils.mkdir_p('coverage')
|
|
485
|
-
|
|
486
|
-
warn_if_containers_running(image_name)
|
|
487
|
-
|
|
488
|
-
puts "Running teek-mgba tests in Docker (Ruby #{ruby_version}, Tcl #{tcl_version})..."
|
|
489
|
-
cmd = "docker run --rm --init"
|
|
490
|
-
cmd += " -v #{Dir.pwd}/coverage:/app/coverage"
|
|
491
|
-
cmd += " -e TCL_VERSION=#{tcl_version}"
|
|
492
|
-
if ENV['COVERAGE'] == '1'
|
|
493
|
-
cmd += " -e COVERAGE=1"
|
|
494
|
-
cmd += " -e COVERAGE_NAME=#{ENV['COVERAGE_NAME'] || 'mgba'}"
|
|
495
|
-
end
|
|
496
|
-
cmd += " #{image_name}"
|
|
497
|
-
cmd += " xvfb-run -a bundle exec rake mgba:test"
|
|
498
|
-
|
|
499
|
-
sh cmd
|
|
500
|
-
end
|
|
501
|
-
|
|
502
|
-
desc "Run all tests (teek + teek-sdl2 + teek-mgba) with coverage and generate report"
|
|
437
|
+
desc "Run all tests (teek + teek-sdl2) with coverage and generate report"
|
|
503
438
|
task all: 'docker:build' do
|
|
504
439
|
tcl_version = tcl_version_from_env
|
|
505
440
|
ruby_version = ruby_version_from_env
|
|
@@ -520,11 +455,6 @@ namespace :docker do
|
|
|
520
455
|
Rake::Task['docker:build'].reenable
|
|
521
456
|
Rake::Task['docker:test:sdl2'].invoke
|
|
522
457
|
|
|
523
|
-
ENV['COVERAGE_NAME'] = 'mgba'
|
|
524
|
-
Rake::Task['docker:test:mgba'].reenable
|
|
525
|
-
Rake::Task['docker:build'].reenable
|
|
526
|
-
Rake::Task['docker:test:mgba'].invoke
|
|
527
|
-
|
|
528
458
|
# Collate inside Docker (paths match /app/lib/...)
|
|
529
459
|
puts "Collating coverage results..."
|
|
530
460
|
cmd = "docker run --rm --init"
|
data/ext/teek/extconf.rb
CHANGED
|
@@ -26,6 +26,21 @@ def find_tcltk
|
|
|
26
26
|
if File.exist?("#{inc}/tcl-tk/tcl.h")
|
|
27
27
|
inc = "#{inc}/tcl-tk"
|
|
28
28
|
end
|
|
29
|
+
|
|
30
|
+
# Check for versioned subdirectories (Debian/Ubuntu layout:
|
|
31
|
+
# /usr/include/tcl9.0/tcl.h, /usr/include/tcl8.6/tcl.h)
|
|
32
|
+
unless File.exist?("#{inc}/tcl.h")
|
|
33
|
+
versioned = Dir.glob("#{inc}/tcl*/tcl.h").max
|
|
34
|
+
if versioned
|
|
35
|
+
tcl_ver_dir = File.dirname(versioned)
|
|
36
|
+
tk_ver_dir = tcl_ver_dir.sub(/tcl/, 'tk')
|
|
37
|
+
$INCFLAGS << " -I#{tcl_ver_dir}"
|
|
38
|
+
$INCFLAGS << " -I#{tk_ver_dir}" if File.directory?(tk_ver_dir)
|
|
39
|
+
$LDFLAGS << " -L#{lib}"
|
|
40
|
+
break
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
29
44
|
if File.exist?("#{inc}/tcl.h") && File.exist?("#{inc}/tk.h")
|
|
30
45
|
$INCFLAGS << " -I#{inc}"
|
|
31
46
|
$LDFLAGS << " -L#{lib}"
|
data/lib/teek/version.rb
CHANGED
data/teek.gemspec
CHANGED
|
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.add_development_dependency "prism", "~> 1.0" # stdlib in Ruby 3.3+, gem for 3.2
|
|
30
30
|
spec.add_development_dependency "base64" # stdlib until Ruby 3.4, now bundled gem
|
|
31
31
|
|
|
32
|
-
spec.metadata["msys2_mingw_dependencies"] = "
|
|
32
|
+
spec.metadata["msys2_mingw_dependencies"] = "tcl tk"
|
|
33
33
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: teek
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- James Cook
|
|
@@ -150,7 +150,7 @@ homepage: https://github.com/jamescook/teek
|
|
|
150
150
|
licenses:
|
|
151
151
|
- MIT
|
|
152
152
|
metadata:
|
|
153
|
-
msys2_mingw_dependencies:
|
|
153
|
+
msys2_mingw_dependencies: tcl tk
|
|
154
154
|
rdoc_options: []
|
|
155
155
|
require_paths:
|
|
156
156
|
- lib
|