cryptopunks 2.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,23 +1,27 @@
1
-
2
-
3
- module Cryptopunks
4
-
5
- MAJOR = 2
6
- MINOR = 1
7
- PATCH = 0
8
- VERSION = [MAJOR,MINOR,PATCH].join('.')
9
-
10
- def self.version
11
- VERSION
12
- end
13
-
14
- def self.banner
15
- "cryptopunks/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
16
- end
17
-
18
- def self.root
19
- File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
20
- end
21
-
22
- end # module Cryptopunks
23
-
1
+
2
+
3
+ module Pixelart
4
+ module Module
5
+ module Cryptopunks
6
+
7
+ MAJOR = 3
8
+ MINOR = 0
9
+ PATCH = 0
10
+ VERSION = [MAJOR,MINOR,PATCH].join('.')
11
+
12
+ def self.version
13
+ VERSION
14
+ end
15
+
16
+ def self.banner
17
+ "cryptopunks/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in (#{root})"
18
+ end
19
+
20
+ def self.root
21
+ File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
22
+ end
23
+
24
+ end # module Cryptopunks
25
+ end # module Module
26
+ end # module Pixelart
27
+
data/lib/cryptopunks.rb CHANGED
@@ -1,194 +1,66 @@
1
- ## 3rd party
2
- require 'pixelart/base'
3
- require 'csvreader'
4
-
5
-
6
-
7
- ## extra stdlibs
8
- require 'digest' ## move/add to pixelart upstream - why? why not?
9
- require 'optparse'
10
- require 'gli' ## used for command line tool
11
-
12
-
13
-
14
- ## our own code
15
- require 'cryptopunks/version' # note: let version always go first
16
-
17
- ## forward define superclass for image
18
- module Cryptopunks
19
- class Image < Pixelart::Image; end
20
- end
21
-
22
-
23
- require 'cryptopunks/attributes'
24
- require 'cryptopunks/structs'
25
- require 'cryptopunks/composite'
26
- ## add old backwards compatible alias
27
-
28
- module Cryptopunks
29
- class Image
30
- Composite = ImageComposite
31
- end
32
- end
33
-
34
-
35
- require 'cryptopunks/dataset'
36
-
37
- require 'cryptopunks/colors'
38
- require 'cryptopunks/image'
39
-
40
- require 'cryptopunks/generator'
41
-
42
- ###
43
- ## add convenience pre-configurated generatored with build-in spritesheet (see config)
44
-
45
- module Cryptopunks
46
-
47
- def self.generator
48
- @generator ||= Generator.new( "#{root}/config/spritesheet.png",
49
- "#{root}/config/spritesheet.csv" )
50
- end
51
-
52
- class Image
53
- def self.generate( *values, style: nil )
54
-
55
- ##### add style option / hack - why? why not?
56
- if style
57
- values = if style.downcase.index( 'natural') && style.downcase.index( '2')
58
- ["#{values[0]} (N2)"] + values[1..-1]
59
- elsif style.downcase[0] == 'n' ## starting with n - always assume natural(s)
60
- ## auto-add (N) for Natural to archetype
61
- ["#{values[0]} (N)"] + values[1..-1]
62
- else
63
- puts "!! ERROR - unknown punk style #{style}; sorry"
64
- exit 1
65
- end
66
- end
67
-
68
-
69
- ###### hack for black&white
70
- ## auto-add b&w (black&white) to all attribute names e.g.
71
- ## Eyes => Eyes B&W
72
- ## Smile => Smile B&W
73
- ## ....
74
-
75
- archetype_key = Generator.normalize_key( values[0] )
76
- if archetype_key.end_with?( 'bw' ) || ## e.g. B&W
77
- archetype_key.end_with?( '1bit') ## e.g. 1-Bit or 1Bit
78
-
79
- values = [values[0]] + values[1..-1].map do |attribute|
80
- attribute_key = Generator.normalize_key( attribute )
81
- if ['wildhair'].include?( attribute_key ) ## pass through known b&w attributes by "default"
82
- attribute
83
- elsif attribute_key.index( "black" )
84
- attribute ## pass through as-is
85
- else
86
- "#{attribute} B&W"
87
- end
88
- end
89
-
90
- pp values
91
- end
92
-
93
-
94
- # note: female mouth by default has "custom" colors (not black)
95
- # for every 1/2/3/4 (human) skin tone and for zombie
96
- # auto-"magically" add mapping
97
- #
98
- # todo/check/fix - add more "contraints"
99
- # for mapping to only kick-in for "basic" versions
100
- # and not "colored" e.g. golden and such - why? why not?
101
- #
102
- # move this mapping here to "post-lookup" processing
103
- # to get/incl. more "meta" attribute info - why? why not?
104
- if archetype_key.index( 'female1' ) ||
105
- archetype_key.index( 'female2' ) ||
106
- archetype_key.index( 'female3' ) ||
107
- archetype_key.index( 'female4' ) ||
108
- archetype_key.index( 'zombiefemale' )
109
-
110
- values = [values[0]] + values[1..-1].map do |attribute|
111
- attribute_key = Generator.normalize_key( attribute )
112
-
113
- if attribute_key == 'smile' || attribute_key == 'frown'
114
- attribute += if archetype_key.index( 'zombiefemale' ) then ' Zombie'
115
- elsif archetype_key.index( 'female1' ) then ' 1'
116
- elsif archetype_key.index( 'female2' ) then ' 2'
117
- elsif archetype_key.index( 'female3' ) then ' 3'
118
- elsif archetype_key.index( 'female4' ) then ' 4'
119
- else
120
- puts "!! ERROR - smile or frown (mouth expression) not supported for archetype:"
121
- pp values
122
- exit 1
123
- end
124
- end
125
- attribute
126
- end
127
- end
128
-
129
- img = Cryptopunks.generator.generate( *values, style: style )
130
- ## note: unwrap inner image before passing on to c'tor (requires ChunkyPNG image for now)
131
- new( img.image )
132
- end # method Image.generate
133
-
134
- end # class Image
135
-
136
-
137
- class Spritesheet
138
- ## note: for now class used for "namespace" only
139
- def self.find_by( name:, gender: nil, size: nil ) ## return archetype/attribute image by name
140
- # note: pass along name as q (query string)
141
- Cryptopunks.generator.find( name,
142
- gender: gender,
143
- size: size )
144
- end
145
- end # class Spritesheet
146
- ## add convenience (alternate spelling) alias - why? why not?
147
- SpriteSheet = Spritesheet
148
- Sheet = Spritesheet
149
- Sprite = Spritesheet
150
- end # module Cryptopunks
151
-
152
-
153
-
154
- ####
155
- # add CryptoPunksData (off-chain) contract
156
- require 'cryptopunks/contract/punksdata-assets'
157
- require 'cryptopunks/contract/punksdata-meta'
158
- require 'cryptopunks/contract/punksdata-contract'
159
- CryptoPunksData = CryptopunksData
160
- PunksData = CryptopunksData
161
-
162
-
163
-
164
-
165
-
166
- require 'cryptopunks/tool'
167
-
168
- ### add tool convenience helper
169
- module Cryptopunks
170
- def self.main( args=ARGV ) Tool.new.run( args ); end
171
- end ## module Cryptopunks
172
-
173
-
174
-
175
-
176
-
177
- ### add some convenience shortcuts
178
- CryptoPunks = Cryptopunks
179
- Punks = Cryptopunks
180
- ## add singular too -why? why not?
181
- Cryptopunk = Cryptopunks
182
- CryptoPunk = Cryptopunks
183
- Punk = Cryptopunks
184
-
185
-
186
-
187
-
188
- ###
189
- # note: for convenience auto include Pixelart namespace!!! - why? why not?
190
- include Pixelart
191
-
192
-
193
-
194
- puts Cryptopunks.banner # say hello
1
+ ## 3rd party
2
+ require 'punks'
3
+
4
+
5
+
6
+ ## extra stdlibs
7
+ require 'digest' ## move/add to pixelart upstream - why? why not?
8
+ require 'optparse'
9
+ require 'gli' ## used for command line tool
10
+
11
+
12
+
13
+ ## our own code
14
+ require 'cryptopunks/version' # note: let version always go first
15
+
16
+
17
+ require 'cryptopunks/attributes'
18
+ require 'cryptopunks/structs'
19
+ require 'cryptopunks/composite'
20
+
21
+
22
+ ## add old backwards compatible alias
23
+ module Punk
24
+ class Image
25
+ Composite = ImageComposite
26
+ end
27
+ end
28
+
29
+
30
+
31
+ require 'cryptopunks/dataset'
32
+
33
+ require 'cryptopunks/colors'
34
+ require 'cryptopunks/image'
35
+
36
+
37
+ ####
38
+ # add CryptoPunksData (off-chain) contract
39
+ require 'cryptopunks/contract/punksdata-assets'
40
+ require 'cryptopunks/contract/punksdata-meta'
41
+ require 'cryptopunks/contract/punksdata-contract'
42
+ CryptoPunksData = CryptopunksData
43
+ PunksData = CryptopunksData
44
+
45
+
46
+
47
+
48
+
49
+ require 'cryptopunks/tool'
50
+
51
+ ### add tool convenience helper
52
+ module Punk
53
+ def self.main( args=ARGV ) Tool.new.run( args ); end
54
+ end ## module Punk
55
+
56
+
57
+
58
+
59
+
60
+ ###
61
+ # note: for convenience auto include Pixelart namespace!!! - why? why not?
62
+ include Pixelart
63
+
64
+
65
+
66
+ puts Pixelart::Module::Cryptopunks.banner # say hello
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptopunks
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-09 00:00:00.000000000 Z
11
+ date: 2022-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pixelart
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.2.1
19
+ version: 1.3.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.2.1
26
+ version: 1.3.2
27
27
  - !ruby/object:Gem::Dependency
