dyndoc-ruby-core 1.2.5 → 1.2.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
  SHA1:
3
- metadata.gz: 6fca389823485e0db54ce3b7f9ec1582f28c2f31
4
- data.tar.gz: e09a282bcb037243f5414b123ae962d16df5139f
3
+ metadata.gz: 959ac04a47a0a747a74d9fc9412693de2f16e3bb
4
+ data.tar.gz: 1656c0ea29f80098f637aaf16b66774728e6d59a
5
5
  SHA512:
6
- metadata.gz: 0e5a6ac0ce89d9ee738a6144c4e9d7568cbce05e384ca350a3263fd9cb256a8e6393e1d1880d4a44b8668251d2bf8e193c0487ce39d413ea2c047b9eb12f502f
7
- data.tar.gz: 29d60202888c1f07ae9f094213a84f4c2837ecceb4496f23a9ff2c4acc406eb41f3bfebf081f9e1f732d0e200422a27dd977cd0a27c8fc0235b8032f3c9e0810
6
+ metadata.gz: 92513ff73b9d2028e87848b27b8b8a9124d1a0c80e1c36574d3caf3cb9b1da7e942c8d6c549d8ee0bb972a1bbabcbb82bbc268fa10f4d78a56b3052789a61e83
7
+ data.tar.gz: 2e0f677656d6b279cc85d4b7eda91740ee774b25702f01070e7b435fca73fe4df12993195a474600b6b050ba5df037f405b40b0093ae6be1e8295b3a209aeaa1
@@ -60,5 +60,8 @@ Settings.resolve!
60
60
  require 'dyndoc/init/config'
61
61
  Dyndoc.init_dyndoc_library_path
62
62
  Dyndoc.init_rootDoc
63
+ Dyndoc.add_logger
64
+ Dyndoc.logger.info("dyndoc-core loaded!")
65
+ ## Dyndoc.logger.info(".dyndoc.yml: "+File.join(ENV["HOME"],".dyndoc.yml"))
63
66
 
64
67
  CqlsDoc=Dyndoc #for compatibity
@@ -818,7 +818,7 @@ module Dyndoc
818
818
  ## Dyndoc.warn "JLServer.inputsAndOutputs",res
819
819
  res.map!{|input,output,output2,error,error2|
820
820
  {:input=>input,:output=>output,:output2=>output2,:error=>error,:error2=>error2}
821
- } if hash
821
+ } if res and hash
822
822
  res
823
823
  end
824
824
 
@@ -77,23 +77,30 @@ module Dyndoc
77
77
  if RUBY_PLATFORM =~ /mingw/
78
78
  require File.join(ENV["DYNDOC_HOME"],"bin","msys2","file_tools.rb") if ENV["DYNDOC_HOME"]
79
79
  end
80
+ Dyndoc.logger.info "R initialized inside dyndoc!"
80
81
  end
81
82
 
82
83
  def TemplateManager.initJulia
84
+ Dyndoc.logger.info "initJulia: first"
83
85
  first=require "jl4rb" #save if it the first initialization!
86
+ Dyndoc.logger.info "initJulia: require"
84
87
  Julia.init
88
+ Dyndoc.logger.info "initJulia: init"
85
89
  # init rb4jl stuff
86
90
  # since inside ruby, no need Ruby.start and Ruby.stop like in rb4R.
87
91
  # sort of equivalent of JLServer.init_filter (but not yet defined)!
88
92
  Julia << "include(\""+File.join(Dyndoc.cfg_dir[:gem_path],"share","julia","ruby.jl")+"\")"
93
+ Dyndoc.logger.info "initJulia: ruby.jl"
89
94
  Julia << "include(\""+File.join(Dyndoc.cfg_dir[:gem_path],"share","julia","dynArray.jl")+"\")"
95
+ Dyndoc.logger.info "initJulia: dynArray.jl"
90
96
  #-| To debug ruby.jl and dynArray.jl => uncomment below and commnt above
