discreet_proxy 1.0.1 → 1.0.2

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
- SHA1:
3
- metadata.gz: 75eaec212bfa0184efb7f237524a07492c5db0ed
4
- data.tar.gz: 1567a4d209ea2cda81fe4f4f66b02d105b5df21a
2
+ SHA256:
3
+ metadata.gz: 6d604d587652c9e262e170bd071de1228856038a645e316ccf395d6542437bcc
4
+ data.tar.gz: 3b80ad22e6c84ce89c881247dcd412df4ca9d7c2d23e51959b50fe3fb50e1d82
5
5
  SHA512:
6
- metadata.gz: 974fbd774e6f4879ed064c9209e16c9c59e9cf21d85b37eb318ae11bd44caed1361e93de11c7e2443187931c6bbb414f5815554dcaf1c637f30b50f71c8bacdd
7
- data.tar.gz: 471be071408efe7cdf821def6aa3f6882a8e7b8ae77c387b2ae15df3befa454ff052e5e4faceb96a285978609a1f651f5ebb83eb4dd7c41d899487c33afd3613
6
+ metadata.gz: b7fdb9c9232138db58ea42e4ba487eeb4f049090f958364e3c67587e2addd9ede917a08d0457bed2208c100793c0d6aa2bce4a14851dc68d9c843406f97c4503
7
+ data.tar.gz: bc37f8eced2f798ccaed0d922fe48487ab9772df462ffcafc23a04d0a295891d4135c24c53f4e7f8499178dbd6f755ab4d2e9f9636d5ffce18d4034e072293b2
data/Gemfile CHANGED
@@ -1,10 +1,5 @@
1
- source "http://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- gem "chunky_png", "~>1.2"
3
+ source "http://rubygems.org"
4
4
 
5
- group :development do
6
- gem "rake"
7
- gem "bundler"
8
- gem "jeweler"
9
- gem "cli_test"
10
- end
5
+ gemspec
data/README.rdoc CHANGED
@@ -2,15 +2,18 @@
2
2
 
3
3
  Writes and reads Flame/Smoke proxy files (.p) using ChunkyPNG.
4
4
 
5
- To read every .p file on your Flame system and write it out as a PNG preview to the /tmp
5
+ == Installation
6
6
 
7
- Dir.glob("/usr/discreet/project/**/*.p").each do | icon_path |
8
- proxy = DiscreetProxy.from_file(icon_path)
9
- dest_path = "/tmp/" + File.basename(icon_path) + ".png"
10
- proxy.save_png(dest_path)
11
- end
12
-
13
- Also you can use the builtin `flame_proxy_icon` binary to convert to and from the format.
7
+ Run these two commands in your terminal:
8
+
9
+ $sudo gem install discreet_proxy
10
+ $flame_proxy_icon --help
11
+
12
+ If the first one does not work - make sure you have Ruby installed.
13
+
14
+ == Usage from the command line
15
+
16
+ The builtin `flame_proxy_icon` binary is used to convert to and from the `.p` format.
14
17
 
15
18
  $flame_proxy_icon --from-png my_icon.png
16
19
 
@@ -20,6 +23,20 @@ will create "my_icon.p", and the reverse
20
23
 
21
24
  will create a SuperSetup.batch.png file that you can massage in, say, Photoshop.
22
25
 
26
+ == Usage from Ruby
27
+
28
+ To read every .p file on your Flame system and write it out as a PNG preview to the /tmp
29
+
30
+ require "rubygems"
31
+ require "discreet_proxy"
32
+ Dir.glob("/usr/discreet/project/**/*.p").each do | icon_path |
33
+ proxy = DiscreetProxy.from_file(icon_path)
34
+ dest_path = "/tmp/" + File.basename(icon_path) + ".png"
35
+ proxy.save_png(dest_path)
36
+ end
37
+
38
+ From there on the possibilities are endless.
39
+
23
40
  == Contributing to discreet_proxy
24
41
 
25
42
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
@@ -32,6 +49,6 @@ will create a SuperSetup.batch.png file that you can massage in, say, Photoshop.
32
49
 
