nysol 3.0.0-universal-darwin-13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/blueKiller.rb +17 -0
- data/bin/mdistcopy.rb +89 -0
- data/bin/meach.rb +284 -0
- data/bin/meachc.rb +288 -0
- data/bin/msend.rb +95 -0
- data/bin/mtempclean.rb +33 -0
- data/ext/mcsvin/extconf.rb +15 -0
- data/ext/mcsvout/extconf.rb +14 -0
- data/ext/mmethods/extconf.rb +12 -0
- data/ext/mtable/extconf.rb +12 -0
- data/lib/nysol/margs.rb +402 -0
- data/lib/nysol/mcmd.rb +44 -0
- data/lib/nysol/mcsvin.bundle +0 -0
- data/lib/nysol/mcsvout.bundle +0 -0
- data/lib/nysol/mmethods.bundle +0 -0
- data/lib/nysol/mnettools.rb +220 -0
- data/lib/nysol/mparallel.rb +359 -0
- data/lib/nysol/mparallelmanager.rb +300 -0
- data/lib/nysol/mrubyparse.rb +538 -0
- data/lib/nysol/msysteminfo.rb +216 -0
- data/lib/nysol/mtable.bundle +0 -0
- data/lib/nysol/mtemp.rb +268 -0
- data/lib/nysol/mutils.rb +218 -0
- metadata +131 -0
data/lib/nysol/mutils.rb
ADDED
@@ -0,0 +1,218 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#/* ////////// LICENSE INFO ////////////////////
|
3
|
+
#
|
4
|
+
# * Copyright (C) 2013 by NYSOL CORPORATION
|
5
|
+
# *
|
6
|
+
# * Unless you have received this program directly from NYSOL pursuant
|
7
|
+
# * to the terms of a commercial license agreement with NYSOL, then
|
8
|
+
# * this program is licensed to you under the terms of the GNU Affero General
|
9
|
+
# * Public License (AGPL) as published by the Free Software Foundation,
|
10
|
+
# * either version 3 of the License, or (at your option) any later version.
|
11
|
+
# *
|
12
|
+
# * This program is distributed in the hope that it will be useful, but
|
13
|
+
# * WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF
|
14
|
+
# * NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
15
|
+
# *
|
16
|
+
# * Please refer to the AGPL (http://www.gnu.org/licenses/agpl-3.0.txt)
|
17
|
+
# * for more details.
|
18
|
+
#
|
19
|
+
# ////////// LICENSE INFO ////////////////////*/
|
20
|
+
#= MCMD ruby拡張ライブラリ
|
21
|
+
# ユーティリティツール
|
22
|
+
# Array.
|
23
|
+
# maddPrefix
|
24
|
+
# maddSuffix
|
25
|
+
# mslidepair
|
26
|
+
# MCMD::
|
27
|
+
# errorLog(msg="")
|
28
|
+
# warningLog(msg="")
|
29
|
+
# endLog(msg="")
|
30
|
+
# msgLog(msg="",time=true,header=true)
|
31
|
+
# mkDir(path,rm=false)
|
32
|
+
# chkCmdExe(cmd,type,arg1=nil)
|
33
|
+
# chkRexe(libs)
|
34
|
+
# mcat(fName,oFile)
|
35
|
+
|
36
|
+
class Array
|
37
|
+
|
38
|
+
def maddPrefix(strs)
|
39
|
+
strs = [strs] if strs.class != Array
|
40
|
+
rtn =[]
|
41
|
+
params=self.dup
|
42
|
+
params.each{|v|
|
43
|
+
strs.each{|str| rtn << "#{str}#{v}" }
|
44
|
+
}
|
45
|
+
return rtn
|
46
|
+
end
|
47
|
+
|
48
|
+
def maddSuffix(strs)
|
49
|
+
strs = [strs] if strs.class != Array
|
50
|
+
rtn =[]
|
51
|
+
params=self.dup
|
52
|
+
params.each{|v|
|
53
|
+
strs.each{|str| rtn << "#{v}#{str}" }
|
54
|
+
}
|
55
|
+
return rtn
|
56
|
+
end
|
57
|
+
|
58
|
+
def mslidepair
|
59
|
+
rtn =[]
|
60
|
+
params=self.dup
|
61
|
+
(1...params.size).each{|i|
|
62
|
+
rtn << [params[i-1],params[i]]
|
63
|
+
}
|
64
|
+
return rtn
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
module MCMD
|
70
|
+
|
71
|
+
def MCMD::errorLog(msg="")
|
72
|
+
vbl=ENV["KG_ScpVerboseLevel"]
|
73
|
+
if(not vbl or vbl.to_i>=1) then
|
74
|
+
STDERR.puts "#ERROR# #{msg}; #{Time.now.strftime('%Y/%m/%d %H:%M:%S')}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def MCMD::warningLog(msg="")
|
79
|
+
vbl=ENV["KG_ScpVerboseLevel"]
|
80
|
+
if(not vbl or vbl.to_i>=2) then
|
81
|
+
STDERR.puts "#WARNING# #{msg}; #{Time.now.strftime('%Y/%m/%d %H:%M:%S')}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def MCMD::endLog(msg="")
|
86
|
+
vbl=ENV["KG_ScpVerboseLevel"]
|
87
|
+
if(not vbl or vbl.to_i>=3) then
|
88
|
+
STDERR.puts "#END# #{msg}; #{Time.now.strftime('%Y/%m/%d %H:%M:%S')}"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def MCMD::msgLog(msg="",time=true,header=true)
|
93
|
+
vbl=ENV["KG_ScpVerboseLevel"]
|
94
|
+
if(not vbl or vbl.to_i>=4) then
|
95
|
+
str=""
|
96
|
+
str << "#MSG# " if header
|
97
|
+
str << msg
|
98
|
+
str << "; #{Time.now.strftime('%Y/%m/%d %H:%M:%S')}" if time
|
99
|
+
STDERR.puts str
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
# ディレクトリの作成
|
104
|
+
def MCMD::mkDir(path,rm=false)
|
105
|
+
if File.exist?(path)
|
106
|
+
if rm
|
107
|
+
FileUtils.rm_rf(path) if rm
|
108
|
+
FileUtils.mkdir_p(path)
|
109
|
+
end
|
110
|
+
else
|
111
|
+
FileUtils.mkdir_p(path)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
# コマンド実行チェック
|
116
|
+
# 実行可能ならtrue else false
|
117
|
+
def MCMD::chkCmdExe(cmd,type,arg1=nil)
|
118
|
+
ret=true
|
119
|
+
if(type=="executable")
|
120
|
+
system "#{cmd} 2>/dev/null"
|
121
|
+
if($?.exitstatus==127)
|
122
|
+
MCMD::errorLog("command not found (type=#{type}): '#{cmd}'.")
|
123
|
+
ret=false
|
124
|
+
end
|
125
|
+
elsif(type=="wc")
|
126
|
+
log=`#{cmd} #{type} 2>&1`
|
127
|
+
if log.chomp.size()<arg1
|
128
|
+
MCMD::errorLog("command not found (type=#{type}): '#{cmd}'.")
|
129
|
+
ret=false
|
130
|
+
end
|
131
|
+
else
|
132
|
+
log=`#{cmd} #{type} 2>&1`
|
133
|
+
if log.chomp!=arg1
|
134
|
+
MCMD::errorLog("command version mismatch: '#{cmd}': needs '#{arg1}', but '#{log}.")
|
135
|
+
ret=false
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
return ret
|
140
|
+
end
|
141
|
+
|
142
|
+
# rの実行チェックとr ライブラリのインストールチェック
|
143
|
+
def MCMD::chkRexe(libs)
|
144
|
+
log=`R --version 2>&1`
|
145
|
+
if log.chomp.size()<100
|
146
|
+
MCMD::errorLog("R is not installed.")
|
147
|
+
return false
|
148
|
+
end
|
149
|
+
|
150
|
+
libStr=""
|
151
|
+
libs.split(",").each{|lib|
|
152
|
+
libStr << "p=packageVersion(\"#{lib}\")\n"
|
153
|
+
}
|
154
|
+
|
155
|
+
wf=MCMD::Mtemp.new
|
156
|
+
xxscp=wf.file
|
157
|
+
File.open(xxscp,"w"){|fpw|
|
158
|
+
fpw.puts <<EOF
|
159
|
+
tryCatch({
|
160
|
+
#{libStr}
|
161
|
+
},
|
162
|
+
error=function(e){
|
163
|
+
message(e)
|
164
|
+
quit(save="no", status=1)
|
165
|
+
})
|
166
|
+
quit(save="no", status=0)
|
167
|
+
EOF
|
168
|
+
}
|
169
|
+
|
170
|
+
# it will be aborted here if the library is not found
|
171
|
+
ret=system "R -q --vanilla --slave --no-save --no-restore < #{xxscp}"
|
172
|
+
unless ret
|
173
|
+
puts "\n"
|
174
|
+
MCMD::errorLog("R package shown above is not installed.")
|
175
|
+
end
|
176
|
+
|
177
|
+
# return true if nothing happened
|
178
|
+
return ret
|
179
|
+
end
|
180
|
+
|
181
|
+
# mcat i=のファイル名文字列がbashの位置行文字数制限(たぶん1024くらい?)に引っかかるのを回避するmcat
|
182
|
+
# date,noが指定されれば、date,no以前のデータをmcatし、oFileに出力する。
|
183
|
+
# マッチしたファイル名配列を返す。
|
184
|
+
def MCMD::mcat(fName,oFile)
|
185
|
+
files=[]
|
186
|
+
if fName.class.name=="Array"
|
187
|
+
fName.each{|name|
|
188
|
+
files.concat(Dir["#{name}"])
|
189
|
+
}
|
190
|
+
else
|
191
|
+
files=Dir["#{fName}"]
|
192
|
+
end
|
193
|
+
|
194
|
+
wf=MCMD::Mtemp.new
|
195
|
+
xxbase=wf.file
|
196
|
+
xxbaseX=wf.file
|
197
|
+
|
198
|
+
split=20
|
199
|
+
collect_path =[]
|
200
|
+
(0...files.size).each{|i|
|
201
|
+
if i==0
|
202
|
+
system("cp #{files[0]} #{xxbase}")
|
203
|
+
next
|
204
|
+
end
|
205
|
+
collect_path << "#{files[i]}"
|
206
|
+
if i%split == 0 or i==files.size-1 then
|
207
|
+
system("mcat i=#{xxbase},#{collect_path.join(",")} -skip_fnf o=#{xxbaseX}")
|
208
|
+
system("cp #{xxbaseX} #{xxbase}")
|
209
|
+
collect_path = []
|
210
|
+
end
|
211
|
+
}
|
212
|
+
system("cp #{xxbase} #{oFile}") if files.size>0
|
213
|
+
|
214
|
+
return files
|
215
|
+
end
|
216
|
+
|
217
|
+
|
218
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nysol
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 3.0.0
|
5
|
+
platform: universal-darwin-13
|
6
|
+
authors:
|
7
|
+
- nysol
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-02-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake-compiler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: 'refer : http://www.nysol.jp/'
|
70
|
+
email:
|
71
|
+
- info@nysol.jp
|
72
|
+
executables:
|
73
|
+
- meach.rb
|
74
|
+
- meachc.rb
|
75
|
+
- mtempclean.rb
|
76
|
+
- mdistcopy.rb
|
77
|
+
- msend.rb
|
78
|
+
extensions:
|
79
|
+
- ext/mcsvin/extconf.rb
|
80
|
+
- ext/mcsvout/extconf.rb
|
81
|
+
- ext/mmethods/extconf.rb
|
82
|
+
- ext/mtable/extconf.rb
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- lib/nysol/margs.rb
|
86
|
+
- lib/nysol/mcmd.rb
|
87
|
+
- lib/nysol/mnettools.rb
|
88
|
+
- lib/nysol/mparallel.rb
|
89
|
+
- lib/nysol/mparallelmanager.rb
|
90
|
+
- lib/nysol/mrubyparse.rb
|
91
|
+
- lib/nysol/msysteminfo.rb
|
92
|
+
- lib/nysol/mtemp.rb
|
93
|
+
- lib/nysol/mutils.rb
|
94
|
+
- lib/nysol/mcsvin.bundle
|
95
|
+
- lib/nysol/mcsvout.bundle
|
96
|
+
- lib/nysol/mmethods.bundle
|
97
|
+
- lib/nysol/mtable.bundle
|
98
|
+
- bin/blueKiller.rb
|
99
|
+
- bin/mdistcopy.rb
|
100
|
+
- bin/meach.rb
|
101
|
+
- bin/meachc.rb
|
102
|
+
- bin/msend.rb
|
103
|
+
- bin/mtempclean.rb
|
104
|
+
- ext/mcsvin/extconf.rb
|
105
|
+
- ext/mcsvout/extconf.rb
|
106
|
+
- ext/mmethods/extconf.rb
|
107
|
+
- ext/mtable/extconf.rb
|
108
|
+
homepage: http://www.nysol.jp/
|
109
|
+
licenses: []
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '>='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.0.14
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Tools for nysol ruby tools
|
131
|
+
test_files: []
|