91
97
  # Julia << "include(\""+File.expand_path("~/Github/dyndoc/share/julia/ruby.jl")+"\")"
92
98
  # Julia << "include(\""+File.expand_path("~/Github/dyndoc/share/julia/dynArray.jl")+"\")"
93
99
  Julia << "using Dyndoc"
100
+ Dyndoc.logger.info "initJulia: using Dyndoc"
94
101
  Julia << "Ruby.alive(true)"
95
102
  #Julia << "global const _dynArray=DynArray()"
96
- Dyndoc.warn "Julia initialized inside dyndoc!"
103
+ Dyndoc.logger.info "Julia initialized inside dyndoc!"
97
104
 
98
105
  end
99
106
 
@@ -19,7 +19,7 @@ module Dyndoc
19
19
  }
20
20
 
21
21
  require 'logger'
22
- @@dyn_logger = Logger.new @@cfg_dir[:log_file], 7, 1048576
22
+ @@dyn_logger = nil
23
23
 
24
24
  def Dyndoc.cfg_dir
25
25
  @@cfg_dir
@@ -29,10 +29,18 @@ module Dyndoc
29
29
  Settings[:cfg_dyn]
30
30
  end
31
31
 
32
+ def Dyndoc.add_logger
33
+ @@dyn_logger = Logger.new(@@cfg_dir[:log_file], 7, 1048576)
34
+ end
35
+
32
36
  def Dyndoc.logger
33
37
  @@dyn_logger
34
38
  end
35
39
 
40
+ def Dyndoc.logger_info(txt)
41
+ @@dyn_logger.info(txt)
42
+ end
43
+
36
44
  @@dyn_block={}
37
45
 
38
46
  def Dyndoc.dyn_block
@@ -8,14 +8,14 @@ importall Ruby
8
8
  export DynVector,DynArray,getindex,setindex!,show,Vector,sync,getkey
9
9
 
10
10
  # this is just a wrapper of Vector type with update of all connected vectors
11
- # when change on the vector occurs
11
+ # when change on the vector occurs
12
12
 
13
13
 
14
14
  type DynVector
15
15
  ary::Vector
16
- key::ASCIIString
16
+ key::String
17
17
 
18
- DynVector(a::Vector,k::ASCIIString)=(x=new();x.ary=a;x.key=k;x)
18
+ DynVector(a::Vector,k::String)=(x=new();x.ary=a;x.key=k;x)
19
19
  end
20
20
 
21
21
  function getindex(dynvect::DynVector,i::Integer)
@@ -26,8 +26,8 @@ end
26
26
  function setindex!(dynvect::DynVector,value,i::Integer)
27
27
  dynvect.ary[i]=value
28
28
  ## println("inisde vect:",Ruby.alive())
29
- if Ruby.alive()
30
- Ruby.run("Dyndoc::Vector[\""*dynvect.key*"\"].sync(:jl)")
29
+ if Ruby.alive()
30
+ Ruby.run("Dyndoc::Vector[\""*dynvect.key*"\"].sync(:jl)")
31
31
  end
32
32
  end
33
33
 
@@ -43,18 +43,18 @@ end
43
43
 
44
44
  global const Vec=DynArray()
45
45
 
46
- function getindex(dynary::DynArray,key::ASCIIString)
46
+ function getindex(dynary::DynArray,key::String)
47
47
  #println("getindex(" * key * ")->todo")
48
48
  #if Ruby.alive()
49
49
  #println("getindex(" * key * ")->to sync")
50
- #Ruby.run("Dyndoc::Vector[\""*key*"\"].sync_to(:jl)")
50
+ #Ruby.run("Dyndoc::Vector[\""*key*"\"].sync_to(:jl)")
51
51
  #end
52
52
  #println("getindex(" * key * ")->done")
53
53
  dynary.vars[key]
54
54
  end
55
55
  getindex(dynary::DynArray,key::Symbol)=getindex(dynary,string(key))
56
56
 