33
50
  == Copyright
34
51
 
35
- Copyright (c) 2011 Julik Tarkhanov. See LICENSE.txt for
52
+ Copyright (c) 2011 and on Julik Tarkhanov. See LICENSE.txt for
36
53
  further details.
37
54
 
data/Rakefile CHANGED
@@ -1,28 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # encoding: utf-8
2
- require 'rubygems'
3
- require 'bundler'
4
- require 'jeweler'
5
- require './lib/discreet_proxy'
6
4
 
7
- Jeweler::Tasks.new do |gem|
8
- # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
9
- gem.version = DiscreetProxy::VERSION
10
- gem.name = "discreet_proxy"
11
- gem.homepage = "http://github.com/julik/discreet_proxy"
12
- gem.license = "MIT"
13
- gem.summary = %Q{Parses and creates Flame/Smoke .p proxy icon files}
14
- gem.email = "me@julik.nl"
15
- gem.authors = ["Julik Tarkhanov"]
16
- gem.executables = ["flame_proxy_icon"]
17
- # dependencies defined in Gemfile
18
- end
19
- Jeweler::RubygemsDotOrgTasks.new
5
+ # frozen_string_literal: true
6
+
7
+ require "bundler/gem_tasks"
8
+ require "rake/testtask"
20
9
 
21
- require 'rake/testtask'
22
- Rake::TestTask.new(:test) do |test|
23
- test.libs << 'lib' << 'test'
24
- test.pattern = 'test/**/test_*.rb'
25
- test.verbose = true
10
+ Rake::TestTask.new(:test) do |t|
11
+ t.libs << "lib"
12
+ t.test_files = FileList["test/test_*.rb"]
26
13
  end
27
14
 
28
- task :default => :test
15
+ task default: [:test]
@@ -1,84 +1,32 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/discreet_proxy"
5
4
 
6
5
  Gem::Specification.new do |s|
7
6
  s.name = "discreet_proxy"
8
- s.version = "1.0.1"
7
+ s.version = DiscreetProxy::VERSION
9
8
 
10
9
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
10
  s.authors = ["Julik Tarkhanov"]
12
- s.date = "2013-12-14"
13
11
  s.email = "me@julik.nl"
14
12
  s.executables = ["flame_proxy_icon"]
15
13
  s.extra_rdoc_files = [
16
14
  "LICENSE.txt",
17
15
  "README.rdoc"
18
16
  ]
19
- s.files = [
20
- ".document",
21
- ".travis.yml",
22
- "Gemfile",
23
- "LICENSE.txt",
24
- "README.rdoc",
25
- "Rakefile",
26
- "bin/flame_proxy_icon",
27
- "discreet_proxy.gemspec",
28
- "lib/discreet_proxy.rb",
29
- "test/converted_png_proxies/Kanaty.stabilizer.p.p.png",
30
- "test/converted_png_proxies/Medianize.stabilizer.p.p.png",
31
- "test/converted_png_proxies/Ripples.glsl.p.p.png",
32
- "test/converted_png_proxies/Tezt_flame_5_trackers.stabilizer.p.p.png",
33
- "test/converted_png_proxies/doberman.batch.p.p.png",
34
- "test/converted_png_proxies/e292_v02.batch.p.p.png",
35
- "test/converted_png_proxies/e292_v02shadow.batch.p.p.png",
36
- "test/converted_png_proxies/spontaan.stabilizer.p.p.png",
37
- "test/converted_png_proxies/spontaan2.stabilizer.p.p.png",
38
- "test/converted_png_proxies/t2.batch.p.p.png",
39
- "test/helper.rb",
40
- "test/test_cli.rb",
41
- "test/test_discreet_proxy.rb",
42
- "test/test_proxies/Kanaty.stabilizer.p",
43
- "test/test_proxies/Medianize.stabilizer.p",
44
- "test/test_proxies/Ripples.glsl.p",
45
- "test/test_proxies/Tezt_flame_5_trackers.stabilizer.p",
46
- "test/test_proxies/doberman.batch.p",
47
- "test/test_proxies/e292_v02.batch.p",
48
- "test/test_proxies/e292_v02shadow.batch.p",
49
- "test/test_proxies/spontaan.stabilizer.p",
50
- "test/test_proxies/spontaan2.stabilizer.p",
51
- "test/test_proxies/t2.batch.p",
52
- "test/test_proxy_out/Kanaty.stabilizer.p"
53
- ]
17
+ s.files = `git ls-files -z`.split("\x0").reject { |f| f == ".gitignore" }
54
18
  s.homepage = "http://github.com/julik/discreet_proxy"
