atome 0.5.6.5.4 → 0.5.6.5.6
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/lib/atome/genesis/particles/communication.rb +10 -10
- data/lib/atome/genesis/sparkle.rb +1 -1
- data/lib/atome/kernel/universe.rb +0 -2
- data/lib/atome/utilities/utilities.rb +0 -2
- data/lib/atome/version.rb +1 -1
- data/vendor/assets/server/database.rb +16 -2
- data/vendor/assets/server/eDen.rb +3 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4cb4ad31800f2839731ecb9b8e3c5c3c26d465fc891c0817b5acf65e527e63dd
|
4
|
+
data.tar.gz: 7490da0ea3f399b707878c17d0602b9091ec4a572158eb008d0911dfecff6aa0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 504badf83293f83cd268507f2f0a66c5ed4e88d832206148a534bd5bbe170745193f2777fadd118fb9c6adb91fc8ee78ef0646f83898c43b1bc3e7da4f7e7b7e
|
7
|
+
data.tar.gz: 2051f9abb344566e84a5b9a934b7f575adc1b7ea56af8513d2c51f40d7e0768e247cefdda643a02a9a8ec43b4ea3dbef2555ae804a97c5435fa3e688bb916cee
|
@@ -7,16 +7,16 @@ new({ particle: :connection, category: :communication, type: :hash }) do |params
|
|
7
7
|
end
|
8
8
|
|
9
9
|
new({ particle: :message, category: :communication, type: :hash }) do |params, bloc|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
10
|
+
if Universe.database_ready
|
11
|
+
params = { data: params } unless params.instance_of? Hash
|
12
|
+
message_id= "msg_#{Universe.messages.length}"
|
13
|
+
params[:message_id]=message_id
|
14
|
+
Universe.store_messages({msg_nb:message_id, proc: bloc })
|
15
|
+
html.send_message(params)
|
16
|
+
else
|
17
|
+
puts "server not ready "
|
18
|
+
end
|
19
|
+
|
20
20
|
|
21
21
|
end
|
22
22
|
|
@@ -162,7 +162,7 @@ def init_database # this method is call from JS (atome/communication) at WS conn
|
|
162
162
|
|
163
163
|
particles = Universe.particle_list
|
164
164
|
# now we populate the DB
|
165
|
-
A.sync({ action: :crate_db_table, data: { table: :user } }) do |_db_state|
|
165
|
+
A.sync({ action: :crate_db_table, data: { table: :user, type: :string } }) do |_db_state|
|
166
166
|
# puts "===> #{_db_state}"
|
167
167
|
end
|
168
168
|
|
@@ -243,9 +243,7 @@ class Universe
|
|
243
243
|
def historicize(id, operation, element, params)
|
244
244
|
|
245
245
|
if @allow_history && @database_ready
|
246
|
-
# sync
|
247
246
|
A.sync({ action: :historicize, data: { table: :user } }) do |_db_state|
|
248
|
-
# puts "===> #{_db_state}"
|
249
247
|
end
|
250
248
|
operation_timing = Time.now.strftime("%Y%m%d%H%M%S%3N") + @increment.to_s
|
251
249
|
@increment += 1
|
@@ -306,8 +306,6 @@ class Atome
|
|
306
306
|
|
307
307
|
def refresh
|
308
308
|
# we get the current color because they will be removed
|
309
|
-
# prev_color=color
|
310
|
-
# alert color.class
|
311
309
|
particles_found = to_hash
|
312
310
|
particles_found.each do |particle_found, value_found|
|
313
311
|
send(particle_found, value_found)
|
data/lib/atome/version.rb
CHANGED
@@ -9,11 +9,25 @@ class Database
|
|
9
9
|
Sequel.connect("sqlite://eden.sqlite3")
|
10
10
|
end
|
11
11
|
|
12
|
-
def create_table(table_name)
|
12
|
+
def create_table(table_name, type)
|
13
13
|
eden = Sequel.connect("sqlite://eden.sqlite3")
|
14
|
+
type= case type
|
15
|
+
|
16
|
+
when 'string'
|
17
|
+
String
|
18
|
+
when 'int'
|
19
|
+
Integer
|
20
|
+
when 'hash'
|
21
|
+
JSON
|
22
|
+
when 'date'
|
23
|
+
DateTime
|
24
|
+
else
|
25
|
+
Integer
|
26
|
+
end
|
14
27
|
unless eden.table_exists?(table_name)
|
15
28
|
eden.create_table table_name.to_sym do
|
16
|
-
primary_key "#{table_name}_id".to_sym
|
29
|
+
# primary_key "#{table_name}_id".to_sym
|
30
|
+
column "#{table_name}_id".to_sym, type, primary_key: true
|
17
31
|
end
|
18
32
|
end
|
19
33
|
end
|
@@ -101,7 +101,9 @@ class EDen
|
|
101
101
|
|
102
102
|
def crate_db_table(data, message_id)
|
103
103
|
table = data['table']
|
104
|
-
|
104
|
+
type = data['type']
|
105
|
+
primary = data['primary']
|
106
|
+
Database.create_table(table, type)
|
105
107
|
{ data: { message: "table #{table} added" }, message_id: message_id }
|
106
108
|
end
|
107
109
|
|