universa 0.1.1 → 0.1.2

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: 6b0550e986188ea0c6777ed4e08112e5cbf3605b7247b11ee939a5c8b3944fcf
4
- data.tar.gz: 56278bf8d1271447de7acde7cf85c98086c994f3635b966c104d00cb5cbb1fa6
3
+ metadata.gz: ed104de6164cf27de489c0876518ee3394a9fb9c99a0914e6583a4f39f571942
4
+ data.tar.gz: b86327d0d5177c6f0f1d9d49e02f2689da2315a15f844458420104427200915b
5
5
  SHA512:
6
- metadata.gz: 3f1b071d7ae76fed9b9879ed03e4a106f614f1a4c420e58c8b7e3e23b84b9f3b87688c9eece8a4c7485e411f49388e23d9c76da90579721f00c5bff98f6f67dc
7
- data.tar.gz: 4da0d67c5ada6d480fa3868294993a55c2db072f29e1982f57d26c1402c59a3099967cc3d006ba097fa5e72bdc775d580a4c8869cfe8dcff5085f483b60f3715
6
+ metadata.gz: 0335ca25f8c9e002f15b482bf0e0bc96c10cb6f77343dae4df2101ade54855e63a8ef407a0021a95c84dfa0f4bebaca21141881922071967bca7747b60a9a276
7
+ data.tar.gz: e8e54f3825441507640af2ce38dea63aa6ac25bc770be5f11f5f2b908215f3e066d6759c5ea02afa5a61c3153d3002b00c22affe1d49a57308997f61026b1729
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Alfa state: direct access to Java API ready for test.
4
4
 
5
- This is an under-construction official gem from [Universa][universa] that will facilitate access to the
5
+ This is an under-construction official gem from [Universa][universa] to facilitate access to the
6
6
  Java library using Universa's UMI protocol.
7
7
 
8
8
  ## Installation
@@ -36,12 +36,16 @@ require 'universa'
36
36
 
37
37
  umi = Universa::UMI.new
38
38
 
39
- p umi.version #=> "0.8.7"
39
+ p umi.version #=> "0.8.8"
40
40
  key = umi.instantiate "PrivateKey", 2048
41
41
  contract = umi.instantiate "Contract", key
42
42
  sealed = contract.seal()
43
43
  puts "Contract is ok: #{contract.check()}" #=> contract is ok: true"
44
44
  puts "Contract id: #{contract.getId.toBase64String}" #=> contract id: x9Ey+q...
