keystone 0.0.29
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/README +3 -0
- data/Rakefile +26 -0
- data/VERSION +1 -0
- data/doc/classes/Dir.html +139 -0
- data/doc/classes/Dir.src/M000003.html +25 -0
- data/doc/classes/FlagSetMaker.html +138 -0
- data/doc/classes/FlagSetMaker.src/M000018.html +18 -0
- data/doc/classes/FlagSetMaker/FlagSet.html +186 -0
- data/doc/classes/FlagSetMaker/FlagSet.src/M000019.html +24 -0
- data/doc/classes/FlagSetMaker/FlagSet.src/M000020.html +26 -0
- data/doc/classes/FlagSetMaker/FlagSet.src/M000021.html +18 -0
- data/doc/classes/FlagSetMaker/FlagSet.src/M000022.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.html +304 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000023.html +19 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000024.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000025.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000026.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000027.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000029.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000030.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000031.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000032.html +18 -0
- data/doc/classes/FlagSetMaker/Flags.src/M000033.html +18 -0
- data/doc/classes/Hoge.html +113 -0
- data/doc/classes/Keystone.html +174 -0
- data/doc/classes/Keystone/Base.html +191 -0
- data/doc/classes/Keystone/Base.src/M000054.html +22 -0
- data/doc/classes/Keystone/Base.src/M000055.html +18 -0
- data/doc/classes/Keystone/Base.src/M000056.html +25 -0
- data/doc/classes/Keystone/Base.src/M000057.html +18 -0
- data/doc/classes/Keystone/Base.src/M000058.html +20 -0
- data/doc/classes/Keystone/Batch.html +115 -0
- data/doc/classes/Keystone/Batch/Base.html +208 -0
- data/doc/classes/Keystone/Batch/Base.src/M000052.html +54 -0
- data/doc/classes/Keystone/Batch/Base.src/M000053.html +30 -0
- data/doc/classes/Keystone/CoreExt.html +105 -0
- data/doc/classes/Keystone/Mail.html +115 -0
- data/doc/classes/Keystone/Mail/Send.html +171 -0
- data/doc/classes/Keystone/Mail/Send.src/M000034.html +18 -0
- data/doc/classes/Keystone/Mail/Send.src/M000035.html +42 -0
- data/doc/classes/Keystone/Mail/Send.src/M000036.html +18 -0
- data/doc/classes/Keystone/Os.html +184 -0
- data/doc/classes/Keystone/Os.src/M000037.html +18 -0
- data/doc/classes/Keystone/Os.src/M000038.html +27 -0
- data/doc/classes/Keystone/Os/AbstractOs.html +227 -0
- data/doc/classes/Keystone/Os/AbstractOs.src/M000046.html +17 -0
- data/doc/classes/Keystone/Os/AbstractOs.src/M000047.html +17 -0
- data/doc/classes/Keystone/Os/AbstractOs.src/M000048.html +17 -0
- data/doc/classes/Keystone/Os/AbstractOs.src/M000049.html +17 -0
- data/doc/classes/Keystone/Os/AbstractOs.src/M000050.html +17 -0
- data/doc/classes/Keystone/Os/AbstractOs.src/M000051.html +25 -0
- data/doc/classes/Keystone/Os/Centos.html +113 -0
- data/doc/classes/Keystone/Os/Darwin.html +139 -0
- data/doc/classes/Keystone/Os/Darwin.src/M000039.html +18 -0
- data/doc/classes/Keystone/Os/Linux.html +139 -0
- data/doc/classes/Keystone/Os/Linux.src/M000045.html +26 -0
- data/doc/classes/Keystone/Os/Osx.html +113 -0
- data/doc/classes/Keystone/Os/Unix.html +199 -0
- data/doc/classes/Keystone/Os/Unix.src/M000040.html +27 -0
- data/doc/classes/Keystone/Os/Unix.src/M000041.html +18 -0
- data/doc/classes/Keystone/Os/Unix.src/M000042.html +18 -0
- data/doc/classes/Keystone/Os/Unix.src/M000043.html +18 -0
- data/doc/classes/Keystone/Os/Unix.src/M000044.html +18 -0
- data/doc/classes/Keystone/Rails.html +105 -0
- data/doc/classes/Keystone/StringUtil.html +226 -0
- data/doc/classes/Keystone/StringUtil.src/M000059.html +43 -0
- data/doc/classes/Keystone/StringUtil.src/M000060.html +25 -0
- data/doc/classes/Keystone/StringUtil.src/M000061.html +24 -0
- data/doc/classes/Keystone/StringUtil.src/M000062.html +18 -0
- data/doc/classes/Keystone/StringUtil.src/M000063.html +21 -0
- data/doc/classes/Object.html +240 -0
- data/doc/classes/Object.src/M000012.html +18 -0
- data/doc/classes/Object.src/M000013.html +20 -0
- data/doc/classes/Object.src/M000014.html +18 -0
- data/doc/classes/Object.src/M000015.html +18 -0
- data/doc/classes/Object.src/M000016.html +18 -0
- data/doc/classes/Object.src/M000017.html +19 -0
- data/doc/classes/Tempfile.html +139 -0
- data/doc/classes/Tempfile.src/M000011.html +25 -0
- data/doc/classes/TestCoreExt.html +152 -0
- data/doc/classes/TestCoreExt.src/M000009.html +17 -0
- data/doc/classes/TestCoreExt.src/M000010.html +21 -0
- data/doc/classes/TestStringUtilBase.html +197 -0
- data/doc/classes/TestStringUtilBase.src/M000004.html +17 -0
- data/doc/classes/TestStringUtilBase.src/M000005.html +23 -0
- data/doc/classes/TestStringUtilBase.src/M000006.html +22 -0
- data/doc/classes/TestStringUtilBase.src/M000007.html +25 -0
- data/doc/classes/TestStringUtilBase.src/M000008.html +34 -0
- data/doc/classes/Uri.html +158 -0
- data/doc/classes/Uri.src/M000001.html +18 -0
- data/doc/classes/Uri.src/M000002.html +18 -0
- data/doc/created.rid +1 -0
- data/doc/files/example/batch_sample_rb.html +134 -0
- data/doc/files/example/os_rb.html +109 -0
- data/doc/files/example/string_util_rb.html +109 -0
- data/doc/files/lib/keystone/base_rb.html +101 -0
- data/doc/files/lib/keystone/batch/base_rb.html +108 -0
- data/doc/files/lib/keystone/batch_rb.html +101 -0
- data/doc/files/lib/keystone/core_ext/array_rb.html +101 -0
- data/doc/files/lib/keystone/core_ext/blank_rb.html +101 -0
- data/doc/files/lib/keystone/core_ext/dir_rb.html +101 -0
- data/doc/files/lib/keystone/core_ext/object_rb.html +101 -0
- data/doc/files/lib/keystone/core_ext/tempfile_rb.html +108 -0
- data/doc/files/lib/keystone/core_ext/uri_rb.html +101 -0
- data/doc/files/lib/keystone/core_ext_rb.html +113 -0
- data/doc/files/lib/keystone/mail/send_rb.html +115 -0
- data/doc/files/lib/keystone/mail_rb.html +101 -0
- data/doc/files/lib/keystone/os/abstract_os_rb.html +101 -0
- data/doc/files/lib/keystone/os/centos_rb.html +101 -0
- data/doc/files/lib/keystone/os/darwin_rb.html +101 -0
- data/doc/files/lib/keystone/os/linux_rb.html +101 -0
- data/doc/files/lib/keystone/os/osx_rb.html +101 -0
- data/doc/files/lib/keystone/os/unix_rb.html +101 -0
- data/doc/files/lib/keystone/os_rb.html +108 -0
- data/doc/files/lib/keystone/string_util_rb.html +101 -0
- data/doc/files/lib/keystone_rb.html +116 -0
- data/doc/files/test/test_core_ext_rb.html +110 -0
- data/doc/files/test/test_string_util_rb.html +112 -0
- data/doc/files/vendor/flag_set_maker_rb.html +108 -0
- data/doc/files/vendor/moji_rb.html +118 -0
- data/doc/fr_class_index.html +52 -0
- data/doc/fr_file_index.html +54 -0
- data/doc/fr_method_index.html +89 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/example/batch_sample.rb +24 -0
- data/example/os.rb +4 -0
- data/example/sendmail.rb +21 -0
- data/example/string_util.rb +15 -0
- data/keystone.gemspec +209 -0
- data/lib/keystone.rb +25 -0
- data/lib/keystone/base.rb +75 -0
- data/lib/keystone/batch.rb +5 -0
- data/lib/keystone/batch/base.rb +217 -0
- data/lib/keystone/core_ext.rb +18 -0
- data/lib/keystone/core_ext/array.rb +29 -0
- data/lib/keystone/core_ext/blank.rb +44 -0
- data/lib/keystone/core_ext/dir.rb +16 -0
- data/lib/keystone/core_ext/ipaddr.rb +18 -0
- data/lib/keystone/core_ext/object.rb +34 -0
- data/lib/keystone/core_ext/tempfile.rb +14 -0
- data/lib/keystone/core_ext/uri.rb +14 -0
- data/lib/keystone/mail.rb +8 -0
- data/lib/keystone/mail/address.rb +92 -0
- data/lib/keystone/mail/content_type.rb +60 -0
- data/lib/keystone/mail/message.rb +102 -0
- data/lib/keystone/mail/message_factory.rb +18 -0
- data/lib/keystone/mail/message_iso2022jp.rb +126 -0
- data/lib/keystone/mail/message_sjis.rb +23 -0
- data/lib/keystone/mail/receive.rb +320 -0
- data/lib/keystone/mail/send.rb +83 -0
- data/lib/keystone/os.rb +26 -0
- data/lib/keystone/os/abstract_os.rb +36 -0
- data/lib/keystone/os/centos.rb +6 -0
- data/lib/keystone/os/darwin.rb +9 -0
- data/lib/keystone/os/linux.rb +15 -0
- data/lib/keystone/os/osx.rb +18 -0
- data/lib/keystone/os/unix.rb +43 -0
- data/lib/keystone/string_util.rb +85 -0
- data/test/test_core_ext.rb +15 -0
- data/test/test_string_util.rb +60 -0
- data/util/README +1 -0
- data/util/bin/command_broadcast.rb +137 -0
- data/util/bin/disk_size_check.rb +54 -0
- data/util/bin/notice +93 -0
- data/util/bin/ve2tar.rb +80 -0
- data/vendor/flag_set_maker.rb +121 -0
- data/vendor/moji.rb +502 -0
- metadata +236 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>log (Keystone::Base)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/keystone/base.rb, line 3</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">log</span>(<span class="ruby-identifier">log_type</span>,<span class="ruby-identifier">message</span>, <span class="ruby-identifier">is_base_info</span> = <span class="ruby-keyword kw">true</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">is_base_info</span>
|
16
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"[#{Time.now.strftime("%Y/%m/%d %H:%M:%S")}][#{$$}][#{log_type.to_s}] #{message}"</span>
|
17
|
+
<span class="ruby-keyword kw">else</span>
|
18
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"[#{log_type.to_s}] #{message}"</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
<span class="ruby-keyword kw">end</span></pre>
|
21
|
+
</body>
|
22
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>info (Keystone::Base)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/keystone/base.rb, line 11</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">info</span>(<span class="ruby-identifier">message</span>)
|
15
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">:INFO</span>,<span class="ruby-identifier">message</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>error (Keystone::Base)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/keystone/base.rb, line 15</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error</span>(<span class="ruby-identifier">message</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">message</span>.<span class="ruby-identifier">is_a?</span> <span class="ruby-constant">Exception</span>
|
16
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">:ERROR</span>,<span class="ruby-node">"#{message.message}"</span>)
|
17
|
+
<span class="ruby-identifier">message</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">each_with_index</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">line</span>, <span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
|
18
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">:ERROR</span>,<span class="ruby-node">"#{line})"</span>,<span class="ruby-keyword kw">false</span>)
|
19
|
+
}
|
20
|
+
<span class="ruby-keyword kw">else</span>
|
21
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">:ERROR</span>,<span class="ruby-identifier">message</span>.<span class="ruby-identifier">to_s</span>)
|
22
|
+
<span class="ruby-keyword kw">end</span>
|
23
|
+
<span class="ruby-keyword kw">end</span></pre>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>warn (Keystone::Base)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/keystone/base.rb, line 26</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">warn</span>(<span class="ruby-identifier">message</span>)
|
15
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">:WARN</span>,<span class="ruby-identifier">message</span>)
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>debug (Keystone::Base)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/keystone/base.rb, line 30</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">debug</span>(<span class="ruby-identifier">message</span>)
|
15
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$DEBUG</span>
|
16
|
+
<span class="ruby-identifier">log</span>(<span class="ruby-identifier">:DEBUG</span>,<span class="ruby-identifier">message</span>)
|
17
|
+
<span class="ruby-keyword kw">end</span>
|
18
|
+
<span class="ruby-keyword kw">end</span></pre>
|
19
|
+
</body>
|
20
|
+
</html>
|
@@ -0,0 +1,115 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Keystone::Batch</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Keystone::Batch</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/keystone/batch/base_rb.html">
|
59
|
+
lib/keystone/batch/base.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
<a href="../../files/lib/keystone/batch_rb.html">
|
63
|
+
lib/keystone/batch.rb
|
64
|
+
</a>
|
65
|
+
<br />
|
66
|
+
</td>
|
67
|
+
</tr>
|
68
|
+
|
69
|
+
</table>
|
70
|
+
</div>
|
71
|
+
<!-- banner header -->
|
72
|
+
|
73
|
+
<div id="bodyContent">
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
<div id="contextContent">
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
</div>
|
82
|
+
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
|
87
|
+
<!-- if includes -->
|
88
|
+
|
89
|
+
<div id="section">
|
90
|
+
|
91
|
+
<div id="class-list">
|
92
|
+
<h3 class="section-bar">Classes and Modules</h3>
|
93
|
+
|
94
|
+
Module <a href="Batch/Base.html" class="link">Keystone::Batch::Base</a><br />
|
95
|
+
|
96
|
+
</div>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<!-- if method_list -->
|
105
|
+
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
|
110
|
+
<div id="validator-badges">
|
111
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
112
|
+
</div>
|
113
|
+
|
114
|
+
</body>
|
115
|
+
</html>
|
@@ -0,0 +1,208 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Module: Keystone::Batch::Base</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Module</strong></td>
|
53
|
+
<td class="class-name-in-header">Keystone::Batch::Base</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../../files/lib/keystone/batch/base_rb.html">
|
59
|
+
lib/keystone/batch/base.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
</table>
|
66
|
+
</div>
|
67
|
+
<!-- banner header -->
|
68
|
+
|
69
|
+
<div id="bodyContent">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
<div id="contextContent">
|
74
|
+
|
75
|
+
<div id="description">
|
76
|
+
<h1>バッチをざくっと書きたい時用モジュール</h1>
|
77
|
+
<p>
|
78
|
+
基本的には<a
|
79
|
+
href="Base.html#M000052">execute</a>メソッドにバッチ処理をブロックで渡す
|
80
|
+
</p>
|
81
|
+
<h2>定数</h2>
|
82
|
+
<p>
|
83
|
+
ERROR_MAIL_TO (エラーメール送信先)
|
84
|
+
設定しておけば自動でエラーメールを送信してくれる
|
85
|
+
</p>
|
86
|
+
<p>
|
87
|
+
ERROR_MAIL_FROM (エラーメール送信元)
|
88
|
+
設定されてない場合はERROR_MAIL_TOを使用
|
89
|
+
</p>
|
90
|
+
<p>
|
91
|
+
ERROR_MAIL_STMP_ADDR (エラーメール送信SMTPアドレス)
|
92
|
+
設定されてない場合は"127.0.0.1"
|
93
|
+
</p>
|
94
|
+
<p>
|
95
|
+
ERROR_MAIL_STMP_PORT (エラーメール送信SMTPポート)
|
96
|
+
設定されてない場合は25
|
97
|
+
</p>
|
98
|
+
|
99
|
+
</div>
|
100
|
+
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<div id="method-list">
|
105
|
+
<h3 class="section-bar">Methods</h3>
|
106
|
+
|
107
|
+
<div class="name-list">
|
108
|
+
<a href="#M000052">execute</a>
|
109
|
+
<a href="#M000053">send_error_mail</a>
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
|
116
|
+
<!-- if includes -->
|
117
|
+
|
118
|
+
<div id="section">
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
<!-- if method_list -->
|
128
|
+
<div id="methods">
|
129
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
130
|
+
|
131
|
+
<div id="method-M000052" class="method-detail">
|
132
|
+
<a name="M000052"></a>
|
133
|
+
|
134
|
+
<div class="method-heading">
|
135
|
+
<a href="Base.src/M000052.html" target="Code" class="method-signature"
|
136
|
+
onclick="popupCode('Base.src/M000052.html');return false;">
|
137
|
+
<span class="method-name">execute</span><span class="method-args">(double_process_check = true,auto_recover = true) {|process)| ...}</span>
|
138
|
+
</a>
|
139
|
+
</div>
|
140
|
+
|
141
|
+
<div class="method-description">
|
142
|
+
<dl>
|
143
|
+
<dt>double_process_check</dt><dd>2重起動チェック
|
144
|
+
|
145
|
+
</dd>
|
146
|
+
<dt>auto_recover</dt><dd>2重起動チェック用のpidファイルがすでに存在しているがプロセスは見あたらない
|
147
|
+
そんな時、そのまま実行を続けるかどうか
|
148
|
+
|
149
|
+
</dd>
|
150
|
+
</dl>
|
151
|
+
<p>
|
152
|
+
バッチの主処理をこのメソッドへのブロック引数として定義してください
|
153
|
+
</p>
|
154
|
+
<pre>
|
155
|
+
require 'rubygems'
|
156
|
+
require 'keystone'
|
157
|
+
|
158
|
+
include Keystone::Batch::Base
|
159
|
+
|
160
|
+
# ERROR_MAIL_TOを設定しておけば自動でエラーメールが送信される
|
161
|
+
ERROR_MAIL_TO = ARGV[0]
|
162
|
+
|
163
|
+
execute() do
|
164
|
+
info "batch process01"
|
165
|
+
end
|
166
|
+
</pre>
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
|
170
|
+
<div id="method-M000053" class="method-detail">
|
171
|
+
<a name="M000053"></a>
|
172
|
+
|
173
|
+
<div class="method-heading">
|
174
|
+
<a href="Base.src/M000053.html" target="Code" class="method-signature"
|
175
|
+
onclick="popupCode('Base.src/M000053.html');return false;">
|
176
|
+
<span class="method-name">send_error_mail</span><span class="method-args">(exception)</span>
|
177
|
+
</a>
|
178
|
+
</div>
|
179
|
+
|
180
|
+
<div class="method-description">
|
181
|
+
<h1>エラーメール送信メソッド</h1>
|
182
|
+
<pre>
|
183
|
+
エクセプションを何も考えずにメールにて送信する
|
184
|
+
</pre>
|
185
|
+
<p>
|
186
|
+
各種メール送信属性は定数にて渡す
|
187
|
+
</p>
|
188
|
+
<dl>
|
189
|
+
<dt>exception</dt><dd>エクセプションクラスインスタンス
|
190
|
+
|
191
|
+
</dd>
|
192
|
+
</dl>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
</div>
|
201
|
+
|
202
|
+
|
203
|
+
<div id="validator-badges">
|
204
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
</body>
|
208
|
+
</html>
|
@@ -0,0 +1,54 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>execute (Keystone::Batch::Base)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
10
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File lib/keystone/batch/base.rb, line 42</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">execute</span>(<span class="ruby-identifier">double_process_check</span> = <span class="ruby-keyword kw">true</span>,<span class="ruby-identifier">auto_recover</span> = <span class="ruby-keyword kw">true</span>,<span class="ruby-operator">&</span><span class="ruby-identifier">process</span>)
|
15
|
+
<span class="ruby-identifier">info</span> <span class="ruby-node">"start script(#{File.expand_path($0)})"</span>
|
16
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-value str">"ERROR_MAIL_TO not defined.if you want error mail automatically,set this value."</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-constant">Module</span>.<span class="ruby-identifier">constants</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-value str">"ERROR_MAIL_TO"</span>)
|
17
|
+
<span class="ruby-identifier">script_started_at</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
18
|
+
<span class="ruby-keyword kw">begin</span>
|
19
|
+
<span class="ruby-comment cmt"># double process check</span>
|
20
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_process_check</span>
|
21
|
+
<span class="ruby-identifier">pg_path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">$0</span>)
|
22
|
+
<span class="ruby-identifier">pg_name</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">basename</span>(<span class="ruby-identifier">pg_path</span>)
|
23
|
+
<span class="ruby-identifier">hash</span> = <span class="ruby-constant">Digest</span><span class="ruby-operator">::</span><span class="ruby-constant">MD5</span>.<span class="ruby-identifier">hexdigest</span>(<span class="ruby-identifier">pg_path</span>)
|
24
|
+
<span class="ruby-identifier">pid_file</span> = <span class="ruby-node">"/tmp/.#{pg_name}.#{hash}.pid"</span>
|
25
|
+
<span class="ruby-identifier">debug</span> <span class="ruby-identifier">pid_file</span>
|
26
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">pid_file</span>)
|
27
|
+
<span class="ruby-identifier">pid</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">pid_file</span>).<span class="ruby-identifier">read</span>.<span class="ruby-identifier">chomp</span>
|
28
|
+
<span class="ruby-identifier">pid_list</span> = <span class="ruby-value">`ps -e | awk '{print $1}'`</span>
|
29
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid_list</span> <span class="ruby-operator">=~</span> <span class="ruby-node">/#{pid}/</span>
|
30
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-node">"pid:#{pid} still running"</span>
|
31
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
|
32
|
+
<span class="ruby-keyword kw">else</span>
|
33
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">auto_recover</span>
|
34
|
+
<span class="ruby-identifier">warn</span> <span class="ruby-value str">"pid file still exists,but process does not found.so process continues"</span>
|
35
|
+
<span class="ruby-keyword kw">else</span>
|
36
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"pid file still exists,but process does not found"</span>
|
37
|
+
<span class="ruby-keyword kw">end</span>
|
38
|
+
<span class="ruby-keyword kw">end</span>
|
39
|
+
<span class="ruby-keyword kw">end</span>
|
40
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">pid_file</span>, <span class="ruby-value str">"w"</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">file</span><span class="ruby-operator">|</span>
|
41
|
+
<span class="ruby-identifier">file</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">$$</span>
|
42
|
+
}
|
43
|
+
<span class="ruby-keyword kw">end</span>
|
44
|
+
<span class="ruby-keyword kw">return</span> (<span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">process</span>)
|
45
|
+
<span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
46
|
+
<span class="ruby-identifier">error</span> <span class="ruby-identifier">e</span>
|
47
|
+
<span class="ruby-identifier">send_error_mail</span>(<span class="ruby-identifier">e</span>)
|
48
|
+
<span class="ruby-keyword kw">ensure</span>
|
49
|
+
<span class="ruby-constant">File</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">pid_file</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_process_check</span>
|
50
|
+
<span class="ruby-identifier">info</span> <span class="ruby-value str">"finish script (%1.3fsec)"</span> <span class="ruby-operator">%</span> (<span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">script_started_at</span>)
|
51
|
+
<span class="ruby-keyword kw">end</span>
|
52
|
+
<span class="ruby-keyword kw">end</span></pre>
|
53
|
+
</body>
|
54
|
+
</html>
|