kanamei-keystone 0.0.12 → 0.0.14
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.
- data/lib/keystone.rb +1 -1
- data/lib/keystone/batch/base.rb +8 -3
- data/lib/keystone/string_util.rb +17 -0
- metadata +2 -2
data/lib/keystone.rb
CHANGED
data/lib/keystone/batch/base.rb
CHANGED
|
@@ -40,14 +40,19 @@ module Keystone::Batch
|
|
|
40
40
|
# end
|
|
41
41
|
#
|
|
42
42
|
def execute(double_process_check = true,auto_recover = true,&process)
|
|
43
|
-
|
|
43
|
+
debug "caller=#{caller}"
|
|
44
|
+
pg_path = if File.expand_path(caller[0]) =~ /(.*):\d*\z/
|
|
45
|
+
$1
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
info "start script(#{pg_path})"
|
|
44
49
|
warn "ERROR_MAIL_TO not defined.if you want error mail automatically,set this value." unless Module.constants.include?("ERROR_MAIL_TO")
|
|
45
50
|
script_started_at = Time.now
|
|
46
51
|
double_process_check_worked = false
|
|
47
52
|
begin
|
|
48
53
|
# double process check
|
|
49
54
|
if double_process_check
|
|
50
|
-
pg_path = File.expand_path($0)
|
|
55
|
+
#pg_path = File.expand_path($0)
|
|
51
56
|
pg_name = File.basename(pg_path)
|
|
52
57
|
hash = Digest::MD5.hexdigest(pg_path)
|
|
53
58
|
pid_file = "/tmp/.#{pg_name}.#{hash}.pid"
|
|
@@ -95,7 +100,7 @@ module Keystone::Batch
|
|
|
95
100
|
def send_error_mail(exception)
|
|
96
101
|
if Module.constants.include?("ERROR_MAIL_TO")
|
|
97
102
|
host = Keystone::Os.get()
|
|
98
|
-
title = %|error occur at "#{host.hostname}" [#{
|
|
103
|
+
title = %|error occur at "#{host.hostname}" [#{exception.message}]|
|
|
99
104
|
|
|
100
105
|
mail_to = ERROR_MAIL_TO
|
|
101
106
|
mail_to = [mail_to] if mail_to.is_a?(String)
|
data/lib/keystone/string_util.rb
CHANGED
|
@@ -71,5 +71,22 @@ module Keystone
|
|
|
71
71
|
Moji.zen_to_han(str,Moji::ZEN_ALNUM | Moji::ZEN_SYMBOL).downcase,Moji::HAN_KATA | Moji::HAN_JSYMBOL)
|
|
72
72
|
)
|
|
73
73
|
end
|
|
74
|
+
|
|
75
|
+
#
|
|
76
|
+
#
|
|
77
|
+
# 指定された文字列より[A-z0-9-_.]以外を取り除く
|
|
78
|
+
#
|
|
79
|
+
#
|
|
80
|
+
#
|
|
81
|
+
def to_fileable_st(st)
|
|
82
|
+
st.gsub(/[^\w\-_\.]/,"")
|
|
83
|
+
end
|
|
74
84
|
end
|
|
75
85
|
end
|
|
86
|
+
|
|
87
|
+
p "t!!est".gsub(/[^0-9A-Za-z_\-\.]/,"_")
|
|
88
|
+
p "日_本.-語t!!est".gsub(/[^0-9A-Za-z_\-\.]/,"_")
|
|
89
|
+
p "日本語t!!est".gsub(/[^0-9A-Za-z_\-\.]/,"_")
|
|
90
|
+
p "日本語t!!est".gsub(/[^0-9A-Za-z_\-\.]/,"_")
|
|
91
|
+
p "日本語t!!est".gsub(/[^0-9A-Za-z_\-\.]/,"_")
|
|
92
|
+
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kanamei-keystone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- kanamei
|
|
@@ -9,7 +9,7 @@ autorequire:
|
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
11
|
|
|
12
|
-
date: 2009-
|
|
12
|
+
date: 2009-04-01 00:00:00 -07:00
|
|
13
13
|
default_executable:
|
|
14
14
|
dependencies: []
|
|
15
15
|
|