originals 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5adec9529ef943fcc527eb54eb44390d42624d289781cc04c487d36dd3d8ce38
4
- data.tar.gz: 3fc3c527e769b09bba90502ba308e599234b2da5543b905bbc7ef66704fdfa14
3
+ metadata.gz: 839897746ae4fae453543d05aef33ad338e0c4489c710f175f6ad9538123b9ee
4
+ data.tar.gz: 7175a59edff977370b399501754b054aead24da465fda1d94c5bf23045f2c10c
5
5
  SHA512:
6
- metadata.gz: a8b5008a97f95b1817df036dcec56a200c1c24f1f01c52000719f04ae18261c1cdcf8f7b8793bfc62827f038f66246ea9aca1612f676d402fbd9add14d212826
7
- data.tar.gz: 5f6fc0225659f145f7e535a46bf135cb91aca66906527c4774dc08fbb3ab20d75c7ff56486dbb29bdfbe819a76aa83063d3e6801b3048d0e37cc2d7ccba5da59
6
+ metadata.gz: 6c955dd31d3bb297025ef9fa196e41c494a263a6f1b4fe361a722f43872476fc01f45cd8ba8c34712690383be04f1c72092c507c037db755feaf6b138d670c8e
7
+ data.tar.gz: 67ebc5f4e619c0373849cae23c2fac760002fe6a08eb4dcfff7c2f03671c9dc0ab4ea4740ac377f6fec1a95503d4747a1789c8d4cd123a3e9a540e4c7be6a3f9
data/Manifest.txt CHANGED
@@ -6,5 +6,6 @@ Rakefile
6
6
  bin/fab
7
7
  bin/fabricate
8
8
  lib/originals.rb
9
+ lib/originals/service.rb
9
10
  lib/originals/tool.rb
10
11
  lib/originals/version.rb
data/README.md CHANGED
@@ -23,10 +23,12 @@ $ fab -h
23
23
  resulting in:
24
24
 
25
25
  ```
26
- Usage: fab [options] name [attribute] ...
26
+ Usage: fab [options] name [attribute attribute ...]
27
+ fab [options] name id
27
28
  -z, --zoom NUM Zoom factor x2, x4, x8, etc. (default: 1)
28
29
  -b, --background, --bg STRING Background (default: transparent)
29
30
  -i, --id NUM Unique identifier (default: none)
31
+ -n, --name STRING Base name (default: punk|phunk|marilyn|etc.)
30
32
 
31
33
  -h, --help Prints this help
32
34
  ```
@@ -35,10 +37,11 @@ Usage: fab [options] name [attribute] ...
35
37
 
36
38
  ### Punks (24x24)
37
39
 
38
- _Fabricate punk character pixel art originals from text attributes (from scratch / zero) via builtin spritesheet_
40
+ _A free (pixel) art service brought to you by the [punks, (phunks, philips, marilyns, & more) generation library / gem »](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks)_
39
41
 
40
42
 
41
- Let's try:
43
+
44
+ Fab(ricate) punk character pixel art originals from text attributes (from scratch / zero) via built-in spritesheet. Let's try:
42
45
 