55
19
  s.licenses = ["MIT"]
56
20
  s.require_paths = ["lib"]
57
- s.rubygems_version = "2.0.3"
58
21
  s.summary = "Parses and creates Flame/Smoke .p proxy icon files"
22
+ s.specification_version = 4
59
23
 
60
- if s.respond_to? :specification_version then
61
- s.specification_version = 4
24
+ s.add_runtime_dependency "chunky_png"#, "~>1.2"
62
25
 
63
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
64
- s.add_runtime_dependency(%q<chunky_png>, ["~> 1.2"])
65
- s.add_development_dependency(%q<rake>, [">= 0"])
66
- s.add_development_dependency(%q<bundler>, [">= 0"])
67
- s.add_development_dependency(%q<jeweler>, [">= 0"])
68
- s.add_development_dependency(%q<cli_test>, [">= 0"])
69
- else
70
- s.add_dependency(%q<chunky_png>, ["~> 1.2"])
71
- s.add_dependency(%q<rake>, [">= 0"])
72
- s.add_dependency(%q<bundler>, [">= 0"])
73
- s.add_dependency(%q<jeweler>, [">= 0"])
74
- s.add_dependency(%q<cli_test>, [">= 0"])
75
- end
76
- else
77
- s.add_dependency(%q<chunky_png>, ["~> 1.2"])
78
- s.add_dependency(%q<rake>, [">= 0"])
79
- s.add_dependency(%q<bundler>, [">= 0"])
80
- s.add_dependency(%q<jeweler>, [">= 0"])
81
- s.add_dependency(%q<cli_test>, [">= 0"])
82
- end
26
+ s.add_development_dependency "rake"
27
+ s.add_development_dependency "cli_test"
28
+ s.add_development_dependency "minitest"
29
+ s.add_development_dependency "ostruct"
30
+ s.add_development_dependency "magic_frozen_string_literal"
83
31
  end
84
32
 
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "chunky_png"
2
4
 
3
5
  # The whole module for making and reading Flame proxy icon files
4
6
  module DiscreetProxy
5
- VERSION = "1.0.1"
7
+ VERSION = "1.0.2"
6
8
 
7
9
  # Parse a .p file and return a Proxy
8
10
  def self.from_file(path)
@@ -96,7 +98,6 @@ module DiscreetProxy
96
98
  def to_dotp
97
99
  # Pack the header
98
100
  buf = StringIO.new(0xFF.chr * 40)
99
- byteswap_version = [PROXY_VERSION].pack("e").reverse
100
101
  header = [MAGIC, VERSION_BSWAP, width, height, PROXY_DEPTH].pack("na6nnn")
101
102
  buf.write(header)
102
103
  buf.seek(40)
@@ -158,10 +159,11 @@ module DiscreetProxy
158
159
 
159
160
  private
160
161
 
161
- # Rows start at 8-byte aligned boundaries. BUT due to the
162
- # fact that this is a BDSM Silicon Graphics format the start of the row is END of the image.
162
+ # Rows are padded so the byte count is a multiple of 4 (32-bit alignment).
163
+ # BUT due to the fact that this is a BDSM Silicon Graphics format the start of
164
+ # the row is END of the image.
163
165
  def row_pad
164
- @row_pad ||= ((@width * 3) % 8)
166
+ @row_pad ||= (-@width * 3) % 4
165
167
  end
166
168
 
167
169
  def pack_rgb(r,g,b)
data/test/helper.rb CHANGED
@@ -1,13 +1,10 @@
1
- require 'rubygems'
1
+ # frozen_string_literal: true
2
+
2
3
  require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
