ordserve 0.0.1 → 0.1.0

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: 5d5237155b1e3f7cc383373db13d85a1f2e0db459816265a2b2a5a0b0e30f9a3
4
- data.tar.gz: 265e44df22bb2237289fcfd64e441ee59696948d8bcd05f72b86a3c5074e4c8f
3
+ metadata.gz: fbdf2c0749e68a8a8e8b84ccd0c8787a4da0720412977bab27892c924a822c91
4
+ data.tar.gz: 58b91f6575e54a640c34f1d47d6586d0f0d8273571aa34cbd2cfdbc2e7e27ca5
5
5
  SHA512:
6
- metadata.gz: aebb8a87587926d36b138307d28da9e71618f4c12365b18edd6adcbc44e5ce018e4cec0a5a9f04626aac364da23f3dd60a2d3f8d8561a06ee2d162ff2e4af8dd
7
- data.tar.gz: a95dcec2fa1d833072360b6593523f5d653cc9324a3cb7e79fe83f42b74988a367cd4ff2a4d3524df258ebb061238d86c393fee304898698bb4b41fb75dff202
6
+ metadata.gz: 835c066010577915784fabbcf9cf64b41f606cc2df5fc93820fb80c47262aa4a81871c12905dbb4d734059ea7d358421f76330abb5e45667e8860ec346ccc22b
7
+ data.tar.gz: dd5e9ff55ba33b3c29d752ea21a7f3320b70738c9643db9621ab2775060e7987a4b7b12080c1d4db33fd3a27dfb8ce9af9b2ad80fbeefe5eecf6da67595600e7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,4 @@
1
+ ### 0.1.0 / 2023-08-02
1
2
  ### 0.0.1 / 2023-08-02
2
3
 
3
4
  * Everything is new. First release
data/Manifest.txt CHANGED
@@ -2,4 +2,17 @@ CHANGELOG.md
2
2
  Manifest.txt
3
3
  README.md
4
4
  Rakefile
5
+ bin/ordserve
5
6
  lib/ordserve.rb
7
+ lib/ordserve/service.rb
8
+ lib/ordserve/version.rb
9
+ lib/ordserve/views/index.erb
10
+ samples/punk1.svg
11
+ samples/punk1a.svg
12
+ samples/punk1b.svg
13
+ samples/punk1c.svg
14
+ samples/punk1d.svg
15
+ samples/punk2.svg
16
+ samples/punk2a.svg
17
+ samples/punk2b.svg
18
+ samples/punk2c.svg
data/README.md CHANGED
@@ -1,21 +1,92 @@
1
- # Ordinal (Generative ORC-721) Inscription Indexer
2
-
3
- ordscan - ordinals inscription (on bitcoin & co) indexer / scanner
1
+ # Ordinal Inscription Sandbox (Testing) Server / Service
4
2
 
3
+ ordserve - serve-up ordinal inscription (on bitcoin & co) from a local test sandbox
4
+
5
5
 