43
46
  ```
44
47
  $ fab punk alien headband
@@ -110,7 +113,7 @@ resulting in:
110
113
 
111
114
 
112
115
 
113
- ### Phunks (24x24)
116
+ #### Phunks (24x24)
114
117
 
115
118
  Let's try some left-looking punks also known as Phunks - "hand-phlipped" by Philip the Intern
116
119
 
@@ -128,7 +131,7 @@ resulting in:
128
131
 
129
132
 
130
133
 
131
- ### Philips (24x24)
134
+ #### Philips (24x24)
132
135
 
133
136
  Let's try some left-looking philips (pre-configured phunk
134
137
  with the built-in attributes: Male 3):
@@ -150,7 +153,7 @@ resulting in:
150
153
 
151
154
 
152
155
 
153
- ### Marilyns (24x24)
156
+ #### Marilyns (24x24)
154
157
 
155
158
  Let's try some left-looking marilyns (pre-configured phunk
156
159
  with the built-in attributes: Female 3, Wild Blonde, Mole, Blue Eye Shadow):
@@ -190,8 +193,11 @@ resulting in:
190
193
  ![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn2.4@4x.png)
191
194
 
192
195
 
196
+
193
197
  ### Shiba Inu Doge (24x24)
194
198
 
199
+ _A free (pixel) art service brought to you by the [shiba-inus generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/shibainus)_
200
+
195
201
 
196
202
  Let's try some shiba inu doge - much wow:
197
203
 
@@ -230,6 +236,8 @@ resulting in:
230
236
 
231
237
  ### Coolcats (24x24)
232
238
 
239
+ _A free (pixel) art service brought to you by the [coolcats generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/coolcats)_
240
+
233
241
 
234
242
  Let's try some coolcats:
235
243
 
@@ -269,8 +277,63 @@ resulting in:
269
277
 
270
278
 
271
279
 
280
+ ### Nouns (32x32)
281
+
282
+ _A free (pixel) art service brought to you by the [nouns generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/nouns)_
283
+
284
+
285
+ Let's try some noun (pixel avatars):
286
+
287
+
288
+ ```
289
+ $ fab noun body_grayscale1 checker_bigwalk_rainbow \
290
+ head_beer glasses_square_fullblack
291
+ $ fab noun body_gradient_pride bling_love \
292
+ head_bubblegum glasses_square_yellow_saturated
293
+ $ fab noun body_red txt_lol \
294
+ head_weed glasses_square_black_rgb
295
+
296
+ # -or- with some backgrounds
297
+ $ fab --background=0x638596 noun body_red txt_lol \
298
+ head_weed glasses_square_black_rgb
299
+ $ fab --background=0xffbf00 noun body_red txt_lol \
300
+ head_weed glasses_square_black_rgb
301
+ $ fab --background=ukraine noun body_red txt_lol \
302
+ head_weed glasses_square_black_rgb
303
+ $ fab --background=pride noun body_red txt_lol \
304
+ head_weed glasses_square_black_rgb
305
+ ```
306
+
307
+ resulting in:
308
+
309
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun0.png)
310
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun1.png)
311
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.png)
312
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.1.png)
313
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.2.png)
314
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.3.png)
315
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.4.png)
316
+
317
+ 4x (using the `--zoom=4`/`-z4` option)
318
+
319
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun0@4x.png)
320
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun1@4x.png)
321
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2@4x.png)
322
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.1@4x.png)
323
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.2@4x.png)
324
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.3@4x.png)
325
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/noun2.4@4x.png)
326
+
327
+
328
+
329
+
330
+
331
+
272
332
  ### Moonbirds / Owls (42x42)
273
333
 
334
+ _A free (pixel) art service brought to you by the [moonbirds (& owls)generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/moonbirds)_
335
+
336
+
274
337
 
275
338
  Let's try some super-rare never-before-seen moonbirds / owls:
276
339
 
@@ -310,12 +373,99 @@ resulting in:
310
373
 
311
374
 
312
375
 
313
-
314
376
  And so on. Stay tuned for more original artwork series!
315
377
 
316
378
 
317
379
 
318
380
 
381
+ ### Bonus: Readymades - Start w/ (Pixel) Art From (Online) Collections
382
+
383
+ _A free readymade (pixel) art service brought to you by the [artbase (server edition) »](https://github.com/pixelartexchange/artbase.server)_
384
+
385
+
386
+ Yes, you can. Pick any readymade pixel art (by number e.g. no.1, no.4, no.5, etc.) from any of the many collections served-up by an artbase (server edition)
387
+ installation.
388
+ By default "out-of-the-box" the artbase web server / service installation running online
389
+ at [pixelartexchange.herokuapp.com](https://pixelartexchange.herokuapp.com/) gets called via HTTP.
390
+
391
+
392
+
393
+ #### More Punks (24x24)
394
+
395
+ Let's try some more punks:
396
+
397
+ ```
398
+ $ fab morepunk no.179
399
+ $ fab morepunk no.180
400
+ $ fab morepunk no.190
401
+ ```
402
+
403
+ resulting in:
404
+
405
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk179.png)
406
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk180.png)
407
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk190.png)
408
+
409
+ 4x (using the `--zoom=4`/`-z4` option)
410
+
411
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk179@4x.png)
412
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk180@4x.png)
413
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk190@4x.png)
414
+
415
+
416
+
417
+ #### Punk Rocks (24x24)
418
+
419
+ Let's try some punk rocks:
420
+
421
+ ```
422
+ $ fab punkrock no.1
423
+ $ fab punkrock no.4
424
+ $ fab punkrock no.5
425
+ ```
426
+
427
+ resulting in:
428
+
429
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock1.png)
430
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock4.png)
431
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock5.png)
432
+
433
+ 4x (using the `--zoom=4`/`-z4` option)
434
+
435
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock1@4x.png)
436
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock4@4x.png)
437
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock5@4x.png)
438
+
439
+
440
+
441
+ #### Dooggies (32x32)
442
+
443
+ Let's try some dooggies:
444
+
445
+ ```
446
+ $ fab dooggie no.0
447
+ $ fab dooggie no.571
448
+ $ fab dooggie no.7411
449
+ ```
450
+
451
+ resulting in:
452
+
453
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie0.png)
454
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie571.png)
455
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie7411.png)
456
+
457
+ 4x (using the `--zoom=4`/`-z4` option)
458
+
459
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie0@4x.png)
460
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie571@4x.png)
461
+ ![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie7411@4x.png)
462
+
463
+
464
+
465
+ And so on.
466
+
467
+
468
+
319
469
  ## Install
320
470
 
321
471
  Just install the gem:
data/Rakefile CHANGED
@@ -30,6 +30,8 @@ Hoe.spec 'originals' do
30
30
  ['shibainus'],
31
31
  ['moonbirds'],
32
32
  ['coolcats'],
33
+ ['nouns'],
34
+ ['webclient'],
33
35
  ]
34
36
 
35
37
  self.licenses = ['Public Domain']
@@ -39,3 +41,4 @@ Hoe.spec 'originals' do
39
41
  }
40
42
 
41
43
  end
44
+
@@ -0,0 +1,82 @@
1
+
2
+ ## get image via artbase (HTTP) web service
3
+
4
+
5
+ ## forward define superclass for image
6
+ module Artbase
7
+ class Image < Pixelart::Image; end
8
+ end
9
+
10
+
11
+
12
+ module Artbase
13
+ ################
14
+ # convenience helpers / shortcuts
15
+ def self.service ## "shared" single (default) instance
16
+ @service ||= Service.new
17
+ end
18
+
19
+ class Image
20
+ def self.get( name, id ) Artbase.service.get( name, id ); end
21
+ end # class Image
22
+
23
+
24
+ ## todo/fix: move name variants into artbase server itelf - why? why not?
25
+ COLLECTIONS = {
26
+ 'punk' => 'punks',
27
+ 'morepunk' => 'morepunks',
28
+ 'readymadepunk' => 'readymadepunks',
29
+ 'bwpunk' => 'bwpunks',
30
+ 'frontpunk' => 'frontpunks',
31
+ 'intlpunk' => 'intlpunks',
32
+ 'boredape' => 'boredapes',
33
+ 'ape' => 'apes',
34
+ 'basicboredape' => 'basicboredapes',
35
+ 'coolcat' => 'coolcats',
36
+ 'dooggie' => 'dooggies',
37
+ 'mooncat' => 'mooncatrescue',
38
+ 'moonbear' => 'moonbears',
39
+ 'moonbird' => 'moonbirds',
40
+ 'starbird' => 'starbirds',
41
+ 'moonbirdpunk' => 'moonbirdpunks',
42
+ '8bit' => '8bits',
43
+ 'gopher' => 'gophers',
44
+ 'rock' => 'rocks',
45
+ 'punkrock' => 'punkrocks',
46
+ }
47
+
48
+
49
+ ###################
50
+ # main artbase service handler / machinery
51
+ class Service
52
+ DEFAULT_BASE_URL = 'https://pixelartexchange.herokuapp.com'
53
+
54
+
55
+ def initialize( base_url=DEFAULT_BASE_URL )
56
+ @base_url = base_url
57
+ end
58
+
59
+ def get( collection, id )
60
+
61
+ url = "#{@base_url}/#{collection}/#{id}.png"
62
+ res = Webclient.get( url )
63
+
64
+ puts "#{res.status.code} #{res.status.message}"
65
+ puts " content_type: #{res.content_type}"
66
+ puts " content_length: #{res.content_length} bytes (#{res.content_length.class.name})"
67
+
68
+ if res.status.ok?
69
+ ## todo/fix: move to Pixelart::Image itself
70
+ ## use from_blob or such - why? why not
71
+ img_inner = ChunkyPNG::Image.from_blob( res.blob )
72
+ img = Artbase::Image.new( img_inner.width, img_inner.height, img_inner )
73
+ img
74
+ else
75
+ puts "!! HTTP ERROR - image data request failed; sorry"
76
+ return nil
77
+ end
78
+ end
79
+ end # class Service
80
+
81
+ end # module Artbase
82
+
@@ -1,6 +1,9 @@
1
1
  module Originals
2
2
  class Tool
3
3
 
4
+
5
+
6
+
4
7
  def self.main( args=ARGV )
5
8
  puts "==> welcome to the fab(ricate) tool with args:"
6
9
  pp args
@@ -50,20 +53,57 @@ class Tool
50
53
  name = args[0] ## todo/check - use collection_name/slug or such?
51
54
  attributes = args[1..-1]
52
55
 
56
+
53
57
  ## normalize name of series
54
58
  ## e.g. Shiba Inu => shibainu etc.
55
- key = name.downcase.gsub( '[ ()_-]', '' )
59
+ key = Originals.factory._norm_name( name )
60
+
61
+ ## check for readymade via series id
62
+ ## allow some "literal" variants e.g.
63
+ ## punk no.1 or no.001
64
+ ## punk #1 or #001
65
+ ## etc.
66
+ ## and some more in the future - why? why not?
67
+
68
+ id = nil
69
+
70
+ img = if attributes.size == 1 && id=Originals.factory._parse_id( attributes[0] )
71
+ ## check for known collection names
72
+ ## (mostly singular to plural) - keep? why? why not?
73
+ collection = Artbase::COLLECTIONS[ key ] || key
74
+ Artbase::Image.get( collection, id )
75
+ else
76
+ Original::Image.fabricate( key, *attributes )
77
+ end
78
+
79
+ if img.nil?
80
+ puts "!! ERROR - don't know how to fabricate >#{name}<; sorry"
81
+ exit 1
82
+ end
56
83
 
57
- img = Original::Image.fabricate( key, *attributes,
58
- background: options[ :background] )
59
84
 
85
+ ## note: keep adding background as a separate step for now
86
+ if options[ :background]
87
+ ## hack: for now for artbase collections
88
+ ## try to remove background if any
89
+ ## keep? why? why not?
90
+ img = img.transparent if id
60
91
 
92
+ img = Original.factory._background( img,
93
+ options[ :background ] )
94
+ end
61
95
 
62
- basename = if options[:name]
63
- "#{options[:name]}#{options[:id]}"
64
- else
65
- "#{key}#{options[:id]}"
66
- end
96
+ basename = String.new('') ## note: start with our own string buffer
97
+ ## otherwise assigned first string gets modified!!
98
+ basename += options[:name] ? options[:name] : key
99
+
100
+ basename += if options[:id]
101
+ options[:id]
102
+ elsif id
103
+ id.to_s
104
+ else
105
+ '' # add nothing
106
+ end
67
107
 
68
108
 
69
109
  path = if options[:zoom]
@@ -2,8 +2,8 @@
2
2
 
3
3
  module Originals
4
4
  MAJOR = 1
5
- MINOR = 0
6
- PATCH = 0
5
+ MINOR = 1
6
+ PATCH = 1
7
7
  VERSION = [MAJOR,MINOR,PATCH].join('.')
8
8
 
9
9
  def self.version
data/lib/originals.rb CHANGED
@@ -3,6 +3,9 @@ require 'cryptopunks'
3
3
  require 'shibainus'
4
4
  require 'moonbirds'
5
5
  require 'coolcats'
6
+ require 'nouns'
7
+
8
+ require 'webclient'
6
9
 
7
10
 
8
11
 
@@ -27,133 +30,121 @@ end
27
30
  ##
28
31
  # "wrap" fabricate inside Image - why? why not?
29
32
  class Image
30
- def self.fabricate( name, *attributes, background: nil ) ## add fac alias - why? why not?
33
+
34
+ def self.fabricate( name, *attributes, background: nil )
31
35
  ## normalize name of series
32
36
  ## e.g. Shiba Inu => shibainu etc.
33
- key = name.downcase.gsub( '[ ()_-]', '' )
34
-
35
- img = if ['punk', 'punks',
36
- 'cryptopunk', 'cryptopunks'].include?( key )
37
- Originals.factory.punk( *attributes, background: background )
38
- elsif ['phunk', 'phunks',
39
- 'cryptophunk', 'cryptophunks'].include?( key )
40
- Originals.factory.phunk( *attributes, background: background )
41
- elsif ['marilyn', 'marilyns' ].include?( key )
42
- Originals.factory.marilyn( *attributes, background: background )
43
- elsif ['philip', 'philips',
44
- 'philipp', 'philipps' ].include?( key )
45
- Originals.factory.philip( *attributes, background: background )
46
- elsif ['doge', 'doges',
47
- 'shiba', 'shibas',
48
- 'shibainu', 'shibainus'].include?( key )
49
- Originals.factory.shiba( *attributes, background: background )
50
- elsif ['bird', 'birds',
51
- 'moonbird', 'moonbirds',
52
- 'owl', 'owls'].include?( key )
53
- Originals.factory.bird( *attributes, background: background )
54
- elsif ['coolcat', 'coolcats'].include?( key )
55
- Originals.factory.coolcat( *attributes, background: background )
56
- else
57
- puts "!! ERROR; don't know how to fabricate >#{name}<; sorry"
58
- exit 1
59
- end
37
+ key = Originals.factory._norm_name( name )
38
+
39
+ img = if ['punk', 'punks',
40
+ 'cryptopunk', 'cryptopunks'].include?( key )
41
+ Originals.factory.punk( *attributes )
42
+ elsif ['phunk', 'phunks',
43
+ 'cryptophunk', 'cryptophunks'].include?( key )
44
+ Originals.factory.phunk( *attributes )
45
+ elsif ['marilyn', 'marilyns' ].include?( key )
46
+ Originals.factory.marilyn( *attributes )
47
+ elsif ['philip', 'philips',
48
+ 'philipp', 'philipps' ].include?( key )
49
+ Originals.factory.philip( *attributes )
50
+ elsif ['doge', 'doges',
51
+ 'shiba', 'shibas',
52
+ 'shibainu', 'shibainus'].include?( key )
53
+ Originals.factory.shiba( *attributes )
54
+ elsif ['bird', 'birds',
55
+ 'moonbird', 'moonbirds',
56
+ 'owl', 'owls'].include?( key )
57
+ Originals.factory.bird( *attributes )
58
+ elsif ['coolcat', 'coolcats'].include?( key )
59
+ Originals.factory.coolcat( *attributes )
60
+ elsif ['noun', 'nouns'].include?( key )
61
+ Originals.factory.noun( *attributes )
62
+ else
63
+ return nil ## return nil
64
+ end
65
+
66
+ ## note: keep add background as a separate (last) step for now - why? why not?
67
+ img = Originals.factory._background( img, background ) if background
60
68
  img
61
69
  end
62
70
  class << self
63
- alias_method :fab, :fabricate
71
+ alias_method :fab, :fabricate
64
72
  end
65
- end # class Image
66
73
 
67
74
 
75
+ end # class Image
68
76
 
69
77
 
70
78
 
71
79
  class Factory ## add Fabricator/Artist/Artfactory/? alias or such - why? why not?
72
80
 
73
- def punk( *attributes, mirror: false, background: nil )
81
+
82
+ def punk( *attributes )
74
83
  ## note: if no attributes passed in
75
84
  ## default to ['Male 2']
76
85
  attributes = ['Male 2'] if attributes.size == 0
77
86
 
78
- _generate_punk( *attributes,
79
- mirror: mirror,
80
- background: background )
87
+ Cryptopunks::Image.generate( *attributes )
81
88
  end
82
89
 
83
- def phunk( *attributes, background: nil )
84
- punk( *attributes,
85
- mirror: true,
86
- background: background )
90
+ def phunk( *attributes )
91
+ punk( *attributes ).mirror
87
92
  end
88
93
 
89
94
 
90
95
  MARILYN_ATTRIBUTES = ['Female 3', 'Wild Blonde', 'Mole',
91
96
  'Blue Eye Shadow']
92
97
 
93
- def marilyn( *attributes, background: nil )
94
- _generate_punk( *MARILYN_ATTRIBUTES,
95
- *attributes,
96
- mirror: true,
97
- background: background )
98
+ def marilyn( *attributes )
99
+ phunk( *MARILYN_ATTRIBUTES, *attributes )
98
100
  end
99
101
 
100
102
 
101
103
  PHILIP_ATTRIBUTES = ['Male 3']
102
- def philip( *attributes, background: nil )
103
- _generate_punk( *PHILIP_ATTRIBUTES,
104
- *attributes,
105
- mirror: true,
106
- background: background )
104
+ def philip( *attributes )
105
+ phunk( *PHILIP_ATTRIBUTES, *attributes )
107
106
  end
108
107
 
109
108
 
110
109
 
111
110
  ## add method alias doge, shiba_inu etc. - why? why not?
112
- def shiba( *attributes, background: nil )
111
+ def shiba( *attributes )
113
112
  ## note: if no attributes passed in
114
113
  ## default to ['Classic']
115
114
  attributes = ['Classic'] if attributes.size == 0
116
115
 
117
- doge = Shiba::Image.generate( *attributes )
118
- doge = _background( doge, background ) if background
119
- doge
116
+ Shiba::Image.generate( *attributes )
120
117
  end
121
118
 
122
119
 
123
120
  ## add method alias moonbird, owl etc. - why? why not?
124
- def bird( *attributes, background: nil )
121
+ def bird( *attributes )
125
122
  attributes = ['Brave Glitch'] if attributes.size == 0
126
123
 
127
- bird = Moonbird::Image.generate( *attributes )
128
- bird = _background( bird, background ) if background
129
- bird
124
+ Moonbird::Image.generate( *attributes )
130
125
  end
131
126
 
132
127
 
133
- def coolcat( *attributes, background: nil )
134
- cat = Coolcat::Image.generate( *attributes )
135
- cat = _background( cat, background ) if background
136
- cat
128
+ def coolcat( *attributes )
129
+ Coolcat::Image.generate( *attributes )
137
130
  end
138
131
 
139
132
 
133
+ def noun( *attributes )
134
+ attributes = ['Body Grayscale 1',
135
+ 'Checker Bigwalk Rainbow',
136
+ 'Head Beer',
137
+ 'Glasses Square Fullblack'] if attributes.size == 0
140
138
 
141
- ###
142
- # helpers
139
+ Noun::Image.generate( *attributes )
140
+ end
143
141
 
144
- def _generate_punk( *attributes,
145
- mirror: false,
146
- background: nil )
147
- punk = Cryptopunks::Image.generate( *attributes )
148
142
 
149
- punk = punk.mirror if mirror
150
- ## note: add background as LAST step (after mirror operation)
151
- ## that is, if mirror=true background will NOT get mirrored
152
- punk = _background( punk, background ) if background
153
- punk
154
- end
155
143
 
156
144
 
145
+ ###
146
+ # helpers
147
+
157
148
  def _background( base, background )
158
149
  width, height = base.width, base.height
159
150
 
@@ -171,6 +162,23 @@ def _background( base, background )
171
162
  img2
172
163
  end
173
164
 
165
+ def _norm_name( str )
166
+ str.downcase.gsub( /[ ()_-]/, '' )
167
+ end
168
+
169
+ def _parse_id( str )
170
+ if str.gsub( /[ #()._-]/, '' ) =~ /
171
+ ^(no|n|id)?
172
+ (?<id>[0-9]+)$
173
+ /ix
174
+ id = Regexp.last_match[:id].to_i(10) ## note: add base 10 (for 008 or such)
175
+ id
176
+ else
177
+ nil # retur nil if no match
178
+ end
179
+ end
180
+
181
+
174
182
  end # class Factory
175
183
 
176
184
 
@@ -178,7 +186,7 @@ end # module Originals
178
186
 
179
187
 
180
188
 
181
-
189
+ require 'originals/service'
182
190
  require 'originals/tool'
183
191
 
184
192
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: originals
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
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-06-01 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cryptopunks
@@ -66,6 +66,34 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: nouns
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webclient
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
69
97
  - !ruby/object:Gem::Dependency
70
98
  name: rdoc
71
99
  requirement: !ruby/object:Gem::Requirement
@@ -122,6 +150,7 @@ files:
122
150
  - bin/fab
123
151
  - bin/fabricate
124
152
  - lib/originals.rb
153
+ - lib/originals/service.rb
125
154
  - lib/originals/tool.rb
126
155
  - lib/originals/version.rb
127
156
  homepage: https://github.com/pixelartexchange/originals