pixelflut 1.0.5 → 1.1.1

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: 72c6df29c81c54b5819636736f404a2179a60fdb9ba3d957fa3b466c54963aae
4
- data.tar.gz: cdc9fbbbe2c5dffb605429e0a2ba27be38c1411f074e1c883462780723a99176
3
+ metadata.gz: 4e6890a9d13b0f4b2149dd49c8add1decaaa6876a62c1f9200d4c1b2d6f36ced
4
+ data.tar.gz: 7364299d22932c514afea765f5cb13a3c4d85d8b6c649330d1761ce6733126d3
5
5
  SHA512:
6
- metadata.gz: 5fb329f94c5e744dc5b25aaabf85351f5bad4593ecc46331240a5a22ecdcae67ce8ac5e3b496440092953c27d1f789170cd394371a25d5145d1b8c08128f4f45
7
- data.tar.gz: ac537008fa8257540dac638117e5925a83a5ab4176f35ba30e7e2ad418b890e79ffc29b12fee41d6a83d07de9bea6e64436044dfb37f609307eeaf23c8e1d925
6
+ metadata.gz: be62c10bdbbb3f5e316e48143da7b5d9a2c3be7bebab0a33d8728df5d6459f254e69a83f99e93d18068f31835ca8bc25adf5356ba345c46dabb926faf08b367c
7
+ data.tar.gz: 4210b816ff0cb3ed146c95e4301fc242d399b3d3065dbd9c9e1ebb829b9ab50ef683f95188ba5f7e6db927916eaace45061753b77ca19d7165d1001a366adb2d
data/bin/pxf CHANGED
@@ -1,11 +1,11 @@
1
- #!/usr/bin/env ruby --jit
1
+ #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
4
  $stdout.sync = $stderr.sync = true
5
- $name = Process.setproctitle(File.basename(Process.argv0))
5
+ def me = Process.setproctitle(File.basename(Process.argv0))
6
6
 
7
7
  puts(<<~HELP) || exit if ARGV.index('-h') || ARGV.index('--help')
8
- Usage: #{$name} [options] <png_image>
8
+ Usage: #{me} [options] <png_image>
9
9
 
10
10
  Options:
11
11
  --host <address> target host address (default 127.0.0.1)
@@ -23,12 +23,11 @@ HELP
23
23
 
24
24
  if ARGV.index('-v') || ARGV.index('--version')
25
25
  require_relative('../lib/pixelflut/version')
26
- puts("#{$name} - Pixelflut v#{Pixelflut::VERSION}") || exit
26
+ puts("#{me} - Pixelflut v#{Pixelflut::VERSION}") || exit
27
27
  end
28
28
 
29
- def die!(msg, code: 1) = $stderr.puts("#{$name}: #{msg}") || exit(code)
30
-
31
- die!("argument missing - try `#{$name} --help`") if ARGV.empty?
29
+ def die!(msg, code: 1) = $stderr.puts("#{me}: #{msg}") || exit(code)
30
+ die!("argument missing - try `#{me} --help`") if ARGV.empty?
32
31
 
33
32
  require_relative('../lib/pixelflut')
34
33
 
@@ -45,7 +44,7 @@ module Configuration
45
44
 
46
45
  def invalid(value, name)
47
46
  die!("value for #{name} missing") if value.nil?
48
- die!("invalid value for #{name} - '#{value}'")
47
+ die!("invalid value for #{name} - #{value.inspect}")
49
48
  end
50
49
 
51
50
  def as_str(value, name)
@@ -88,7 +87,7 @@ module Configuration
88
87
  end
89
88
 
90
89
  def use_threads(address, data)
91
- puts("#{$name}: start #{data.size} threads for #{data.sum(&:size)} bytes")
90
+ puts("#{me}: start #{data.size} threads for #{data.sum(&:size)} bytes")
92
91
  Thread.report_on_exception = false
93
92
  data.map! { Thread.start { Pixelflut::Sender.send(address, it) } }
94
93
  GC.start
@@ -96,13 +95,13 @@ def use_threads(address, data)
96
95
  end
97
96
 
98
97
  def use_processes(address, data)
99
- puts("#{$name}: start #{data.size} processes for #{data.sum(&:size)} bytes")
98
+ puts("#{me}: start #{data.size} processes for #{data.sum(&:size)} bytes")
100
99
  data.size.times do |i|
101
100
  next unless fork
102
101
  data = data[i]
103
102
  GC.start
104
- $name = Process.setproctitle("#{$name}-#{'0' if i < 9}#{i + 1}")
105
- Pixelflut::Sender.send(address, data) { puts("#{$name}: #{it} bytes") }
103
+ me = Process.setproctitle("#{me}-#{'0' if i < 9}#{i + 1}")
104
+ Pixelflut::Sender.send(address, data) { puts("#{me}: #{it} bytes") }
106
105
  end
107
106
  GC.start
108
107
  end
