atome 0.5.6.5.4 → 0.5.6.5.6

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: 40ed4954cd1a97e3ebffa9a25d44de095ea8f1b825b91abab913ce9cf61535f6
4
- data.tar.gz: c6da10feae807b7e738065951de242abfd3dcb31558552d2f47135bd41e67433
3
+ metadata.gz: 4cb4ad31800f2839731ecb9b8e3c5c3c26d465fc891c0817b5acf65e527e63dd
4
+ data.tar.gz: 7490da0ea3f399b707878c17d0602b9091ec4a572158eb008d0911dfecff6aa0
5
5
  SHA512:
6
- metadata.gz: 496ec64689699de33f6538034ba9ace545628ae2fcaa996521c747ffbb89d86461de0ac35580052d93ed1feb0518954cefc2e07afd6cab33f672ea44785ea299
7
- data.tar.gz: 102a1c8266be193f3781154a597c1715e906e1da63f7df1e070e50c399f078a651947bc5f39d5f4f3a9423833fc0a7966dada61dc1199d280f086061dbe1bdce
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
- params = { data: params } unless params.instance_of? Hash
11
- # params[:user] = 'dfghg4df5gdfgh654'
12
- # params[:pass] = 'gfhkzrhgzr4h98948'
13
- # instance_variable_set('@message_code', {}) unless instance_variable_get('@message_code')
14
- # store_proc= instance_variable_get('@message_code')
15
- message_id= "msg_#{Universe.messages.length}"
16
- params[:message_id]=message_id
17
- # store_proc[mmessage_id]=bloc
18
- Universe.store_messages({msg_nb:message_id, proc: bloc })
19
- html.send_message(params)
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
@@ -2,5 +2,5 @@
2
2
 
3
3
  # return atome version
4
4
  class Atome
5
- VERSION = '0.5.6.5.4'
5
+ VERSION = '0.5.6.5.6'
6
6
  end
@@ -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
- Database.create_table(table)
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.6.5.4
4
+ version: 0.5.6.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Eric Godard