57
- function setindex!(dynary::DynArray,value,key::ASCIIString)
57
+ function setindex!(dynary::DynArray,value,key::String)
58
58
  #println("key:" * key)
59
59
  #println(keys(dynary.vars))
60
60
  if(haskey(dynary.vars,key))
@@ -65,7 +65,7 @@ function setindex!(dynary::DynArray,value,key::ASCIIString)
65
65
  end
66
66
 
67
67
  ## println("inside array:",Ruby.alive())
68
-
68
+
69
69
  if Ruby.alive()
70
70
  Ruby.run("Dyndoc::Vector[\""*key*"\"].sync(:jl)")
71
71
  end
@@ -73,13 +73,13 @@ end
73
73
  setindex!(dynary::DynArray,value,key::Symbol)=setindex!(dynary,value,string(key))
74
74
 
75
75
 
76
- sync(dynary::DynArray,key::ASCIIString)= if Ruby.alive() Ruby.run("Dyndoc::Vector[\""*key*"\"].sync(:jl)") end
76
+ sync(dynary::DynArray,key::String)= if Ruby.alive() Ruby.run("Dyndoc::Vector[\""*key*"\"].sync(:jl)") end
77
77
 
78
78
  show(io::IO,dynary::DynArray)=show(io,dynary.vars)
79
79
 
80
80
  # NO MORE KEY WITH THE FORM "<name>@<ruby id object>"
81
81
  # function getkey(dynary::DynArray,k::Symbol)
82
- # for k2 in keys(dynary.vars)
82
+ # for k2 in keys(dynary.vars)
83
83
  # if split(k2,"@")[1] == string(k)
84
84
  # return k2
85
85
  # end
@@ -90,4 +90,3 @@ show(io::IO,dynary::DynArray)=show(io,dynary.vars)
90
90
  # setindex!(dynary::DynArray,value,key::Symbol)=setindex!(dynary,value,getkey(dynary,key))
91
91
 
92
92
  end
93
-
@@ -95,12 +95,12 @@ function capture_julia(cmd::AbstractString)
95
95
  try
96
96
  result=eval(DyndocSandbox, pcmd0)
97
97
  catch e
98
- #io = IOBuffer()
99
- #print(io, "ERROR: ")
100
- #Base.error_show(io, e)
101
- error = "Error: $(string(e))"
102
- #close(io)
103
- end
98
+ #io = IOBuffer()
99
+ #print(io, "ERROR: ")
100
+ #Base.error_show(io, e)
101
+ error = "Error: $(string(e))"
102
+ #close(io)
103
+ end
104
104
  push!(res,(join(cmd0,"\n"),string(result),get_stdout_iobuffer(),error,get_stderr_iobuffer()))
105
105
  cmd0=AbstractString[]
106
106
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ruby
4
4
 
5
- librb=Libdl.dlopen(("JULIA_RUBYLIB_PATH" in keys(ENV)) ? ENV["JULIA_RUBYLIB_PATH"] : "libruby")
5
+ librb=Libdl.dlopen(("JULIA_RUBYLIB_PATH" in keys(ENV)) ? ENV["JULIA_RUBYLIB_PATH"] : "/usr/lib/libruby")
6
6
 
7
7
  export start,stop,run,alive
8
8
 
@@ -22,7 +22,7 @@ module Ruby
22
22
  function run(code::AbstractString)
23
23
  state=1 #not modified then
24
24
  ##println(code)
25
- res=ccall(Libdl.dlsym(librb,:rb_eval_string_protect),Ptr{UInt64},(Ptr{UInt8},Ptr{UInt32}),bytestring(code),&state)
25
+ res=ccall(Libdl.dlsym(librb,:rb_eval_string_protect),Ptr{UInt64},(Ptr{UInt8},Ptr{UInt32}),string(code),&state)
26
26
  return nothing
27
27
  end
28
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyndoc-ruby-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5
4
+ version: 1.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - CQLS
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-24 00:00:00.000000000 Z
11
+ date: 2017-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: configliere