4
+ Bundler.setup
5
+
6
+ require "minitest"
7
+ require "minitest/autorun"
11
8
 
12
9
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
13
10
  $LOAD_PATH.unshift(File.dirname(__FILE__))
data/test/test_cli.rb CHANGED
@@ -1,7 +1,9 @@
1
- require File.expand_path(File.dirname(__FILE__)) + '/helper'
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "helper"
2
4
  require "cli_test"
3
5
 
4
- class CliTest < Test::Unit::TestCase
6
+ class CliTest < Minitest::Test
5
7
  TEMP_DIR = File.expand_path(File.dirname(__FILE__) + "/tmp")
6
8
  BIN_P = File.expand_path(File.dirname(__FILE__) + "/../bin/flame_proxy_icon")
7
9
 
@@ -19,14 +21,14 @@ class CliTest < Test::Unit::TestCase
19
21
  end
20
22
 
21
23
  def test_cli_with_no_args_produces_usage
22
- status, o, e = cli('')
24
+ status, _o, e = cli('')
23
25
  assert_equal 1, status
24
- assert_match /Also use the --help option/, e
26
+ assert_match( /Also use the --help option/, e)
25
27
  end
26
28
 
27
29
  def test_cli_from_png
28
30
  FileUtils.cp(File.dirname(__FILE__) + "/converted_png_proxies/Kanaty.stabilizer.p.p.png", TEMP_DIR)
29
- status, o, e = cli("--from-png #{TEMP_DIR}/Kanaty.stabilizer.p.p.png")
31
+ status, _o, e = cli("--from-png #{TEMP_DIR}/Kanaty.stabilizer.p.p.png")
30
32
  assert status.zero?, e
31
33
  assert File.exist?(TEMP_DIR + "/Kanaty.stabilizer.p.p.p")
32
34
  end
@@ -34,7 +36,7 @@ class CliTest < Test::Unit::TestCase
34
36
  def test_cli_from_p
35
37
  FileUtils.cp(File.dirname(__FILE__) + "/test_proxies/Kanaty.stabilizer.p", TEMP_DIR)
36
38
 
37
- status, o, e = cli("--from-icon #{TEMP_DIR}/Kanaty.stabilizer.p")
39
+ status, _o, e = cli("--from-icon #{TEMP_DIR}/Kanaty.stabilizer.p")
38
40
  assert status.zero?, e
39
41
  assert File.exist?(TEMP_DIR + "/Kanaty.stabilizer.png")
40
42
  end
@@ -1,6 +1,8 @@
1
- require 'helper'
1
+ # frozen_string_literal: true
2
2
 
3
- class TestDiscreetProxy < Test::Unit::TestCase
3
+ require_relative "helper"
4
+
5
+ class TestDiscreetProxy < Minitest::Test
4
6
  def test_reading
5
7
  f = DiscreetProxy.from_file(File.dirname(__FILE__) + "/test_proxies/e292_v02.batch.p")
6
8
  assert_equal 126, f.width, "Width should be correct"
@@ -18,7 +20,6 @@ class TestDiscreetProxy < Test::Unit::TestCase
18
20
  def test_to_dotp
19
21
  Dir.glob(File.dirname(__FILE__) + "/test_proxies/*.p").each do | f |
20
22
  proxy = DiscreetProxy.from_file(f)
21
- repl = '/tmp/%s.p' % File.basename(f)
22
23
  message = "Roundtripping #{File.basename(f)}"
23
24
 
24
25
  pixdata = proxy.to_dotp # Package up
metadata CHANGED
@@ -1,86 +1,98 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: discreet_proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2013-12-14 00:00:00.000000000 Z
10
+ date: 2026-06-03 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: chunky_png
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ~>
16
+ - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: '1.2'
18
+ version: '0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ~>
23
+ - - ">="
25
24
  - !ruby/object:Gem::Version
26
- version: '1.2'
25
+ version: '0'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - '>='
30
+ - - ">="
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
33
  type: :development
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - '>='
37
+ - - ">="
39
38
  - !ruby/object:Gem::Version
