scribelite 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 +4 -4
- data/CHANGELOG.md +1 -0
- data/Manifest.txt +5 -0
- data/README.md +1 -1
- data/Rakefile +10 -3
- data/lib/scribelite/models/calldata.rb +19 -0
- data/lib/scribelite/models/forward.rb +24 -0
- data/lib/scribelite/models/inscribe.rb +189 -0
- data/lib/scribelite/schema.rb +76 -0
- data/lib/scribelite/version.rb +19 -0
- data/lib/scribelite.rb +142 -1
- metadata +107 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8f774ffec5b1c7a02d7ff82d92e7dea2ca83aa918f498fb2d24969870e26d819
|
|
4
|
+
data.tar.gz: cf9faa2257cb17c595a01685f2dc1b97d4d6fb315f7e65a8e2b6b9663d59872d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 272471a546baa300468d4dbc0558297930c12f20fd6447366dbd5b02bb6d34ff2aec04090731abcf7259447a389a1a0a20350c2c26659b95e2b9752808479f3d
|
|
7
|
+
data.tar.gz: 517b655428b5a043851c3bc0df41689648a9ca51839593d2f3a0284845a207e8570da852d36a165ef65fb6a6892ef1a0a5004490f4816823dd93d13cd977c6bb
|
data/CHANGELOG.md
CHANGED
data/Manifest.txt
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
require 'hoe'
|
|
2
|
-
|
|
2
|
+
require './lib/scribelite/version.rb'
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
Hoe.spec 'scribelite' do
|
|
6
|
-
self.version =
|
|
6
|
+
self.version = Scribelite::VERSION
|
|
7
7
|
|
|
8
|
-
self.summary = "scribelite - inscription / inscribe (ethscription calldata) database for ethereum & co; let's you query via sql and more"
|
|
8
|
+
self.summary = "scribelite gem - inscription / inscribe (ethscription calldata) database for ethereum & co; let's you query via sql and more"
|
|
9
9
|
self.description = summary
|
|
10
10
|
|
|
11
11
|
self.urls = { home: 'https://github.com/s6ruby/rubidity' }
|
|
@@ -19,6 +19,13 @@ Hoe.spec 'scribelite' do
|
|
|
19
19
|
|
|
20
20
|
self.extra_deps = [
|
|
21
21
|
['ethscribe'],
|
|
22
|
+
['activerecord'],
|
|
23
|
+
['activerecord-utils'],
|
|
24
|
+
['logutils'],
|
|
25
|
+
['logutils-activerecord'],
|
|
26
|
+
['props'],
|
|
27
|
+
['props-activerecord'],
|
|
28
|
+
['sqlite3'],
|
|
22
29
|
]
|
|
23
30
|
|
|
24
31
|
self.licenses = ['Public Domain']
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
module ScribeDb
|
|
3
|
+
module Model
|
|
4
|
+
|
|
5
|
+
class Calldata < ActiveRecord::Base
|
|
6
|
+
self.table_name = 'calldatas' ## check if infers data? why? why not?
|
|
7
|
+
|
|
8
|
+
belongs_to :inscribe, foreign_key: 'id'
|
|
9
|
+
|
|
10
|
+
=begin
|
|
11
|
+
def text
|
|
12
|
+
content.force_encoding(Encoding::UTF_8)
|
|
13
|
+
end
|
|
14
|
+
=end
|
|
15
|
+
end # class Calldata
|
|
16
|
+
|
|
17
|
+
end # module Model
|
|
18
|
+
end # module ScribeDb
|
|
19
|
+
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
### forward references
|
|
3
|
+
## require first to resolve circular references
|
|
4
|
+
|
|
5
|
+
module ScribeDb
|
|
6
|
+
module Model
|
|
7
|
+
|
|
8
|
+
#############
|
|
9
|
+
# ConfDb
|
|
10
|
+
Prop = ConfDb::Model::Prop
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class Inscribe < ActiveRecord::Base ; end
|
|
14
|
+
class Calldata < ActiveRecord::Base ; end
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
end # module Model
|
|
18
|
+
|
|
19
|
+
# note: convenience alias for Model
|
|
20
|
+
# lets you use include ScribeDb::Models
|
|
21
|
+
Models = Model
|
|
22
|
+
end # module ScribeDb
|
|
23
|
+
|
|
24
|
+
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
|
|
2
|
+
module ScribeDb
|
|
3
|
+
module Model
|
|
4
|
+
|
|
5
|
+
class Inscribe < ActiveRecord::Base
|
|
6
|
+
has_one :calldata, foreign_key: 'id'
|
|
7
|
+
|
|
8
|
+
## convernience helper
|
|
9
|
+
## forward to blob.content
|
|
10
|
+
## blob.content - encoding is BINARY (ASCII-7BIT)
|
|
11
|
+
## blob.text - force_encoding is UTF-8 (return a copy)
|
|
12
|
+
# def content() blob.content; end
|
|
13
|
+
# def text() blob.text; end
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
################################
|
|
17
|
+
### scope like helpers
|
|
18
|
+
def self.png() where( content_type: 'image/png' ); end
|
|
19
|
+
def self.gif() where( content_type: 'image/gif' ); end
|
|
20
|
+
def self.jpg() where( content_type: 'image/jpeg' ); end
|
|
21
|
+
def self.webp() where( content_type: 'image/webp' ); end
|
|
22
|
+
def self.svg() where( content_type: 'image/svg+xml' ); end
|
|
23
|
+
def self.avif() where( content_type: 'image/avif' ); end
|
|
24
|
+
|
|
25
|
+
class << self
|
|
26
|
+
alias_method :jpeg, :jpg
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def self.image
|
|
30
|
+
## change to/or add alias e.g. image/images - why? why not
|
|
31
|
+
where( content_type: [
|
|
32
|
+
'image/png',
|
|
33
|
+
'image/jpeg',
|
|
34
|
+
'image/gif',
|
|
35
|
+
'image/webp',
|
|
36
|
+
'image/svg+xml',
|
|
37
|
+
'image/avif',
|
|
38
|
+
])
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.html
|
|
42
|
+
where( content_type: [
|
|
43
|
+
'text/html;charset=utf-8',
|
|
44
|
+
'text/html',
|
|
45
|
+
])
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def self.js
|
|
49
|
+
where( content_type: [
|
|
50
|
+
'text/javascript',
|
|
51
|
+
'application/javascript',
|
|
52
|
+
])
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
class << self
|
|
56
|
+
alias_method :javascript, :js
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def self.text
|
|
60
|
+
## change to/or add alias e.g. text/texts - why? why not
|
|
61
|
+
## include html or svg in text-only inscription - why? why not?
|
|
62
|
+
## include markdown in text-only inscription - why? why not?
|
|
63
|
+
## make content_type lower case with lower() - why? why not?
|
|
64
|
+
where( content_type: [
|
|
65
|
+
'text/plain',
|
|
66
|
+
'text/plain;charset=utf-8',
|
|
67
|
+
'text/plain;charset=us-ascii',
|
|
68
|
+
'application/json',
|
|
69
|
+
])
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
=begin
|
|
73
|
+
def self.search( q ) ## "full-text" search helper
|
|
74
|
+
## rename to text_search - why? why not?
|
|
75
|
+
## auto-sort by num - why? why not?
|
|
76
|
+
joins(:blob).text.where( "content LIKE '%#{q}%'" ).order('num')
|
|
77
|
+
end
|
|
78
|
+
=end
|
|
79
|
+
|
|
80
|
+
def self.sub1k() where( 'num < 1000' ); end
|
|
81
|
+
def self.sub2k() where( 'num < 2000' ); end
|
|
82
|
+
def self.sub10k() where( 'num < 10000' ); end
|
|
83
|
+
def self.sub20k() where( 'num < 20000' ); end
|
|
84
|
+
def self.sub100k() where( 'num < 100000' ); end
|
|
85
|
+
def self.sub1m() where( 'num < 1000000' ); end
|
|
86
|
+
def self.sub2m() where( 'num < 2000000' ); end
|
|
87
|
+
def self.sub10m() where( 'num < 10000000' ); end
|
|
88
|
+
def self.sub20m() where( 'num < 20000000' ); end
|
|
89
|
+
def self.sub21m() where( 'num < 21000000' ); end
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def self.largest
|
|
93
|
+
order( 'bytes DESC' )
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def self.content_type_counts
|
|
97
|
+
group( 'content_type' )
|
|
98
|
+
.order( Arel.sql( 'COUNT(*) DESC, content_type')).count
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
class << self
|
|
102
|
+
alias_method :biggest, :largest
|
|
103
|
+
alias_method :counts_by_content_type, :content_type_counts
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
###
|
|
107
|
+
# instance methods
|
|
108
|
+
def extname
|
|
109
|
+
## map mime type to file extname
|
|
110
|
+
## see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
|
|
111
|
+
## for real-world usage, see https://dune.com/dgtl_assets/bitcoin-ordinals-analysis
|
|
112
|
+
## https://github.com/casey/ord/blob/master/src/media.rs
|
|
113
|
+
|
|
114
|
+
if content_type.start_with?( 'text/plain' )
|
|
115
|
+
'.txt'
|
|
116
|
+
elsif content_type.start_with?( 'text/markdown' )
|
|
117
|
+
'.md'
|
|
118
|
+
elsif content_type.start_with?( 'text/html' )
|
|
119
|
+
'.html'
|
|
120
|
+
elsif content_type.start_with?( 'text/javascript' ) ||
|
|
121
|
+
content_type.start_with?( 'application/javascript' )
|
|
122
|
+
## note: application/javascript is considered bad practice/legacy
|
|
123
|
+
'.js'
|
|
124
|
+
elsif content_type.start_with?( 'image/png' )
|
|
125
|
+
## Portable Network Graphics (PNG)
|
|
126
|
+
'.png'
|
|
127
|
+
elsif content_type.start_with?( 'image/jpeg' )
|
|
128
|
+
## Joint Photographic Expert Group image (JPEG)
|
|
129
|
+
'.jpg' ## use jpeg - why? why not?
|
|
130
|
+
elsif content_type.start_with?( 'image/webp' )
|
|
131
|
+
## Web Picture format (WEBP)
|
|
132
|
+
'.webp' ## note: no three-letter extension available
|
|
133
|
+
elsif content_type.start_with?( 'image/svg' )
|
|
134
|
+
## Scalable Vector Graphics (SVG)
|
|
135
|
+
'.svg'
|
|
136
|
+
elsif content_type.start_with?( 'image/gif' )
|
|
137
|
+
## Graphics Interchange Format (GIF)
|
|
138
|
+
'.gif'
|
|
139
|
+
elsif content_type.start_with?( 'image/avif' )
|
|
140
|
+
## AV1 Image File Format (AVIF)
|
|
141
|
+
'.avif'
|
|
142
|
+
elsif content_type.start_with?( 'application/epub' )
|
|
143
|
+
'.epub'
|
|
144
|
+
elsif content_type.start_with?( 'application/pdf' )
|
|
145
|
+
'.pdf'
|
|
146
|
+
elsif content_type.start_with?( 'application/json' )
|
|
147
|
+
'.json'
|
|
148
|
+
elsif content_type.start_with?( 'application/pgp-signature' )
|
|
149
|
+
'.sig'
|
|
150
|
+
elsif content_type.start_with?( 'audio/mpeg' )
|
|
151
|
+
'.mp3'
|
|
152
|
+
elsif content_type.start_with?( 'audio/midi' )
|
|
153
|
+
'.midi'
|
|
154
|
+
elsif content_type.start_with?( 'video/mp4' )
|
|
155
|
+
'.mp4'
|
|
156
|
+
elsif content_type.start_with?( 'video/webm' )
|
|
157
|
+
'.wepm'
|
|
158
|
+
elsif content_type.start_with?( 'audio/mod' )
|
|
159
|
+
## is typo? possible? only one inscription in 20m?
|
|
160
|
+
'.mod' ## check/todo/fix if is .wav??
|
|
161
|
+
else
|
|
162
|
+
puts "!! ERROR - no file extension configured for content type >#{content_type}<; sorry:"
|
|
163
|
+
pp self
|
|
164
|
+
exit 1
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
=begin
|
|
169
|
+
def export_path ## default export path
|
|
170
|
+
numstr = "%08d" % num ### e.g. 00000001
|
|
171
|
+
"./tmp/#{numstr}#{extname}"
|
|
172
|
+
end
|
|
173
|
+
def export( path=export_path )
|
|
174
|
+
if blob
|
|
175
|
+
write_blob( path, blob.content )
|
|
176
|
+
else
|
|
177
|
+
## todo/fix: raise exception - no content
|
|
178
|
+
puts "!! ERROR - inscribe has no content (blob); sorry:"
|
|
179
|
+
pp self
|
|
180
|
+
exit 1
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
=end
|
|
184
|
+
|
|
185
|
+
end # class Inscribe
|
|
186
|
+
|
|
187
|
+
end # module Model
|
|
188
|
+
end # module ScribeDb
|
|
189
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
module ScribeDb
|
|
4
|
+
|
|
5
|
+
class CreateDb
|
|
6
|
+
|
|
7
|
+
def up
|
|
8
|
+
|
|
9
|
+
ActiveRecord::Schema.define do
|
|
10
|
+
|
|
11
|
+
create_table :inscribes, :id => :string do |t|
|
|
12
|
+
## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0",
|
|
13
|
+
## note: change to uuid (universally unique id) - why? why not?
|
|
14
|
+
## id gets used by row_id (internal orm db machinery) and is int
|
|
15
|
+
## t.string :uuid, null: false, index: { unique: true, name: 'inscribe_uuids' }
|
|
16
|
+
|
|
17
|
+
## "title": "Inscription 10371414",
|
|
18
|
+
## note: use num/no. from title only - why? why not?
|
|
19
|
+
t.integer :num, null: false, index: { unique: true, name: 'inscribe_nums' }
|
|
20
|
+
|
|
21
|
+
## "content length": "85 bytes",
|
|
22
|
+
## note: extract bytes as integer!!!
|
|
23
|
+
## change to bytes - why? why not?
|
|
24
|
+
t.integer :bytes
|
|
25
|
+
## "content type": "text/plain;charset=utf-8",
|
|
26
|
+
## note: make sure always lower/down case!!!
|
|
27
|
+
t.string :content_type
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## add allow duplicate opt-in protocol flag e.g. esip6
|
|
31
|
+
## t.boolean :duplicate -
|
|
32
|
+
|
|
33
|
+
## timestamp last
|
|
34
|
+
t.timestamps
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
## change to tx/txs or txn/txns - why? why not?
|
|
39
|
+
|
|
40
|
+
create_table :calldatas, :id => :string do |t|
|
|
41
|
+
## "id": "0a3a4dbf6630338bc4df8e36bd081f8f7d2dee9441131cb03a18d43eb4882d5ci0",
|
|
42
|
+
## note: change to uuid (universally unique id) - why? why not?
|
|
43
|
+
## id gets used by row_id (internal orm db machinery) and is int
|
|
44
|
+
## t.string :id, null: false, index: { unique: true, name: 'blob_uuids' }
|
|
45
|
+
|
|
46
|
+
t.binary :data # , null: false
|
|
47
|
+
t.string :sha # , null: false ## sha hash as hexstring
|
|
48
|
+
|
|
49
|
+
## "timestamp": "2023-06-01 05:00:57 UTC"
|
|
50
|
+
## or use date_utc ???
|
|
51
|
+
## or change to t.integer AND timestamp or time or epoch(time) - why? why not?
|
|
52
|
+
t.datetime :date, null: false
|
|
53
|
+
|
|
54
|
+
t.integer :block, null: false
|
|
55
|
+
t.integer :fee
|
|
56
|
+
t.integer :value
|
|
57
|
+
|
|
58
|
+
###
|
|
59
|
+
## "address": "bc1p3h4eecuxjj2g72sq38gyva732866u5w29lhxgeqfe6c0sg8xmagsuau63k",
|
|
60
|
+
## is this minter/inscriber addr???
|
|
61
|
+
## change to minter?? or such - why? why not?
|
|
62
|
+
## creator
|
|
63
|
+
t.string :from, null: false
|
|
64
|
+
|
|
65
|
+
## add to address too - why? why not?
|
|
66
|
+
t.string :to
|
|
67
|
+
## timestamp last
|
|
68
|
+
t.timestamps
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
end # block Schema.define
|
|
72
|
+
|
|
73
|
+
end # method up
|
|
74
|
+
end # class CreateDb
|
|
75
|
+
|
|
76
|
+
end # module ScribeDb
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
|
|
2
|
+
module Scribelite
|
|
3
|
+
MAJOR = 0 ## todo: namespace inside version or something - why? why not??
|
|
4
|
+
MINOR = 1
|
|
5
|
+
PATCH = 0
|
|
6
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
|
7
|
+
|
|
8
|
+
def self.version
|
|
9
|
+
VERSION
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.banner
|
|
13
|
+
"scribelite/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}] in >#{root}<"
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.root
|
|
17
|
+
File.expand_path( File.dirname(File.dirname(File.dirname(__FILE__))) )
|
|
18
|
+
end
|
|
19
|
+
end
|
data/lib/scribelite.rb
CHANGED
|
@@ -1,4 +1,145 @@
|
|
|
1
1
|
|
|
2
|
+
# core and stlibs
|
|
3
|
+
require 'ethscribe' ## will pull-in cocos & friends
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
require 'logger' # Note: use for ActiveRecord::Base.logger -- remove/replace later w/ LogUtils::Logger ???
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# 3rd party gems / libs
|
|
11
|
+
require 'props' # see github.com/rubylibs/props
|
|
12
|
+
require 'logutils' # see github.com/rubylibs/logutils
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
require 'active_record' ## todo: add sqlite3? etc.
|
|
16
|
+
|
|
17
|
+
## add more activerecords addons/utils
|
|
18
|
+
# require 'tagutils'
|
|
19
|
+
require 'activerecord/utils'
|
|
20
|
+
require 'props/activerecord' # includes ConfDb (ConfDb::Model::Prop, etc.)
|
|
21
|
+
require 'logutils/activerecord' # includes LogDb (LogDb::Model::Log, etc.)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# our own code
|
|
26
|
+
require_relative 'scribelite/version' # always goes first
|
|
27
|
+
|
|
28
|
+
require_relative 'scribelite/models/forward'
|
|
29
|
+
|
|
30
|
+
require_relative 'scribelite/models/inscribe'
|
|
31
|
+
require_relative 'scribelite/models/calldata'
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
require_relative 'scribelite/schema'
|
|
35
|
+
|
|
36
|
+
# require_relative 'cache'
|
|
37
|
+
# require_relative 'importer' ## note: require (soft dep) ordinals gems!!!
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
module ScribeDb
|
|
43
|
+
|
|
44
|
+
def self.create
|
|
45
|
+
CreateDb.new.up
|
|
46
|
+
ConfDb::Model::Prop.create!( key: 'db.schema.scribe.version',
|
|
47
|
+
value: Scribelite::VERSION )
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def self.create_all
|
|
51
|
+
LogDb.create # add logs table
|
|
52
|
+
ConfDb.create # add props table
|
|
53
|
+
ScribeDb.create
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def self.auto_migrate!
|
|
57
|
+
### todo/fix:
|
|
58
|
+
## check props table and versions!!!!!
|
|
59
|
+
|
|
60
|
+
# first time? - auto-run db migratation, that is, create db tables
|
|
61
|
+
unless LogDb::Model::Log.table_exists?
|
|
62
|
+
LogDb.create # add logs table
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
unless ConfDb::Model::Prop.table_exists?
|
|
66
|
+
ConfDb.create # add props table
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
unless ScribeDb::Model::Inscribe.table_exists?
|
|
70
|
+
ScribeDb.create
|
|
71
|
+
end
|
|
72
|
+
end # method auto_migrate!
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def self.open( database='./scribe.db' ) ## convenience helper for sqlite only
|
|
76
|
+
connect( adapter: 'sqlite3',
|
|
77
|
+
database: database )
|
|
78
|
+
|
|
79
|
+
## build schema if database new/empty
|
|
80
|
+
auto_migrate!
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def self.connect( config={} )
|
|
86
|
+
|
|
87
|
+
if config.empty?
|
|
88
|
+
puts "ENV['DATBASE_URL'] - >#{ENV['DATABASE_URL']}<"
|
|
89
|
+
|
|
90
|
+
### change default to ./scribe.db ?? why? why not?
|
|
91
|
+
db = URI.parse( ENV['DATABASE_URL'] || 'sqlite3:///scribe.db' )
|
|
92
|
+
|
|
93
|
+
if db.scheme == 'postgres'
|
|
94
|
+
config = {
|
|
95
|
+
adapter: 'postgresql',
|
|
96
|
+
host: db.host,
|
|
97
|
+
port: db.port,
|
|
98
|
+
username: db.user,
|
|
99
|
+
password: db.password,
|
|
100
|
+
database: db.path[1..-1],
|
|
101
|
+
encoding: 'utf8'
|
|
102
|
+
}
|
|
103
|
+
else # assume sqlite3
|
|
104
|
+
config = {
|
|
105
|
+
adapter: db.scheme, # sqlite3
|
|
106
|
+
database: db.path[1..-1] # scribe.db (NB: cut off leading /, thus 1..-1)
|
|
107
|
+
}
|
|
108
|
+
end
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
puts "Connecting to db using settings: "
|
|
112
|
+
pp config
|
|
113
|
+
ActiveRecord::Base.establish_connection( config )
|
|
114
|
+
# ActiveRecord::Base.logger = Logger.new( STDOUT )
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def self.setup_in_memory_db
|
|
119
|
+
|
|
120
|
+
# Database Setup & Config
|
|
121
|
+
ActiveRecord::Base.logger = Logger.new( STDOUT )
|
|
122
|
+
## ActiveRecord::Base.colorize_logging = false - no longer exists - check new api/config setting?
|
|
123
|
+
|
|
124
|
+
self.connect( adapter: 'sqlite3',
|
|
125
|
+
database: ':memory:' )
|
|
126
|
+
|
|
127
|
+
## build schema
|
|
128
|
+
ScribeDb.create_all
|
|
129
|
+
end # setup_in_memory_db (using SQLite :memory:)
|
|
130
|
+
|
|
131
|
+
end # module ScribeDb
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
## add convenience helpers
|
|
139
|
+
Inscribe = ScribeDb::Model::Inscribe
|
|
140
|
+
Calldata = ScribeDb::Model::Calldata
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# say hello
|
|
144
|
+
puts Scribelite.banner ## if defined?($RUBYCOCOS_DEBUG) && $RUBCOCOS_DEBUG
|
|
4
145
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: scribelite
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gerald Bauer
|
|
@@ -24,6 +24,104 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: activerecord
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: activerecord-utils
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - ">="
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: logutils
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: logutils-activerecord
|
|
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: props
|
|
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'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: props-activerecord
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - ">="
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '0'
|
|
104
|
+
type: :runtime
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - ">="
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: sqlite3
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :runtime
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
27
125
|
- !ruby/object:Gem::Dependency
|
|
28
126
|
name: rdoc
|
|
29
127
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -58,7 +156,7 @@ dependencies:
|
|
|
58
156
|
- - "~>"
|
|
59
157
|
- !ruby/object:Gem::Version
|
|
60
158
|
version: '4.0'
|
|
61
|
-
description: scribelite - inscription / inscribe (ethscription calldata) database
|
|
159
|
+
description: scribelite gem - inscription / inscribe (ethscription calldata) database
|
|
62
160
|
for ethereum & co; let's you query via sql and more
|
|
63
161
|
email: gerald.bauer@gmail.com
|
|
64
162
|
executables: []
|
|
@@ -73,6 +171,11 @@ files:
|
|
|
73
171
|
- README.md
|
|
74
172
|
- Rakefile
|
|
75
173
|
- lib/scribelite.rb
|
|
174
|
+
- lib/scribelite/models/calldata.rb
|
|
175
|
+
- lib/scribelite/models/forward.rb
|
|
176
|
+
- lib/scribelite/models/inscribe.rb
|
|
177
|
+
- lib/scribelite/schema.rb
|
|
178
|
+
- lib/scribelite/version.rb
|
|
76
179
|
homepage: https://github.com/s6ruby/rubidity
|
|
77
180
|
licenses:
|
|
78
181
|
- Public Domain
|
|
@@ -97,6 +200,6 @@ requirements: []
|
|
|
97
200
|
rubygems_version: 3.4.10
|
|
98
201
|
signing_key:
|
|
99
202
|
specification_version: 4
|
|
100
|
-
summary: scribelite - inscription / inscribe (ethscription calldata) database
|
|
101
|
-
ethereum & co; let's you query via sql and more
|
|
203
|
+
summary: scribelite gem - inscription / inscribe (ethscription calldata) database
|
|
204
|
+
for ethereum & co; let's you query via sql and more
|
|
102
205
|
test_files: []
|