45
+
46
+ # ruby-style snake case could also be used:
47
+ contract_id = contract.get_id.to_base64_string
48
+
45
49
  ```
46
50
 
47
51
  for more information see:
data/bin/setup CHANGED
@@ -6,3 +6,4 @@ set -vx
6
6
  bundle install
7
7
 
8
8
  # Do any other automated setup that you need to do here
9
+ ./bin/umi/bin/umi --version
data/bin/umi/bin/umi CHANGED
@@ -281,10 +281,10 @@ java_version_check() {
281
281
  if [[ "$major" -eq "1" ]]; then
282
282
  local major=$(echo "$java_version" | cut -d'.' -f2)
283
283
  fi
284
- if [[ "$major" -lt "6" ]]; then
284
+ if [[ "$major" -lt "8" ]]; then
285
285
  echo
286
286
  echo The java installation you have is not up to date
287
- echo $app_name requires at least version 1.6+, you have
287
+ echo $app_name requires at least version 1.8+, you have
288
288
  echo version $java_version
289
289
  echo
290
290
  echo Please go to http://www.java.com/getjava/ and download
@@ -344,7 +344,7 @@ declare -r lib_dir="$(realpath "${app_home}/../lib")"
344
344
  declare -a app_mainclass=(com.icodici.farcallscala.Main)
345
345
 
346
346
  declare -r script_conf_file="${app_home}/../conf/application.ini"
347
- declare -r app_classpath="$lib_dir/com.icodici.umi-0.8.7.jar:$lib_dir/org.scala-lang.scala-library-2.12.7.jar:$lib_dir/com.icodici.universa_core-3.8.3.jar:$lib_dir/org.yaml.snakeyaml-1.18.jar:$lib_dir/net.sf.jopt-simple.jopt-simple-4.9.jar:$lib_dir/org.postgresql.postgresql-42.1.4.jar:$lib_dir/org.xerial.sqlite-jdbc-3.8.9.1.jar:$lib_dir/com.icodici.nanohttpd-2.1.0.jar:$lib_dir/com.icodici.common_tools-3.8.3.jar:$lib_dir/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar:$lib_dir/net.java.dev.jna.jna-4.5.1.jar:$lib_dir/org.checkerframework.checker-qual-2.3.2.jar:$lib_dir/com.icodici.crypto-3.8.3.jar:$lib_dir/com.madgag.spongycastle.core-1.58.0.0.jar:$lib_dir/com.squareup.jnagmp.jnagmp-2.0.0.jar:$lib_dir/com.typesafe.play.play-json_2.12-2.6.10.jar:$lib_dir/com.typesafe.play.play-functional_2.12-2.6.10.jar:$lib_dir/org.scala-lang.scala-reflect-2.12.7.jar:$lib_dir/org.typelevel.macro-compat_2.12-1.1.1.jar:$lib_dir/joda-time.joda-time-2.9.9.jar:$lib_dir/com.fasterxml.jackson.core.jackson-core-2.8.11.jar:$lib_dir/com.fasterxml.jackson.core.jackson-annotations-2.8.11.jar:$lib_dir/com.fasterxml.jackson.datatype.jackson-datatype-jdk8-2.8.11.jar:$lib_dir/com.fasterxml.jackson.core.jackson-databind-2.8.11.1.jar:$lib_dir/com.fasterxml.jackson.datatype.jackson-datatype-jsr310-2.8.11.jar:$lib_dir/org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar:$lib_dir/net.java.dev.jna.jna-platform-4.5.0.jar"
347
+ declare -r app_classpath="$lib_dir/com.icodici.umi-0.8.8.jar:$lib_dir/org.scala-lang.scala-library-2.12.7.jar:$lib_dir/com.icodici.universa_core-3.8.3.jar:$lib_dir/org.yaml.snakeyaml-1.18.jar:$lib_dir/net.sf.jopt-simple.jopt-simple-4.9.jar:$lib_dir/org.postgresql.postgresql-42.1.4.jar:$lib_dir/org.xerial.sqlite-jdbc-3.8.9.1.jar:$lib_dir/com.icodici.nanohttpd-2.1.0.jar:$lib_dir/com.icodici.common_tools-3.8.3.jar:$lib_dir/com.eclipsesource.minimal-json.minimal-json-0.9.4.jar:$lib_dir/net.java.dev.jna.jna-4.5.1.jar:$lib_dir/org.checkerframework.checker-qual-2.3.2.jar:$lib_dir/com.icodici.crypto-3.8.3.jar:$lib_dir/com.madgag.spongycastle.core-1.58.0.0.jar:$lib_dir/com.squareup.jnagmp.jnagmp-2.0.0.jar:$lib_dir/com.typesafe.play.play-json_2.12-2.6.10.jar:$lib_dir/com.typesafe.play.play-functional_2.12-2.6.10.jar:$lib_dir/org.scala-lang.scala-reflect-2.12.7.jar:$lib_dir/org.typelevel.macro-compat_2.12-1.1.1.jar:$lib_dir/joda-time.joda-time-2.9.9.jar:$lib_dir/com.fasterxml.jackson.core.jackson-core-2.8.11.jar:$lib_dir/com.fasterxml.jackson.core.jackson-annotations-2.8.11.jar:$lib_dir/com.fasterxml.jackson.datatype.jackson-datatype-jdk8-2.8.11.jar:$lib_dir/com.fasterxml.jackson.core.jackson-databind-2.8.11.1.jar:$lib_dir/com.fasterxml.jackson.datatype.jackson-datatype-jsr310-2.8.11.jar:$lib_dir/org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar:$lib_dir/net.java.dev.jna.jna-platform-4.5.0.jar"
348
348
 
349
349
  # java_cmd is overrode in process_args when -java-home is used
350
350
  declare java_cmd=$(get_java_cmd)
data/bin/umi/bin/umi.bat CHANGED
@@ -1,180 +1,180 @@
1
- @REM umi launcher script
2
- @REM
3
- @REM Environment:
4
- @REM JAVA_HOME - location of a JDK home dir (optional if java on path)
5
- @REM CFG_OPTS - JVM options (optional)
6
- @REM Configuration:
7
- @REM UMI_config.txt found in the UMI_HOME.
8
- @setlocal enabledelayedexpansion
9
-
10
- @echo off
11
-
12
-
13
- if "%UMI_HOME%"=="" (
14
- set "APP_HOME=%~dp0\\.."
15
-
16
- rem Also set the old env name for backwards compatibility
17
- set "UMI_HOME=%~dp0\\.."
18
- ) else (
19
- set "APP_HOME=%UMI_HOME%"
20
- )
21
-
22
- set "APP_LIB_DIR=%APP_HOME%\lib\"
23
-
24
- rem Detect if we were double clicked, although theoretically A user could
25
- rem manually run cmd /c
26
- for %%x in (!cmdcmdline!) do if %%~x==/c set DOUBLECLICKED=1
27
-
28
- rem FIRST we load the config file of extra options.
29
- set "CFG_FILE=%APP_HOME%\UMI_config.txt"
30
- set CFG_OPTS=
31
- call :parse_config "%CFG_FILE%" CFG_OPTS
32
-
33
- rem We use the value of the JAVACMD environment variable if defined
34
- set _JAVACMD=%JAVACMD%
35
-
36
- if "%_JAVACMD%"=="" (
37
- if not "%JAVA_HOME%"=="" (
38
- if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
39
- )
40
- )
41
-
42
- if "%_JAVACMD%"=="" set _JAVACMD=java
43
-
44
- rem Detect if this java is ok to use.
45
- for /F %%j in ('"%_JAVACMD%" -version 2^>^&1') do (
46
- if %%~j==java set JAVAINSTALLED=1
47
- if %%~j==openjdk set JAVAINSTALLED=1
48
- )
49
-
50
- rem BAT has no logical or, so we do it OLD SCHOOL! Oppan Redmond Style
51
- set JAVAOK=true
52
- if not defined JAVAINSTALLED set JAVAOK=false
53
-
54
- if "%JAVAOK%"=="false" (
55
- echo.
56
- echo A Java JDK is not installed or can't be found.
57
- if not "%JAVA_HOME%"=="" (
58
- echo JAVA_HOME = "%JAVA_HOME%"
59
- )
60
- echo.
61
- echo Please go to
62
- echo http://www.oracle.com/technetwork/java/javase/downloads/index.html
63
- echo and download a valid Java JDK and install before running umi.
64
- echo.
65
- echo If you think this message is in error, please check
66
- echo your environment variables to see if "java.exe" and "javac.exe" are
67
- echo available via JAVA_HOME or PATH.
68
- echo.
69
- if defined DOUBLECLICKED pause
70
- exit /B 1
71
- )
72
-
73
-
74
- rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
75
- set _JAVA_OPTS=%JAVA_OPTS%
76
- if "!_JAVA_OPTS!"=="" set _JAVA_OPTS=!CFG_OPTS!
77
-
78
- rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
79
- rem "-J" is stripped, "-D" is left as is, and everything is appended to JAVA_OPTS
80
- set _JAVA_PARAMS=
81
- set _APP_ARGS=
82
-
83
- set "APP_CLASSPATH=%APP_LIB_DIR%\com.icodici.umi-0.8.7.jar;%APP_LIB_DIR%\org.scala-lang.scala-library-2.12.7.jar;%APP_LIB_DIR%\com.icodici.universa_core-3.8.3.jar;%APP_LIB_DIR%\org.yaml.snakeyaml-1.18.jar;%APP_LIB_DIR%\net.sf.jopt-simple.jopt-simple-4.9.jar;%APP_LIB_DIR%\org.postgresql.postgresql-42.1.4.jar;%APP_LIB_DIR%\org.xerial.sqlite-jdbc-3.8.9.1.jar;%APP_LIB_DIR%\com.icodici.nanohttpd-2.1.0.jar;%APP_LIB_DIR%\com.icodici.common_tools-3.8.3.jar;%APP_LIB_DIR%\com.eclipsesource.minimal-json.minimal-json-0.9.4.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-4.5.1.jar;%APP_LIB_DIR%\org.checkerframework.checker-qual-2.3.2.jar;%APP_LIB_DIR%\com.icodici.crypto-3.8.3.jar;%APP_LIB_DIR%\com.madgag.spongycastle.core-1.58.0.0.jar;%APP_LIB_DIR%\com.squareup.jnagmp.jnagmp-2.0.0.jar;%APP_LIB_DIR%\com.typesafe.play.play-json_2.12-2.6.10.jar;%APP_LIB_DIR%\com.typesafe.play.play-functional_2.12-2.6.10.jar;%APP_LIB_DIR%\org.scala-lang.scala-reflect-2.12.7.jar;%APP_LIB_DIR%\org.typelevel.macro-compat_2.12-1.1.1.jar;%APP_LIB_DIR%\joda-time.joda-time-2.9.9.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-core-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-annotations-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.datatype.jackson-datatype-jdk8-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-databind-2.8.11.1.jar;%APP_LIB_DIR%\com.fasterxml.jackson.datatype.jackson-datatype-jsr310-2.8.11.jar;%APP_LIB_DIR%\org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-platform-4.5.0.jar"
84
- set "APP_MAIN_CLASS=com.icodici.farcallscala.Main"
85
- set "SCRIPT_CONF_FILE=%APP_HOME%\conf\application.ini"
86
-
87
- rem if configuration files exist, prepend their contents to the script arguments so it can be processed by this runner
88
- call :parse_config "%SCRIPT_CONF_FILE%" SCRIPT_CONF_ARGS
89
-
90
- call :process_args %SCRIPT_CONF_ARGS% %%*
91
-
92
- set _JAVA_OPTS=!_JAVA_OPTS! !_JAVA_PARAMS!
93
-
94
- if defined CUSTOM_MAIN_CLASS (
95
- set MAIN_CLASS=!CUSTOM_MAIN_CLASS!
96
- ) else (
97
- set MAIN_CLASS=!APP_MAIN_CLASS!
98
- )
99
-
100
- rem Call the application and pass all arguments unchanged.
101
- "%_JAVACMD%" !_JAVA_OPTS! !UMI_OPTS! -cp "%APP_CLASSPATH%" %MAIN_CLASS% !_APP_ARGS!
102
-
103
- @endlocal
104
-
105
- exit /B %ERRORLEVEL%
106
-
107
-
108
- rem Loads a configuration file full of default command line options for this script.
109
- rem First argument is the path to the config file.
110
- rem Second argument is the name of the environment variable to write to.
111
- :parse_config
112
- set _PARSE_FILE=%~1
113
- set _PARSE_OUT=
114
- if exist "%_PARSE_FILE%" (
115
- FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%_PARSE_FILE%") DO (
116
- set _PARSE_OUT=!_PARSE_OUT! %%i
117
- )
118
- )
119
- set %2=!_PARSE_OUT!
120
- exit /B 0
121
-
122
-
123
- :add_java
124
- set _JAVA_PARAMS=!_JAVA_PARAMS! %*
125
- exit /B 0
126
-
127
-
128
- :add_app
129
- set _APP_ARGS=!_APP_ARGS! %*
130
- exit /B 0
131
-
132
-
133
- rem Processes incoming arguments and places them in appropriate global variables
134
- :process_args
135
- :param_loop
136
- call set _PARAM1=%%1
137
- set "_TEST_PARAM=%~1"
138
-
139
- if ["!_PARAM1!"]==[""] goto param_afterloop
140
-
141
-
142
- rem ignore arguments that do not start with '-'
143
- if "%_TEST_PARAM:~0,1%"=="-" goto param_java_check
144
- set _APP_ARGS=!_APP_ARGS! !_PARAM1!
145
- shift
146
- goto param_loop
147
-
148
- :param_java_check
149
- if "!_TEST_PARAM:~0,2!"=="-J" (
150
- rem strip -J prefix
151
- set _JAVA_PARAMS=!_JAVA_PARAMS! !_TEST_PARAM:~2!
152
- shift
153
- goto param_loop
154
- )
155
-
156
- if "!_TEST_PARAM:~0,2!"=="-D" (
157
- rem test if this was double-quoted property "-Dprop=42"
158
- for /F "delims== tokens=1,*" %%G in ("!_TEST_PARAM!") DO (
159
- if not ["%%H"] == [""] (
160
- set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
161
- ) else if [%2] neq [] (
162
- rem it was a normal property: -Dprop=42 or -Drop="42"
163
- call set _PARAM1=%%1=%%2
164
- set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
165
- shift
166
- )
167
- )
168
- ) else (
169
- if "!_TEST_PARAM!"=="-main" (
170
- call set CUSTOM_MAIN_CLASS=%%2
171
- shift
172
- ) else (
173
- set _APP_ARGS=!_APP_ARGS! !_PARAM1!
174
- )
175
- )
176
- shift
177
- goto param_loop
178
- :param_afterloop
179
-
180
- exit /B 0
1
+ @REM umi launcher script
2
+ @REM
3
+ @REM Environment:
4
+ @REM JAVA_HOME - location of a JDK home dir (optional if java on path)
5
+ @REM CFG_OPTS - JVM options (optional)
6
+ @REM Configuration:
7
+ @REM UMI_config.txt found in the UMI_HOME.
8
+ @setlocal enabledelayedexpansion
9
+
10
+ @echo off
11
+
12
+
13
+ if "%UMI_HOME%"=="" (
14
+ set "APP_HOME=%~dp0\\.."
15
+
16
+ rem Also set the old env name for backwards compatibility
17
+ set "UMI_HOME=%~dp0\\.."
18
+ ) else (
19
+ set "APP_HOME=%UMI_HOME%"
20
+ )
21
+
22
+ set "APP_LIB_DIR=%APP_HOME%\lib\"
23
+
24
+ rem Detect if we were double clicked, although theoretically A user could
25
+ rem manually run cmd /c
26
+ for %%x in (!cmdcmdline!) do if %%~x==/c set DOUBLECLICKED=1
27
+
28
+ rem FIRST we load the config file of extra options.
29
+ set "CFG_FILE=%APP_HOME%\UMI_config.txt"
30
+ set CFG_OPTS=
31
+ call :parse_config "%CFG_FILE%" CFG_OPTS
32
+
33
+ rem We use the value of the JAVACMD environment variable if defined
34
+ set _JAVACMD=%JAVACMD%
35
+
36
+ if "%_JAVACMD%"=="" (
37
+ if not "%JAVA_HOME%"=="" (
38
+ if exist "%JAVA_HOME%\bin\java.exe" set "_JAVACMD=%JAVA_HOME%\bin\java.exe"
39
+ )
40
+ )
41
+
42
+ if "%_JAVACMD%"=="" set _JAVACMD=java
43
+
44
+ rem Detect if this java is ok to use.
45
+ for /F %%j in ('"%_JAVACMD%" -version 2^>^&1') do (
46
+ if %%~j==java set JAVAINSTALLED=1
47
+ if %%~j==openjdk set JAVAINSTALLED=1
48
+ )
49
+
50
+ rem BAT has no logical or, so we do it OLD SCHOOL! Oppan Redmond Style
51
+ set JAVAOK=true
52
+ if not defined JAVAINSTALLED set JAVAOK=false
53
+
54
+ if "%JAVAOK%"=="false" (
55
+ echo.
56
+ echo A Java JDK is not installed or can't be found.
57
+ if not "%JAVA_HOME%"=="" (
58
+ echo JAVA_HOME = "%JAVA_HOME%"
59
+ )
60
+ echo.
61
+ echo Please go to
62
+ echo http://www.oracle.com/technetwork/java/javase/downloads/index.html
63
+ echo and download a valid Java JDK and install before running umi.
64
+ echo.
65
+ echo If you think this message is in error, please check
66
+ echo your environment variables to see if "java.exe" and "javac.exe" are
67
+ echo available via JAVA_HOME or PATH.
68
+ echo.
69
+ if defined DOUBLECLICKED pause
70
+ exit /B 1
71
+ )
72
+
73
+
74
+ rem We use the value of the JAVA_OPTS environment variable if defined, rather than the config.
75
+ set _JAVA_OPTS=%JAVA_OPTS%
76
+ if "!_JAVA_OPTS!"=="" set _JAVA_OPTS=!CFG_OPTS!
77
+
78
+ rem We keep in _JAVA_PARAMS all -J-prefixed and -D-prefixed arguments
79
+ rem "-J" is stripped, "-D" is left as is, and everything is appended to JAVA_OPTS
80
+ set _JAVA_PARAMS=
81
+ set _APP_ARGS=
82
+
83
+ set "APP_CLASSPATH=%APP_LIB_DIR%\com.icodici.umi-0.8.8.jar;%APP_LIB_DIR%\org.scala-lang.scala-library-2.12.7.jar;%APP_LIB_DIR%\com.icodici.universa_core-3.8.3.jar;%APP_LIB_DIR%\org.yaml.snakeyaml-1.18.jar;%APP_LIB_DIR%\net.sf.jopt-simple.jopt-simple-4.9.jar;%APP_LIB_DIR%\org.postgresql.postgresql-42.1.4.jar;%APP_LIB_DIR%\org.xerial.sqlite-jdbc-3.8.9.1.jar;%APP_LIB_DIR%\com.icodici.nanohttpd-2.1.0.jar;%APP_LIB_DIR%\com.icodici.common_tools-3.8.3.jar;%APP_LIB_DIR%\com.eclipsesource.minimal-json.minimal-json-0.9.4.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-4.5.1.jar;%APP_LIB_DIR%\org.checkerframework.checker-qual-2.3.2.jar;%APP_LIB_DIR%\com.icodici.crypto-3.8.3.jar;%APP_LIB_DIR%\com.madgag.spongycastle.core-1.58.0.0.jar;%APP_LIB_DIR%\com.squareup.jnagmp.jnagmp-2.0.0.jar;%APP_LIB_DIR%\com.typesafe.play.play-json_2.12-2.6.10.jar;%APP_LIB_DIR%\com.typesafe.play.play-functional_2.12-2.6.10.jar;%APP_LIB_DIR%\org.scala-lang.scala-reflect-2.12.7.jar;%APP_LIB_DIR%\org.typelevel.macro-compat_2.12-1.1.1.jar;%APP_LIB_DIR%\joda-time.joda-time-2.9.9.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-core-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-annotations-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.datatype.jackson-datatype-jdk8-2.8.11.jar;%APP_LIB_DIR%\com.fasterxml.jackson.core.jackson-databind-2.8.11.1.jar;%APP_LIB_DIR%\com.fasterxml.jackson.datatype.jackson-datatype-jsr310-2.8.11.jar;%APP_LIB_DIR%\org.scala-sbt.ipcsocket.ipcsocket-1.0.0.jar;%APP_LIB_DIR%\net.java.dev.jna.jna-platform-4.5.0.jar"
84
+ set "APP_MAIN_CLASS=com.icodici.farcallscala.Main"
85
+ set "SCRIPT_CONF_FILE=%APP_HOME%\conf\application.ini"
86
+
87
+ rem if configuration files exist, prepend their contents to the script arguments so it can be processed by this runner
88
+ call :parse_config "%SCRIPT_CONF_FILE%" SCRIPT_CONF_ARGS
89
+
90
+ call :process_args %SCRIPT_CONF_ARGS% %%*
91
+
92
+ set _JAVA_OPTS=!_JAVA_OPTS! !_JAVA_PARAMS!
93
+
94
+ if defined CUSTOM_MAIN_CLASS (
95
+ set MAIN_CLASS=!CUSTOM_MAIN_CLASS!
96
+ ) else (
97
+ set MAIN_CLASS=!APP_MAIN_CLASS!
98
+ )
99
+
100
+ rem Call the application and pass all arguments unchanged.
101
+ "%_JAVACMD%" !_JAVA_OPTS! !UMI_OPTS! -cp "%APP_CLASSPATH%" %MAIN_CLASS% !_APP_ARGS!
102
+
103
+ @endlocal
104
+
105
+ exit /B %ERRORLEVEL%
106
+
107
+
108
+ rem Loads a configuration file full of default command line options for this script.
109
+ rem First argument is the path to the config file.
110
+ rem Second argument is the name of the environment variable to write to.
111
+ :parse_config
112
+ set _PARSE_FILE=%~1
113
+ set _PARSE_OUT=
114
+ if exist "%_PARSE_FILE%" (
115
+ FOR /F "tokens=* eol=# usebackq delims=" %%i IN ("%_PARSE_FILE%") DO (
116
+ set _PARSE_OUT=!_PARSE_OUT! %%i
117
+ )
118
+ )
119
+ set %2=!_PARSE_OUT!
120
+ exit /B 0
121
+
122
+
123
+ :add_java
124
+ set _JAVA_PARAMS=!_JAVA_PARAMS! %*
125
+ exit /B 0
126
+
127
+
128
+ :add_app
129
+ set _APP_ARGS=!_APP_ARGS! %*
130
+ exit /B 0
131
+
132
+
133
+ rem Processes incoming arguments and places them in appropriate global variables
134
+ :process_args
135
+ :param_loop
136
+ call set _PARAM1=%%1
137
+ set "_TEST_PARAM=%~1"
138
+
139
+ if ["!_PARAM1!"]==[""] goto param_afterloop
140
+
141
+
142
+ rem ignore arguments that do not start with '-'
143
+ if "%_TEST_PARAM:~0,1%"=="-" goto param_java_check
144
+ set _APP_ARGS=!_APP_ARGS! !_PARAM1!
145
+ shift
146
+ goto param_loop
147
+
148
+ :param_java_check
149
+ if "!_TEST_PARAM:~0,2!"=="-J" (
150
+ rem strip -J prefix
151
+ set _JAVA_PARAMS=!_JAVA_PARAMS! !_TEST_PARAM:~2!
152
+ shift
153
+ goto param_loop
154
+ )
155
+
156
+ if "!_TEST_PARAM:~0,2!"=="-D" (
157
+ rem test if this was double-quoted property "-Dprop=42"
158
+ for /F "delims== tokens=1,*" %%G in ("!_TEST_PARAM!") DO (
159
+ if not ["%%H"] == [""] (
160
+ set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
161
+ ) else if [%2] neq [] (
162
+ rem it was a normal property: -Dprop=42 or -Drop="42"
163
+ call set _PARAM1=%%1=%%2
164
+ set _JAVA_PARAMS=!_JAVA_PARAMS! !_PARAM1!
165
+ shift
166
+ )
167
+ )
168
+ ) else (
169
+ if "!_TEST_PARAM!"=="-main" (
170
+ call set CUSTOM_MAIN_CLASS=%%2
171
+ shift
172
+ ) else (
173
+ set _APP_ARGS=!_APP_ARGS! !_PARAM1!
174
+ )
175
+ )
176
+ shift
177
+ goto param_loop
178
+ :param_afterloop
179
+
180
+ exit /B 0
data/exe/universa CHANGED
@@ -5,5 +5,5 @@ require "universa"
5
5
 
6
6
  puts "Checking prerequisites"
7
7
 
8
- puts "Found Unimi version: #{UMI.new.version}"
8
+ puts "Found UMI version: #{UMI.new.version}"
9
9
 
@@ -0,0 +1,9 @@
1
+ module Universa
2
+ refine String do
3
+ def camelize_lower
4
+ first, *rest = split('_').delete_if(&:empty?)
5
+ [first, *rest.map(&:capitalize)].join
6
+ end
7
+ end
8
+ end
9
+
data/lib/universa/umi.rb CHANGED
@@ -62,7 +62,9 @@ module Universa
62
62
  # @param [String] path to custom UMI server build. Use bundled one (leave as nil)
63
63
  # @param [Regexp] version_check check version against
64
64
  # @param [String] system expected on the remote side. 'UMI' us a universa umi server.
65
- def initialize(path = nil, version_check: /./, system: "UMI", log: 'sessionlog.txt')
65
+ # @param [Boolean] convert_case it true, convert ruby style snake case `get_some_stuff()` to java style lower camel
66
+ # case `getSomeStuff()` while calling methods. Does not affect class names on {instantiate}.
67
+ def initialize(path = nil, version_check: /./, system: "UMI", log: 'sessionlog.txt', convert_case: true)
66
68
  path ||= File.expand_path(File.split(__FILE__)[0] + "/../../bin/umi/bin/umi")
67
69
  @in, @out, @err, @wtr = Open3.popen3("#{path} #{log ? "-log #{log}" : ''}")
68
70
  @endpoint = Farcall::Endpoint.new(
@@ -71,6 +73,7 @@ module Universa
71
73
  @lock = Monitor.new
72
74
  @cache = {}
73
75
  @closed = false
76
+ @convert_case = convert_case
74
77
  @references = {}
75
78
  start_cleanup_queue
76
79
  @version = call("version")
@@ -81,6 +84,7 @@ module Universa
81
84
  raise Error, "missing java binaries"
82
85
  end
83
86
 
87
+ # @return version of the connected UMI server. It is different from the gem version.
84
88
  def version
85
89
  @version.version
86
90
  end
@@ -100,6 +104,7 @@ module Universa
100
104
  def invoke(ref, method, *args)
101
105
  ensure_open
102
106
  ref._umi == self or raise InterchangeError
107
+ @convert_case and method = method.to_s.camelize_lower
103
108
  result = call("invoke", ref._remote_id, method, *prepare_args(args))
104
109
  encode_result result
105
110
  rescue
@@ -119,7 +124,7 @@ module Universa
119
124
 
120
125
  # short data label for UMI interface
121
126
  def inspect
122
- "<UniMI:#{__id__}:#{version}>"
127
+ "<UMI:#{__id__}:#{version}>"
123
128
  end
124
129
 
125
130
  # debug use only. Looks for the cached e.g. (alive) remote object. Does not check
@@ -260,7 +265,7 @@ module Universa
260
265
  end
261
266
 
262
267
  def log msg
263
- @trace and puts "UNIMI #{msg}"
268
+ @trace and puts "UMI #{msg}"
264
269
  end
265
270
 
266
271
  end
@@ -1,4 +1,4 @@
1
1
  module Universa
2
2
  # Current gem version
3
- VERSION = "0.1.1"
3
+ VERSION = "0.1.2"
4
4
  end
data/lib/universa.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "universa/version"
2
+ require "universa/string_utils"
2
3
  require "universa/errors"
3
4
  require "universa/umi"
4
5
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: universa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sergeych
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2018-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: farcall
@@ -95,7 +95,7 @@ files:
95
95
  - bin/umi/lib/com.icodici.common_tools-3.8.3.jar
96
96
  - bin/umi/lib/com.icodici.crypto-3.8.3.jar
97
97
  - bin/umi/lib/com.icodici.nanohttpd-2.1.0.jar
98
- - bin/umi/lib/com.icodici.umi-0.8.7.jar
98
+ - bin/umi/lib/com.icodici.umi-0.8.8.jar
99
99
  - bin/umi/lib/com.icodici.universa_core-3.8.3.jar
100
100
  - bin/umi/lib/com.madgag.spongycastle.core-1.58.0.0.jar
101
101
  - bin/umi/lib/com.squareup.jnagmp.jnagmp-2.0.0.jar
@@ -112,6 +112,7 @@ files:
112
112
  - exe/universa
113
113
  - lib/universa.rb
114
114
  - lib/universa/errors.rb
115
+ - lib/universa/string_utils.rb
115
116
  - lib/universa/umi.rb
116
117
  - lib/universa/version.rb
117
118
  - lib/universa/weak_reference.rb