6
6
  * home :: [github.com/ordbase/ordbase](https://github.com/ordbase/ordbase)
7
7
  * bugs :: [github.com/ordbase/ordbase/issues](https://github.com/ordbase/ordbase/issues)
8
- * gem :: [rubygems.org/gems/ordscan](https://rubygems.org/gems/ordscan)
9
- * rdoc :: [rubydoc.info/gems/ordscan](http://rubydoc.info/gems/ordscan)
8
+ * gem :: [rubygems.org/gems/ordserve](https://rubygems.org/gems/ordserve)
9
+ * rdoc :: [rubydoc.info/gems/ordserve](http://rubydoc.info/gems/ordserve)
10
+
11
+
12
+
13
+ ## Command-Line Tool
14
+
15
+ Use the command line tool named - surprise, surpirse - `ordserve`
16
+ to run a zero-config / out-of-the-box ordinal inscription server that lets
17
+ you test recursive inscriptions with local web pages (in .SVG or .HTML).
18
+ Type:
19
+
20
+ $ ordserve
21
+
22
+ That will start-up a (local loopback) web server running on port 3000.
23
+ Open-up up the index page in your browser to get started e.g. <http://localhost:3000/>.
24
+
25
+
26
+
27
+ Try your first recursive inscription.
28
+ Let's try a punk in the .SVG format with two recursions -
29
+ alien ([inscribe no. 11617799](https://ordinals.com/inscription/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0)) and
30
+ bandana ([inscribe no. 11627632](https://ordinals.com/inscription/a6b4b81f69e8c217db24f0a71954195d67ced49a819b67a4daf9f3ca7fa1b971i0)) - `punk1.svg`:
31
+
32
+ ``` svg
33
+ <svg xmlns="http://www.w3.org/2000/svg"
34
+ width="100%" height="100%"
35
+ viewBox="0 0 24 24">
36
+ <image href="/content/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0"
37
+ style="image-rendering: pixelated;" />
38
+ <image href="/content/a6b4b81f69e8c217db24f0a71954195d67ced49a819b67a4daf9f3ca7fa1b971i0"
39
+ style="image-rendering: pixelated;" />
40
+ </svg>
41
+ ```
42
+
43
+ Now try <http://localhost:3000/punks1.svg> and
44
+ you get the million dollar alien with bandana built from zero / scratch.
45
+ The two recursions (referenced via `/content/:id`) will get
46
+ the first-time "automagically" downloaded via the ordinals.com api
47
+ and saved into the local `./content` directory.
48
+
49
+
50
+ Let's try a punk with three recursions -
51
+ alien ([inscribe no. 11617799](https://ordinals.com/inscription/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0)),
52
+ cap foward ([inscribe no. 11617793](https://ordinals.com/inscription/0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0)) and
53
+ laser eyes ([inscribe no. 12359718](https://ordinals.com/inscription/72fe7ebda802852f499dca865ec22ac43eacfcf4796d761969ae8358791e943ci0))- `punk1a.svg`:
54
+
55
+ ``` svg
56
+ <svg xmlns="http://www.w3.org/2000/svg"
57
+ width="100%" height="100%"
58
+ viewBox="0 0 24 24">
59
+ <image href="/content/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0"
60
+ style="image-rendering: pixelated;" />
61
+ <image href="/content/0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0"
62
+ style="image-rendering: pixelated;" />
63
+ <image href="/content/72fe7ebda802852f499dca865ec22ac43eacfcf4796d761969ae8358791e943ci0"
64
+ style="image-rendering: pixelated;" />
65
+ </svg>
66
+ ```
67
+
68
+ Now try <http://localhost:3000/punks1a.svg> and
69
+ you get an ultra-rare never-before-seen alien with cap foward
70
+ and laser eyes built from zero / scratch.
71
+ The three recursions (referenced via `/content/:id`) will get
72
+ the first-time "automagically" downloaded via the ordinals.com api
73
+ and saved into `./content`.
74
+
75
+
76
+ That's it.
77
+
10
78
 
79
+ Bonus - For more (recursive) samples
80
+ see [ordtest - the public ordinals (recursive) testing sandbox »](https://github.com/ordtest/ordtest.github.io)
11
81
 
12
82
 
13
- ## Usage
14
83
 
15
- To be done
16
84
 
85
+ ## Install
17
86
 
87
+ Just install the gem:
18
88
 
89
+ $ gem install ordserve
19
90
 
20
91
 
21
92
 
data/Rakefile CHANGED
@@ -1,9 +1,9 @@
1
1
  require 'hoe'
2
- ## require './lib/ordserve/version.rb'
2
+ require './lib/ordserve/version.rb'
3
3
 
4
4
  Hoe.spec 'ordserve' do
5
5
 
6
- self.version = '0.0.1' ## Pixelart::Module::Ordserve::VERSION
6
+ self.version = Ordinals::Module::Ordserve::VERSION
7
7
 
8
8
 
9
9
  self.summary = "ordserve - serve-up ordinal inscription (on bitcoin & co) from a local test sandbox"
data/bin/ordserve ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ ###################
4
+ # == DEV TIPS:
5
+ #
6
+ # For local testing run like:
7
+ #
8
+ # ruby -Ilib bin/ordserve
9
+ #
10
+ # Set the executable bit in Linux. Example:
11
+ #
12
+ # % chmod a+x bin/ordserve
13
+ #
14
+
15
+ require 'ordserve'
16
+
17
+ Ordserve.main
18
+
19
+
@@ -0,0 +1,49 @@
1
+
2
+ # todo/check: find a better name?
3
+ class Ordserve < Sinatra::Base
4
+
5
+ # set :public_folder, Dir.pwd ## use current working directory
6
+ # set :static, true
7
+
8
+ get '/' do
9
+ erb :index
10
+ end
11
+
12
+ get '/samples/:name.svg' do
13
+ name = params['name']
14
+ headers( 'Content-Type' => "image/svg+xml" )
15
+
16
+ path = "#{Ordinals::Module::Ordserve.root}/samples/#{name}.svg"
17
+
18
+ blob = File.open( path, 'rb' ) { |f| f.read }
19
+ puts " #{blob.size} byte(s)"
20
+ blob
21
+ end
22
+
23
+ get '/content/:id' do
24
+ id = params['id']
25
+ content_dir = settings.content_folder
26
+ path = "#{content_dir}/#{id}"
27
+ if File.exist?( path )
28
+ puts " serving local content blob >#{path}<..."
29
+ headers( 'Content-Type' => "application/octet-stream" )
30
+
31
+ blob = File.open( path, 'rb' ) { |f| f.read }
32
+ puts " #{blob.size} byte(s)"
33
+ blob
34
+ else
35
+ ## download first
36
+ content = Ordinals.content( id )
37
+ ## pp content
38
+ #=> #<Ordinals::Api::Content:0x000001a1352df938
39
+ # @data="RIFF\xF8\v\x00\x00WEBPVP8 \xEC\v\x00\x00...",
40
+ # @length=3072,
41
+ # @type="image/png"
42
+
43
+ ## puts "data:"
44
+ ## puts content.data
45
+ write_blob( path, content.data )
46
+ content.data
47
+ end
48
+ end
49
+ end # class Ordserve
@@ -0,0 +1,24 @@
1
+
2
+ module Ordinals
3
+ module Module
4
+ module Ordserve
5
+ MAJOR = 0
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
+ "ordserve/#{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 Ordserve
23
+ end # module Module
24
+ end # module Ordbase
@@ -0,0 +1,32 @@
1
+
2
+ <h1>Welcome, to Ordserve v<%= Ordinals::Module::Ordserve::VERSION %>!</h1>
3
+
4
+ <p>
5
+ Settings
6
+ </p>
7
+
8
+ <ul>
9
+ <li>public_folder: <%= settings.public_folder %></li>
10
+ <li>content_folder: <%= settings.content_folder %></li>
11
+ </ul>
12
+
13
+ <p>
14
+ (Recursive) Built-in Samples
15
+
16
+ Punks
17
+ </p>
18
+
19
+ <ul>
20
+ <li><a href="samples/punk1.svg">samples/punk1.svg</a> - alien with bandana</li>
21
+ <li><a href="samples/punk1a.svg">samples/punk1a.svg</a> - alien with cap forward</li>
22
+ <li><a href="samples/punk1b.svg">samples/punk1b.svg</a> - alien with cap forward and laser eyes</li>
23
+ <li><a href="samples/punk1c.svg">samples/punk1c.svg</a> - alien with cap forward and laser eyes and pipe</li>
24
+ <li><a href="samples/punk1d.svg">samples/punk1d.svg</a> - alien with cap forward and laser eyes and pipe on bitcoin pattern</li>
25
+ </ul>
26
+
27
+ <ul>
28
+ <li><a href="samples/punk2.svg">samples/punk2.svg</a> - red martian (alien vol. 2) with bandana</li>
29
+ <li><a href="samples/punk2a.svg">samples/punk2a.svg</a> - red martian (alien vol. 2) with bandana on bitcoin pattern</li>
30
+ <li><a href="samples/punk2b.svg">samples/punk2b.svg</a> - red martian (alien vol. 2) with bandana and laser eyes (golden) on bitcoin pattern</li>
31
+ <li><a href="samples/punk2c.svg">samples/punk2c.svg</a> - red martian (alien vol. 2) with cap forward and laser eyes (golden) on bitcoin pattern</li>
32
+ </ul>
data/lib/ordserve.rb CHANGED
@@ -1,3 +1,57 @@
1
1
 
2
- puts "hello, ordserve!"
2
+ ## pull-in web service support
3
+ require 'sinatra/base' ## note: using the "modular" style
4
+ require 'webrick'
3
5
 
6
+ ## more 3rd party gems
7
+ require 'ordinals' ## incl. cocos
8
+
9
+
10
+ ## our own code
11
+ require_relative 'ordserve/version' # note: let version always go first
12
+ require_relative 'ordserve/service'
13
+
14
+
15
+
16
+ class Ordserve ## note: Ordserve is Sinatra::Base
17
+ def self.main( argv=ARGV )
18
+ puts 'hello from main with args:'
19
+ pp argv
20
+
21
+ path = argv[0] || './content'
22
+
23
+ puts " using content_folder: >#{path}<"
24
+
25
+ ## note: let's you use latter settings.content_folder (resulting in path)
26
+ set( :content_folder, File.expand_path(path))
27
+
28
+ #####
29
+ # fix/todo:
30
+ ## use differnt port ??
31
+ ##
32
+ ## use --local for host e.g. 127.0.0.1 insteaod of 0.0.0.0 ???
33
+
34
+ # puts 'before Puma.run app'
35
+ # require 'rack/handler/puma'
36
+ # Rack::Handler::Puma.run ProfilepicService, :Port => 3000, :Host => '0.0.0.0'
37
+ # puts 'after Puma.run app'
38
+
39
+ # use webrick for now - why? why not?
40
+ puts 'before WEBrick.run service'
41
+ Rack::Handler::WEBrick.run Ordserve, :Port => 3000, :Host => '127.0.0.1'
42
+ puts 'after WEBrick.run service'
43
+
44
+ puts 'bye'
45
+ end
46
+ end
47
+
48
+
49
+ ####
50
+ # convenience aliases / shortcuts / alternate spellings
51
+ # add OrdService / Ordservice too - why? why not?
52
+ OrdServe = Ordserve
53
+ OrdServer = Ordserve
54
+ Ordserver = Ordserve
55
+
56
+
57
+ puts Ordinals::Module::Ordserve.banner # say hello
data/samples/punk1.svg ADDED
@@ -0,0 +1,9 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/a6b4b81f69e8c217db24f0a71954195d67ced49a819b67a4daf9f3ca7fa1b971i0"
8
+ style="image-rendering: pixelated;" />
9
+ </svg>
@@ -0,0 +1,9 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0"
8
+ style="image-rendering: pixelated;" />
9
+ </svg>
@@ -0,0 +1,11 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0"
8
+ style="image-rendering: pixelated;" />
9
+ <image href="/content/72fe7ebda802852f499dca865ec22ac43eacfcf4796d761969ae8358791e943ci0"
10
+ style="image-rendering: pixelated;" />
11
+ </svg>
@@ -0,0 +1,13 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0"
8
+ style="image-rendering: pixelated;" />
9
+ <image href="/content/72fe7ebda802852f499dca865ec22ac43eacfcf4796d761969ae8358791e943ci0"
10
+ style="image-rendering: pixelated;" />
11
+ <image href="/content/92e7f48454546718f98103d7464d954033adbee21855f06584be06faa3e291ddi0"
12
+ style="image-rendering: pixelated;" />
13
+ </svg>
@@ -0,0 +1,15 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/43e93e43f2dac75b141baaa5b08df440e0b6ec5755577a9554a7af6540447bb7i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/81ec4177e7fce4e568cc1c14366fe29deb88b0f0841eb12d4f1d0638cca68201i0"
8
+ style="image-rendering: pixelated;" />
9
+ <image href="/content/0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0"
10
+ style="image-rendering: pixelated;" />
11
+ <image href="/content/72fe7ebda802852f499dca865ec22ac43eacfcf4796d761969ae8358791e943ci0"
12
+ style="image-rendering: pixelated;" />
13
+ <image href="/content/92e7f48454546718f98103d7464d954033adbee21855f06584be06faa3e291ddi0"
14
+ style="image-rendering: pixelated;" />
15
+ </svg>
data/samples/punk2.svg ADDED
@@ -0,0 +1,9 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/e60f597ec41c50e823ea382c101dfc2f30c13a927222be3b73cedd88bd1b9237i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/a6b4b81f69e8c217db24f0a71954195d67ced49a819b67a4daf9f3ca7fa1b971i0"
8
+ style="image-rendering: pixelated;" />
9
+ </svg>
@@ -0,0 +1,11 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/43e93e43f2dac75b141baaa5b08df440e0b6ec5755577a9554a7af6540447bb7i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/e60f597ec41c50e823ea382c101dfc2f30c13a927222be3b73cedd88bd1b9237i0"
8
+ style="image-rendering: pixelated;" />
9
+ <image href="/content/a6b4b81f69e8c217db24f0a71954195d67ced49a819b67a4daf9f3ca7fa1b971i0"
10
+ style="image-rendering: pixelated;" />
11
+ </svg>
@@ -0,0 +1,13 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/43e93e43f2dac75b141baaa5b08df440e0b6ec5755577a9554a7af6540447bb7i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/e60f597ec41c50e823ea382c101dfc2f30c13a927222be3b73cedd88bd1b9237i0"
8
+ style="image-rendering: pixelated;" />
9
+ <image href="/content/a6b4b81f69e8c217db24f0a71954195d67ced49a819b67a4daf9f3ca7fa1b971i0"
10
+ style="image-rendering: pixelated;" />
11
+ <image href="/content/4db2e931b5cd489d8007d111d20ab97d84161b84c8f7ff3038e1afe79567b9afi0"
12
+ style="image-rendering: pixelated;" />
13
+ </svg>
@@ -0,0 +1,13 @@
1
+
2
+ <svg xmlns="http://www.w3.org/2000/svg"
3
+ width="100%" height="100%"
4
+ viewBox="0 0 24 24">
5
+ <image href="/content/43e93e43f2dac75b141baaa5b08df440e0b6ec5755577a9554a7af6540447bb7i0"
6
+ style="image-rendering: pixelated;" />
7
+ <image href="/content/e60f597ec41c50e823ea382c101dfc2f30c13a927222be3b73cedd88bd1b9237i0"
8
+ style="image-rendering: pixelated;" />
9
+ <image href="/content/0bd902941392ea138adb7db30cecdf5bc09a92c80e3e1bc3ecdf3c2d0abf6631i0"
10
+ style="image-rendering: pixelated;" />
11
+ <image href="/content/4db2e931b5cd489d8007d111d20ab97d84161b84c8f7ff3038e1afe79567b9afi0"
12
+ style="image-rendering: pixelated;" />
13
+ </svg>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ordserve
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
@@ -89,7 +89,8 @@ dependencies:
89
89
  description: ordserve - serve-up ordinal inscription (on bitcoin & co) from a local
90
90
  test sandbox
91
91
  email: gerald.bauer@gmail.com
92
- executables: []
92
+ executables:
93
+ - ordserve
93
94
  extensions: []
94
95
  extra_rdoc_files:
95
96
  - CHANGELOG.md
@@ -100,7 +101,20 @@ files:
100
101
  - Manifest.txt
101
102
  - README.md
102
103
  - Rakefile
104
+ - bin/ordserve
103
105
  - lib/ordserve.rb
106
+ - lib/ordserve/service.rb
107
+ - lib/ordserve/version.rb
108
+ - lib/ordserve/views/index.erb
109
+ - samples/punk1.svg
110
+ - samples/punk1a.svg
111
+ - samples/punk1b.svg
112
+ - samples/punk1c.svg
113
+ - samples/punk1d.svg
114
+ - samples/punk2.svg
115
+ - samples/punk2a.svg
116
+ - samples/punk2b.svg
117
+ - samples/punk2c.svg
104
118
  homepage: https://github.com/ordbase/ordbase
105
119
  licenses:
106
120
  - Public Domain