40
39
  version: '0'
41
40
  - !ruby/object:Gem::Dependency
42
- name: bundler
41
+ name: cli_test
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - '>='
44
+ - - ">="
46
45
  - !ruby/object:Gem::Version
47
46
  version: '0'
48
47
  type: :development
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
- - - '>='
51
+ - - ">="
53
52
  - !ruby/object:Gem::Version
54
53
  version: '0'
55
54
  - !ruby/object:Gem::Dependency
56
- name: jeweler
55
+ name: minitest
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- - - '>='
58
+ - - ">="
60
59
  - !ruby/object:Gem::Version
61
60
  version: '0'
62
61
  type: :development
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
- - - '>='
65
+ - - ">="
67
66
  - !ruby/object:Gem::Version
68
67
  version: '0'
69
68
  - !ruby/object:Gem::Dependency
70
- name: cli_test
69
+ name: ostruct
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ type: :development
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - ">="
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ - !ruby/object:Gem::Dependency
83
+ name: magic_frozen_string_literal
71
84
  requirement: !ruby/object:Gem::Requirement
72
85
  requirements:
73
- - - '>='
86
+ - - ">="
74
87
  - !ruby/object:Gem::Version
75
88
  version: '0'
76
89
  type: :development
77
90
  prerelease: false
78
91
  version_requirements: !ruby/object:Gem::Requirement
79
92
  requirements:
80
- - - '>='
93
+ - - ">="
81
94
  - !ruby/object:Gem::Version
82
95
  version: '0'
83
- description:
84
96
  email: me@julik.nl
85
97
  executables:
86
98
  - flame_proxy_icon
@@ -89,8 +101,7 @@ extra_rdoc_files:
89
101
  - LICENSE.txt
90
102
  - README.rdoc
91
103
  files:
92
- - .document
93
- - .travis.yml
104
+ - ".document"
94
105
  - Gemfile
95
106
  - LICENSE.txt
96
107
  - README.rdoc
@@ -98,6 +109,7 @@ files:
98
109
  - bin/flame_proxy_icon
99
110
  - discreet_proxy.gemspec
100
111
  - lib/discreet_proxy.rb
112
+ - test/converted_png_proxies/AB_Halation.glsl.p.p.png
101
113
  - test/converted_png_proxies/Kanaty.stabilizer.p.p.png
102
114
  - test/converted_png_proxies/Medianize.stabilizer.p.p.png
103
115
  - test/converted_png_proxies/Ripples.glsl.p.p.png
@@ -111,6 +123,7 @@ files:
111
123
  - test/helper.rb
112
124
  - test/test_cli.rb
113
125
  - test/test_discreet_proxy.rb
126
+ - test/test_proxies/AB_Halation.glsl.p
114
127
  - test/test_proxies/Kanaty.stabilizer.p
115
128
  - test/test_proxies/Medianize.stabilizer.p
116
129
  - test/test_proxies/Ripples.glsl.p
@@ -126,24 +139,21 @@ homepage: http://github.com/julik/discreet_proxy
126
139
  licenses:
127
140
  - MIT
128
141
  metadata: {}
129
- post_install_message:
130
142
  rdoc_options: []
131
143
  require_paths:
132
144
  - lib
133
145
  required_ruby_version: !ruby/object:Gem::Requirement
134
146
  requirements:
135
- - - '>='
147
+ - - ">="
136
148
  - !ruby/object:Gem::Version
137
149
  version: '0'
138
150
  required_rubygems_version: !ruby/object:Gem::Requirement
139
151
  requirements:
140
- - - '>='
152
+ - - ">="
141
153
  - !ruby/object:Gem::Version
142
154
  version: '0'
143
155
  requirements: []
144
- rubyforge_project:
145
- rubygems_version: 2.0.3
146
- signing_key:
156
+ rubygems_version: 3.6.2
147
157
  specification_version: 4
148
158
  summary: Parses and creates Flame/Smoke .p proxy icon files
149
159
  test_files: []
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- rvm:
2
- - 1.8.7
3
- - 1.9.2
4
- - 1.9.3