28
- name: csvreader
28
+ name: punks
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gli
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -78,17 +78,17 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '3.22'
81
+ version: '3.23'
82
82
  type: :development
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: '3.22'
89
- description: cryptopunks - mint your own 24×24 pixel punk images off chain from the
90
- True Official Genuine CryptoPunks™ sha256-verified original 10 000 unique character
91
- collection; incl. 2x/4x/8x zoom for bigger sizes
88
+ version: '3.23'
89
+ description: cryptopunks - generate your own 24×24 pixel punk images (off-chain) from
90
+ the Official Genuine Matt & John's® Punks sha256-verified original 10 000 unique
91
+ character collection; incl. 2x/4x/8x zoom for bigger sizes
92
92
  email: wwwmake@googlegroups.com
93
93
  executables:
94
94
  - cryptopunk
@@ -105,8 +105,6 @@ files:
105
105
  - Rakefile
106
106
  - bin/cryptopunk
107
107
  - bin/punk
108
- - config/spritesheet.csv
109
- - config/spritesheet.png
110
108
  - lib/cryptopunks.rb
111
109
  - lib/cryptopunks/attributes.rb
112
110
  - lib/cryptopunks/colors.rb
@@ -115,7 +113,6 @@ files:
115
113
  - lib/cryptopunks/contract/punksdata-contract.rb
116
114
  - lib/cryptopunks/contract/punksdata-meta.rb
117
115
  - lib/cryptopunks/dataset.rb
118
- - lib/cryptopunks/generator.rb
119
116
  - lib/cryptopunks/image.rb
120
117
  - lib/cryptopunks/structs.rb
121
118
  - lib/cryptopunks/tool.rb
@@ -141,10 +138,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
138
  - !ruby/object:Gem::Version
142
139
  version: '0'
143
140
  requirements: []
144
- rubygems_version: 3.1.4
141
+ rubygems_version: 3.3.7
145
142
  signing_key:
146
143
  specification_version: 4
147
- summary: cryptopunks - mint your own 24×24 pixel punk images off chain from the True
148
- Official Genuine CryptoPunks™ sha256-verified original 10 000 unique character collection;
149
- incl. 2x/4x/8x zoom for bigger sizes
144
+ summary: cryptopunks - generate your own 24×24 pixel punk images (off-chain) from
145
+ the Official Genuine Matt & John's® Punks sha256-verified original 10 000 unique
146
+ character collection; incl. 2x/4x/8x zoom for bigger sizes
150
147
  test_files: []