data/bin/pxf-info ADDED
@@ -0,0 +1,32 @@
1
+ #! /bin/sh
2
+
3
+ set -e
4
+
5
+ if [ "$1" = '--help' ]
6
+ then
7
+ echo "Usage: ${0##*/} [-p|--port PORT] ADDRESS
8
+
9
+ Requests screen size of Pixelflut server at ADDRESS.
10
+ "
11
+ exit 0
12
+ fi
13
+
14
+ PORT="1234"
15
+ ADDRESS=""
16
+
17
+ while [ $# -gt 0 ]
18
+ do
19
+ key="$1"
20
+ case $key in
21
+ -p|--port)
22
+ PORT="$2"
23
+ shift; shift
24
+ ;;
25
+ *)
26
+ ADDRESS="$key"
27
+ shift
28
+ ;;
29
+ esac
30
+ done
31
+
32
+ printf "SIZE\nQUIT\n" | nc "$ADDRESS" "$PORT"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Pixelflut
4
- VERSION = '1.0.5'
4
+ VERSION = '1.1.1'
5
5
  end
data/lib/pixelflut.rb CHANGED
@@ -55,13 +55,7 @@ module Pixelflut
55
55
  width.times do |x|
56
56
  next if (a = blob.getbyte(pos += 4)) == 0
57
57
  ret << format(
58
- (
59
- if a == 255
60
- "PX %d %d %02x%02x%02x\n"
61
- else
62
- "PX %d %d %02x%02x%02x%02x\n"
63
- end
64
- ),
58
+ "PX %d %d %02x%02x%02x#{'%02x' if a != 255}\n",
65
59
  x + @delta_x,
66
60
  y + @delta_y,
67
61
  blob.getbyte(pos - 3),
data/pixelflut.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/pixelflut/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'pixelflut'
7
+ spec.version = Pixelflut::VERSION
8
+ spec.summary = 'A fast Pixelflut client written in Ruby.'
9
+ spec.description = <<~DESCRIPTION.tr("\n", '')
10
+ Based on the idea of a simple server protocol to collaborate on a shared
11
+ canvas named [Pixelflut](https://cccgoe.de/wiki/Pixelflut) this gem
12
+ implements a fast Ruby client version.
13
+ DESCRIPTION
14
+ spec.author = 'Mike Blumtritt'
15
+ spec.licenses = %w[MIT Ruby]
16
+ spec.homepage = 'https://codeberg.org/mblumtritt/pixelflut'
17
+ spec.metadata['source_code_uri'] = spec.homepage
18
+ spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
19
+ spec.metadata['rubygems_mfa_required'] = 'true'
20
+
21
+ spec.required_ruby_version = '> 3.0'
22
+
23
+ spec.add_dependency 'chunky_png'
24
+
25
+ spec.executables = %w[pxf pxf-info]
26
+ spec.files = Dir['lib/**/*.rb'] + %w[pixelflut.gemspec]
27
+ spec.extra_rdoc_files = %w[README.md]
28
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixelflut
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Blumtritt
@@ -23,35 +23,37 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '0'
26
- description: |
27
- Based on the idea of a simple server protocol to collaborate on a shared
28
- canvas named [Pixelflut](https://cccgoe.de/wiki/Pixelflut) this gem
29
- implements a fast Ruby client version.
26
+ description: Based on the idea of a simple server protocol to collaborate on a sharedcanvas
27
+ named [Pixelflut](https://cccgoe.de/wiki/Pixelflut) this gemimplements a fast Ruby
28
+ client version.
30
29
  executables:
31
30
  - pxf
31
+ - pxf-info
32
32
  extensions: []
33
33
  extra_rdoc_files:
34
- - LICENSE
35
34
  - README.md
36
35
  files:
37
- - LICENSE
38
36
  - README.md
39
37
  - bin/pxf
38
+ - bin/pxf-info
40
39
  - lib/pixelflut.rb
41
40
  - lib/pixelflut/sender.rb
42
41
  - lib/pixelflut/version.rb
43
- homepage: https://github.com/mblumtritt/pixelflut
44
- licenses: []
42
+ - pixelflut.gemspec
43
+ homepage: https://codeberg.org/mblumtritt/pixelflut
44
+ licenses:
45
+ - MIT
46
+ - Ruby
45
47
  metadata:
46
- source_code_uri: https://github.com/mblumtritt/pixelflut
47
- bug_tracker_uri: https://github.com/mblumtritt/pixelflut/issues
48
+ source_code_uri: https://codeberg.org/mblumtritt/pixelflut
49
+ bug_tracker_uri: https://codeberg.org/mblumtritt/pixelflut/issues
48
50
  rubygems_mfa_required: 'true'
49
51
  rdoc_options: []
50
52
  require_paths:
51
53
  - lib
52
54
  required_ruby_version: !ruby/object:Gem::Requirement
53
55
  requirements:
54
- - - ">="
56
+ - - ">"
55
57
  - !ruby/object:Gem::Version
56
58
  version: '3.0'
57
59
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -60,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
62
  - !ruby/object:Gem::Version
61
63
  version: '0'
62
64
  requirements: []
63
- rubygems_version: 3.6.9
65
+ rubygems_version: 4.0.11
64
66
  specification_version: 4
65
67
  summary: A fast Pixelflut client written in Ruby.
66
68
  test_files: []
data/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2024-2025 Mike Blumtritt
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.