ro_support 0.0.4

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.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +21 -0
  5. data/lib/ro_support/array.rb +32 -0
  6. data/lib/ro_support/bash.rb +27 -0
  7. data/lib/ro_support/debug.rb +80 -0
  8. data/lib/ro_support/file_actions.rb +40 -0
  9. data/lib/ro_support/git.rb +64 -0
  10. data/lib/ro_support/log.rb +15 -0
  11. data/lib/ro_support/misc/zw.rb +46 -0
  12. data/lib/ro_support/misc.rb +51 -0
  13. data/lib/ro_support/module.rb +10 -0
  14. data/lib/ro_support/spec.rb +46 -0
  15. data/lib/ro_support/ssh.rb +4 -0
  16. data/lib/ro_support/string_handler/common.rb +40 -0
  17. data/lib/ro_support/string_handler.rb +13 -0
  18. data/lib/ro_support/thor.rb +10 -0
  19. data/lib/ro_support/version.rb +3 -0
  20. data/lib/ro_support.rb +23 -0
  21. data/lib/tasks/roro_support_tasks.rake +4 -0
  22. data/spec/fixtures/baidu.html +440 -0
  23. data/spec/fixtures/for_log/ro.log +2 -0
  24. data/spec/fixtures/for_misc_file_utils/create_dir_file/try.rb +0 -0
  25. data/spec/fixtures/sample/try1.rb +3 -0
  26. data/spec/fixtures/sample/try2.rb +3 -0
  27. data/spec/fixtures/sample/try3.rb +3 -0
  28. data/spec/lib/roro_support/array_spec.rb +27 -0
  29. data/spec/lib/roro_support/bash_spec.rb +4 -0
  30. data/spec/lib/roro_support/debug_spec.rb +42 -0
  31. data/spec/lib/roro_support/file_actions_spec.rb +10 -0
  32. data/spec/lib/roro_support/git_spec.rb +23 -0
  33. data/spec/lib/roro_support/log/ro.log +23 -0
  34. data/spec/lib/roro_support/log/roro.log +63 -0
  35. data/spec/lib/roro_support/log_spec.rb +15 -0
  36. data/spec/lib/roro_support/misc/zw_spec.rb +55 -0
  37. data/spec/lib/roro_support/misc_spec.rb +37 -0
  38. data/spec/lib/roro_support/module_spec.rb +15 -0
  39. data/spec/lib/roro_support/string_handler_spec.rb +17 -0
  40. data/spec/lib/roro_support_spec.rb +7 -0
  41. data/spec/spec_helper.rb +29 -0
  42. metadata +201 -0
@@ -0,0 +1,440 @@
1
+ <!DOCTYPE html><!--STATUS OK-->
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="content-type" content="text/html;charset=utf-8">
5
+ <title>百度一下,你就知道</title>
6
+ <style>html, body {
7
+ height: 100%
8
+ }
9
+
10
+ html {
11
+ overflow-y: auto
12
+ }
13
+
14
+ #wrapper {
15
+ position: relative;
16
+ _position:;
17
+ min-height: 100%
18
+ }
19
+
20
+ #content {
21
+ padding-bottom: 100px;
22
+ text-align: center
23
+ }
24
+
25
+ #ftCon {
26
+ height: 100px;
27
+ position: absolute;
28
+ bottom: 44px;
29
+ text-align: center;
30
+ width: 100%;
31
+ margin: 0 auto;
32
+ z-index: 0;
33
+ overflow: hidden
34
+ }
35
+
36
+ #ftConw {
37
+ width: 720px;
38
+ margin: 0 auto
39
+ }
40
+
41
+ body {
42
+ font: 12px arial;
43
+ text-align:;
44
+ background: #fff
45
+ }
46
+
47
+ body, p, form, ul, li {
48
+ margin: 0;
49
+ padding: 0;
50
+ list-style: none
51
+ }
52
+
53
+ body, form, #fm {
54
+ position: relative
55
+ }
56
+
57
+ td {
58
+ text-align: left
59
+ }
60
+
61
+ img {
62
+ border: 0
63
+ }
64
+
65
+ a {
66
+ color: #00c
67
+ }
68
+
69
+ a:active {
70
+ color: #f60
71
+ }
72
+
73
+ #u {
74
+ color: #999;
75
+ padding: 4px 10px 5px 0;
76
+ text-align: right
77
+ }
78
+
79
+ #u a {
80
+ margin: 0 5px
81
+ }
82
+
83
+ #u .reg {
84
+ margin: 0
85
+ }
86
+
87
+ #m {
88
+ width: 720px;
89
+ margin: 0 auto
90
+ }
91
+
92
+ #nv a, #nv b, .btn, #lk {
93
+ font-size: 14px
94
+ }
95
+
96
+ #fm {
97
+ padding-left: 110px;
98
+ text-align: left;
99
+ z-index: 1
100
+ }
101
+
102
+ input {
103
+ border: 0;
104
+ padding: 0
105
+ }
106
+
107
+ #nv {
108
+ height: 19px;
109
+ font-size: 16px;
110
+ margin: 0 0 4px;
111
+ text-align: left;
112
+ text-indent: 137px
113
+ }
114
+
115
+ .s_ipt_wr {
116
+ width: 418px;
117
+ height: 30px;
118
+ display: inline-block;
119
+ margin-right: 5px;
120
+ background: url(/img/i-1.0.0.png) no-repeat -304px 0;
121
+ border: 1px solid #b6b6b6;
122
+ border-color: #9a9a9a #cdcdcd #cdcdcd #9a9a9a;
123
+ vertical-align: top
124
+ }
125
+
126
+ .s_ipt {
127
+ width: 405px;
128
+ height: 22px;
129
+ font: 16px/22px arial;
130
+ margin: 5px 0 0 7px;
131
+ background: #fff;
132
+ outline: 0;
133
+ -webkit-appearance: none
134
+ }
135
+
136
+ .s_btn {
137
+ width: 95px;
138
+ height: 32px;
139
+ padding-top: 2 px\9;
140
+ font-size: 14px;
141
+ background: #ddd url(/img/i-1.0.0.png);
142
+ cursor: pointer
143
+ }
144
+
145
+ .s_btn_h {
146
+ background-position: -100px 0
147
+ }
148
+
149
+ .s_btn_wr {
150
+ width: 97px;
151
+ height: 34px;
152
+ display: inline-block;
153
+ background: url(/img/i-1.0.0.png) no-repeat -202px 0;
154
+ *position: relative;
155
+ z-index: 0;
156
+ vertical-align: top
157
+ }
158
+
159
+ #lg img {
160
+ vertical-align: top;
161
+ margin-bottom: 3px
162
+ }
163
+
164
+ #lk {
165
+ margin: 33px 0
166
+ }
167
+
168
+ #lk span {
169
+ font: 14px "宋体"
170
+ }
171
+
172
+ #lm {
173
+ height: 60px
174
+ }
175
+
176
+ #lh {
177
+ margin: 16px 0 5px;
178
+ word-spacing: 3px
179
+ }
180
+
181
+ .tools {
182
+ position: absolute;
183
+ top: -4px;
184
+ *top: 10px;
185
+ right: 7px
186
+ }
187
+
188
+ #mHolder {
189
+ width: 62px;
190
+ position: relative;
191
+ z-index: 296;
192
+ display: none
193
+ }
194
+
195
+ #mCon {
196
+ height: 18px;
197
+ line-height: 18px;
198
+ position: absolute;
199
+ cursor: pointer;
200
+ padding: 0 18px 0 0;
201
+ background: url(/img/bg-1.0.0.gif) no-repeat right -134px;
202
+ background-position: right -136 px\9
203
+ }
204
+
205
+ #mCon span {
206
+ color: #00c;
207
+ cursor: default;
208
+ display: block
209
+ }
210
+
211
+ #mCon .hw {
212
+ text-decoration: underline;
213
+ cursor: pointer
214
+ }
215
+
216
+ #mMenu a {
217
+ width: 100%;
218
+ height: 100%;
219
+ display: block;
220
+ line-height: 22px;
221
+ text-indent: 6px;
222
+ text-decoration: none;
223
+ filter: none\9
224
+ }
225
+
226
+ #mMenu, #user ul {
227
+ box-shadow: 1px 1px 2px #ccc;
228
+ -moz-box-shadow: 1px 1px 2px #ccc;
229
+ -webkit-box-shadow: 1px 1px 2px #ccc;
230
+ filter: progid:DXImageTransform.Microsoft.Shadow(Strength=2, Direction=135, Color="#cccccc") \9
231
+ }
232
+
233
+ #mMenu {
234
+ width: 56px;
235
+ border: 1px solid #9b9b9b;
236
+ list-style: none;
237
+ position: absolute;
238
+ right: 27px;
239
+ top: 28px;
240
+ display: none;
241
+ background: #fff
242
+ }
243
+
244
+ #mMenu a:hover {
245
+ background: #ebebeb
246
+ }
247
+
248
+ #mMenu .ln {
249
+ height: 1px;
250
+ background: #ebebeb;
251
+ overflow: hidden;
252
+ font-size: 1px;
253
+ line-height: 1px;
254
+ margin-top: -1px
255
+ }
256
+
257
+ #cp, #cp a {
258
+ color: #666
259
+ }
260
+
261
+ #seth {
262
+ display: none;
263
+ behavior: url(#default#homepage)
264
+ }
265
+
266
+ #setf {
267
+ display: none
268
+ }
269
+
270
+ #sekj {
271
+ margin-left: 14px
272
+ }
273
+
274
+ #shouji {
275
+ margin-right: 14px
276
+ }</style>
277
+ <script>function h(obj) {
278
+ obj.style.behavior = 'url(#default#homepage)';
279
+ var a = obj.setHomePage('http://www.baidu.com/');
280
+ }</script>
281
+ </head>
282
+ <body>
283
+ <div id="wrapper">
284
+ <div id="content">
285
+ <div id="u"><a href="http://www.baidu.com/gaoji/preferences.html" name="tj_setting">搜索设置</a>|<a
286
+ href="https://passport.baidu.com/v2/?login&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F" name="tj_login" id="lb"
287
+ onclick="return false;">登录</a><a
288
+ href="https://passport.baidu.com/v2/?reg&regType=1&tpl=mn&u=http%3A%2F%2Fwww.baidu.com%2F" target="_blank"
289
+ name="tj_reg" class="reg">注册</a></div>
290
+ <div id="m"><p id="lg"><img src="http://www.baidu.com/img/bdlogo.gif" width="270" height="129"></p>
291
+
292
+ <p id="nv"><a href="http://news.baidu.com">新&nbsp;闻</a> <b>网&nbsp;页</b> <a
293
+ href="http://tieba.baidu.com">贴&nbsp;吧</a> <a href="http://zhidao.baidu.com">知&nbsp;道</a> <a
294
+ href="http://music.baidu.com">音&nbsp;乐</a> <a href="http://image.baidu.com">图&nbsp;片</a> <a
295
+ href="http://v.baidu.com">视&nbsp;频</a> <a href="http://map.baidu.com">地&nbsp;图</a></p>
296
+
297
+ <div id="fm">
298
+ <form name="f" action="/s"><span class="s_ipt_wr"><input type="text" name="wd" id="kw" maxlength="100"
299
+ class="s_ipt"></span><input type="hidden" name="rsv_bp"
300
+ value="0"><input
301
+ type=hidden name=ch value=""><input type=hidden name=tn value="baidu"><input type=hidden name=bar
302
+ value=""><input type="hidden"
303
+ name="rsv_spt"
304
+ value="3"><input
305
+ type="hidden" name="ie" value="utf-8"><span class="s_btn_wr"><input type="submit" value="百度一下" id="su"
306
+ class="s_btn"
307
+ onmousedown="this.className='s_btn s_btn_h'"
308
+ onmouseout="this.className='s_btn'"></span>
309
+ </form>
310
+ <span class="tools"><span id="mHolder"><div id="mCon"><span>输入法</span></div></span></span>
311
+ <ul id="mMenu">
312
+ <li><a href="#" name="ime_hw">手写</a></li>
313
+ <li><a href="#" name="ime_py">拼音</a></li>
314
+ <li class="ln"></li>
315
+ <li><a href="#" name="ime_cl">关闭</a></li>
316
+ </ul>
317
+ </div>
318
+ <p id="lk"><a href="http://baike.baidu.com">百科</a> <a href="http://wenku.baidu.com">文库</a> <a
319
+ href="http://www.hao123.com">hao123</a><span>&nbsp;|&nbsp;<a href="http://www.baidu.com/more/">更多&gt;&gt;</a></span>
320
+ </p>
321
+
322
+ <p id="lm"></p></div>
323
+ </div>
324
+ <div id="ftCon">
325
+ <div id="ftConw"><p><a id="seth" onClick="h(this)" href="/"
326
+ onmousedown="return ns_c({'fm':'behs','tab':'homepage','pos':0})">把百度设为主页</a><a id="setf"
327
+ href="http://www.baidu.com/cache/sethelp/index.html"
328
+ onmousedown="return ns_c({'fm':'behs','tab':'favorites','pos':0})"
329
+ target="_blank">把百度设为主页</a><span
330
+ id="sekj"><a href="http://liulanqi.baidu.com/ps.php" target="_blank"
331
+ onmousedown="return ns_c({'fm':'behs','tab':'bdbrwlk','pos':1})">安装百度浏览器</a></span></p>
332
+
333
+ <p id="lh"><a href="http://e.baidu.com/?refer=888"
334
+ onmousedown="return ns_c({'fm':'behs','tab':'btlink','pos':2})">加入百度推广</a>&nbsp;|&nbsp;<a
335
+ onmousedown="return ns_c({'fm':'behs','tab':'tj_bang'})" href="http://top.baidu.com">搜索风云榜</a>&nbsp;|&nbsp;<a
336
+ onmousedown="return ns_c({'fm':'behs','tab':'tj_about'})" href="http://home.baidu.com">关于百度</a>&nbsp;|&nbsp;<a
337
+ onmousedown="return ns_c({'fm':'behs','tab':'tj_about_en'})" href="http://ir.baidu.com">About Baidu</a></p>
338
+
339
+ <p id="cp">&copy;2013&nbsp;Baidu&nbsp;<a href="/duty/" name="tj_duty">使用百度前必读</a>&nbsp;京ICP证030173号&nbsp;<img
340
+ src="http://www.baidu.com/cache/global/img/gs.gif"></p></div>
341
+ </div>
342
+ </div>
343
+ </body>
344
+ <script>var bds = {se: {}, comm: {ishome: 1, sid: "3146_1451_2784_2981_3225", user: "", username: "", sugHost: "http://esug.baidu.com/su", personalData: "", loginAction: []}}</script>
345
+ <script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/static/global/js/home_299f7566.js"
346
+ charset="utf-8"></script>
347
+ <script>var bdUser = null;
348
+ var w = window, d = document, n = navigator, k = d.f.wd, a = d.getElementById("nv").getElementsByTagName("a"), isIE = n.userAgent.indexOf("MSIE") != -1 && !window.opera;
349
+ (function () {
350
+ if (/q=([^&]+)/.test(location.search)) {
351
+ k.value = decodeURIComponent(RegExp["\x241"])
352
+ }
353
+ })();
354
+ if (n.cookieEnabled) {
355
+ bds.se.sug();
356
+ }
357
+ ;
358
+ function addEV(o, e, f) {
359
+ if (w.attachEvent) {
360
+ o.attachEvent("on" + e, f);
361
+ } else if (w.addEventListener) {
362
+ o.addEventListener(e, f, false);
363
+ }
364
+ }
365
+ function G(id) {
366
+ return d.getElementById(id);
367
+ }
368
+ function ns_c(q) {
369
+ var p = encodeURIComponent(window.document.location.href), sQ = '', sV = '', mu = '', img = window["BD_PS_C" + (new Date()).getTime()] = new Image();
370
+ for (v in q) {
371
+ sV = q[v];
372
+ sQ += v + "=" + sV + "&";
373
+ }
374
+ mu = "&mu=" + p;
375
+ img.src = "http://nsclick.baidu.com/v.gif?pid=201&pj=www&rsv_sid=3146_1451_2784_2981_3225&" + sQ + "path=" + p + "&t=" + new Date().getTime();
376
+ return true;
377
+ }
378
+ if (/\bbdime=[12]/.test(d.cookie)) {
379
+ document.write('<script src="' + "http://s1.bdstatic.com/r/www/cache/static/ime/js/openime_b157f449.js" + '" charset="utf-8"><\/script>');
380
+ }
381
+ (function () {
382
+ var u = G("u").getElementsByTagName("a"), nv = G("nv").getElementsByTagName("a"), lk = G("lk").getElementsByTagName("a"), un = "";
383
+ var tj_nv = ["news", "tieba", "zhidao", "mp3", "img", "video", "map"];
384
+ var tj_lk = ["baike", "wenku", "hao123", "more"];
385
+ un = bds.comm.user == "" ? "" : bds.comm.user;
386
+ function _addTJ(obj) {
387
+ addEV(obj, "mousedown", function (e) {
388
+ var e = e || window.event;
389
+ var target = e.target || e.srcElement;
390
+ ns_c({'fm': 'behs', 'tab': target.name || 'tj_user', 'un': encodeURIComponent(un)});
391
+ });
392
+ }
393
+
394
+ for (var i = 0; i < u.length; i++) {
395
+ _addTJ(u[i]);
396
+ }
397
+ for (var i = 0; i < nv.length; i++) {
398
+ nv[i].name = 'tj_' + tj_nv[i];
399
+ }
400
+ for (var i = 0; i < lk.length; i++) {
401
+ lk[i].name = 'tj_' + tj_lk[i];
402
+ }
403
+ })();
404
+ (function () {
405
+ var links = {'tj_news': ['word', 'http://news.baidu.com/ns?tn=news&cl=2&rn=20&ct=1&ie=utf-8'], 'tj_tieba': ['kw', 'http://tieba.baidu.com/f?ie=utf-8'], 'tj_zhidao': ['word', 'http://zhidao.baidu.com/search?pn=0&rn=10&lm=0'], 'tj_mp3': ['key', 'http://music.baidu.com/search?fr=ps&ie=utf-8'], 'tj_img': ['word', 'http://image.baidu.com/i?ct=201326592&cl=2&nc=1&lm=-1&st=-1&tn=baiduimage&istype=2&fm=&pv=&z=0&ie=utf-8'], 'tj_video': ['word', 'http://video.baidu.com/v?ct=301989888&s=25&ie=utf-8'], 'tj_map': ['wd', 'http://map.baidu.com/?newmap=1&ie=utf-8&s=s'], 'tj_baike': ['word', 'http://baike.baidu.com/search/word?pic=1&sug=1&enc=utf8'], 'tj_wenku': ['word', 'http://wenku.baidu.com/search?ie=utf-8']};
406
+ var domArr = [G('nv'), G('lk'), G('cp')], kw = G('kw');
407
+ for (var i = 0, l = domArr.length; i < l; i++) {
408
+ domArr[i].onmousedown = function (e) {
409
+ e = e || window.event;
410
+ var target = e.target || e.srcElement, name = target.getAttribute('name'), items = links[name], reg = new RegExp('^\\s+|\\s+\x24'), key = kw.value.replace(reg, '');
411
+ if (items) {
412
+ if (key.length > 0) {
413
+ var wd = items[0], url = items[1], url = url + ( name === 'tj_map' ? encodeURIComponent('&' + wd + '=' + key) : ( ( url.indexOf('?') > 0 ? '&' : '?' ) + wd + '=' + encodeURIComponent(key) ) );
414
+ target.href = url;
415
+ } else {
416
+ target.href = target.href.match(new RegExp('^http:\/\/.+\.baidu\.com'))[0];
417
+ }
418
+ }
419
+ name && ns_c({'fm': 'behs', 'tab': name, 'query': encodeURIComponent(key), 'un': encodeURIComponent(bds.comm.user || '') });
420
+ };
421
+ }
422
+ })();
423
+ addEV(w, "load", function () {
424
+ k.focus()
425
+ });
426
+ w.onunload = function () {
427
+ };</script>
428
+ <script type="text/javascript"
429
+ src="http://s1.bdstatic.com/r/www/cache/static/global/js/tangram-1.3.4c1.0_07038476.js"></script>
430
+ <script type="text/javascript" src="http://s1.bdstatic.com/r/www/cache/static/user/js/u_5990d9fd.js"
431
+ charset="utf-8"></script>
432
+ <script>try {
433
+ document.cookie = "WWW_ST=;expires=Sat, 01 Jan 2000 00:00:00 GMT";
434
+ baidu.on(document.forms[0], "submit", function () {
435
+ var _t = new Date().getTime();
436
+ document.cookie = "WWW_ST=" + _t + ";expires=" + new Date(_t + 10000).toGMTString()
437
+ })
438
+ } catch (e) {
439
+ }</script>
440
+ </html><!--07dabc2f73ee8a67-->
@@ -0,0 +1,2 @@
1
+ # Logfile created on 2013-09-24 20:48:53 +0800 by logger.rb/36483
2
+ E, [2013-09-24T20:48:53.874180 #22041] ERROR -- : Nisi voluptatum rem atque maxime quos fugiat quo. Optio minima voluptate maiores perferendis voluptates. Quam vitae nisi facere et sit.
@@ -0,0 +1,3 @@
1
+ module Try1
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ module Try2
2
+
3
+ end
@@ -0,0 +1,3 @@
1
+ module Try3
2
+
3
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ include RoSupport::Array
4
+ describe RoSupport::Array do
5
+ it 'to_args' do
6
+ expect([[1, 2], [3, 4]].to_args).to be == "[1, 2],[3, 4]"
7
+ end
8
+
9
+
10
+ describe 'to_args' do
11
+ it 'case1' do
12
+ expect(['1', '2', '3', '4'].to_args).to be == "'1','2','3','4'"
13
+ end
14
+
15
+ it 'case2' do
16
+ eval %Q(#{["卓尔不凡  这是最好的时代,也是最坏的时代 。  这是智慧的时代,也是愚蠢的时代。 这是充满信仰的时代,也是怀疑重重的时代。 这是光明的季节,也是黑暗的季节。 这是希望之春,也是失望之冬。 这是充满真理的时代,也是歪理当道的时代。 人们面前有各式各样的选择 ,也可以说是别无选择。 有人此刻直登天堂, 有人此刻正在下地狱。                  现实的困境让我们社会的多数人变得麻木不仁,抱怨不断!失去了从平凡变伟大的机会!抱怨已经充斥我们周围!事实上你可以原本比现在的你做的更好!一切源于你对自我是怎样的认知和抉择! NASA有一句名言失败不是一个选项(备注:多数人认为是詹姆斯.卡梅隆所说) 时光如斯流逝,人生苦短,你懂得!我们这辈子没法做太多的事!但是你可以把自己喜爱的事做到精彩绝伦!   在人类历史的发展长河中,有这么一群人—爱因斯坦;达.芬奇;特斯拉;布兰森;埃里森;拳王阿里;袁隆平;李小龙;马云;华裔神探李昌钰;诺查.丹玛斯;尼采;詹姆斯.卡梅隆;斯皮尔伯格;乔治.卢卡斯;魔术师克里斯.安吉尔和戴纳魔;迈克尔.桑德尔;斯蒂夫.乔布斯。 他们用不同的角度看世界他们引领各自领域的变革,发明创造!唤醒梦想,探究未知!放飞理想,创造未来! 他们的独特认知源于强大的内心驱动力!永远旺盛的好奇心!丰富的想象力!不可能的任务:Mission impossibleHopeFace网络科技公司邀请以下的各位参与这项不可能的任务一个Android开发者、前端开发,后台开发者、Jobs'非同凡响'的思想,他的王者归来缔造这个世纪初苹果最辉煌的10年;我们'卓尔不凡'的思想需要以上的各位一起携手创造出伟大的产品,当我们回想我们的人生的时候至少可以向你的后代吹吹牛!你是这项伟大任务的参与者!继而在人类的历史长河中留下那属于你自己浓墨重彩的一笔!当你在街上看到有个年轻人,走路有点心不在焉,而且远远的看起来有点呆头呆脑的家伙时,别犹豫!那个哥们儿就是我!罗童鞋(brandon):158 1156 3286Facebook:罗朝国Twitter:brandon20101101欢迎各位的骚扰!Y(^_^)Y"].to_args})
17
+ end
18
+ end
19
+
20
+ it 'map with regexp' do
21
+ result = [1, 2].map_with_regexp /2/ do |e|
22
+ e*2
23
+ end
24
+ expect(result).to be == [1, 4]
25
+ end
26
+
27
+ end
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+ describe ::RoSupport::Bash do
3
+
4
+ end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ class C
5
+
6
+ include RoSupport::Debug
7
+
8
+ def initialize
9
+ @foo = 'foo'
10
+ @bar = 'bar'
11
+ end
12
+
13
+ def try_ro_raise
14
+ foo = 'foo'
15
+ bar = 'bar'
16
+ ro_raise err('msg', output:['@foo', '@bar', 'bar', 'foo'])
17
+ end
18
+
19
+ def try_ro_return
20
+ foo = 'foo'
21
+ bar = 'bar'
22
+ ro_return valid(nil, output:['foo', 'bar'])
23
+ end
24
+ end
25
+
26
+ describe Debug do
27
+ let(:c) { C.new }
28
+
29
+ it 'ro_raise' do
30
+ expect do
31
+ c.try_ro_raise
32
+ end.to raise_error RuntimeError
33
+ end
34
+
35
+ describe 'ro_return' do
36
+ it 'raise error when return a invalid argument' do
37
+ expect do
38
+ c.try_ro_return
39
+ end.to raise_error RuntimeError
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ include FileActions
4
+ describe FileActions do
5
+ it 'create dir file' do
6
+ path = $fixtures + '/for_misc_file_utils/create_dir_file/try.rb'
7
+ create_dir_file(path)
8
+ expect(File.exist? path).to be_true
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ #require 'spec_helper'
2
+ #
3
+ #include Git
4
+ #describe Git do
5
+ # it 'bash_format get right git_str' do
6
+ # expect(
7
+ # Git.send(:bash_format, 'add', '--all')
8
+ # ).to be == "repo.git.native 'add', {process_info: true}, '--all'"
9
+ # end
10
+ #
11
+ # it 'handle bash hash -m "something"' do
12
+ # expect(
13
+ # Git.send(:handle, "commit -m 'try Git handle'")
14
+ # ).to be == ['commit', '-m', "'try Git handle'"]
15
+ # end
16
+ #
17
+ # it 'git run well' do
18
+ # git 'add --all'
19
+ # git_commit_all 'commit a msg'
20
+ # git 'push -u origin master'
21
+ # end
22
+ #end
23
+ #
@@ -0,0 +1,23 @@
1
+ # Logfile created on 2013-09-20 20:53:18 +0800 by logger.rb/36483
2
+ F, [2013-09-20T20:53:18.039406 #11522] FATAL -- : Zelma Murphy
3
+ F, [2013-09-20T20:53:18.039615 #11522] FATAL -- : Mr. Joey Hodkiewicz
4
+ F, [2013-09-20T23:08:51.653723 #9891] FATAL -- : Ona Roberts
5
+ F, [2013-09-20T23:08:51.654122 #9891] FATAL -- : Florian Roberts
6
+ F, [2013-09-20T23:10:42.666931 #10372] FATAL -- : Einar Gusikowski MD
7
+ F, [2013-09-20T23:10:42.667156 #10372] FATAL -- : Ms. Dorothea Thompson
8
+ F, [2013-09-20T23:12:24.129466 #12076] FATAL -- : Ivy Stokes
9
+ F, [2013-09-20T23:12:24.129659 #12076] FATAL -- : Ayden Sawayn
10
+ F, [2013-09-20T23:12:47.993246 #12949] FATAL -- : Annetta Vandervort
11
+ F, [2013-09-20T23:12:47.993443 #12949] FATAL -- : Danielle Kreiger
12
+ F, [2013-09-20T23:14:27.024315 #14048] FATAL -- : Ms. Percival Ullrich
13
+ F, [2013-09-20T23:14:27.024546 #14048] FATAL -- : Robert Stamm
14
+ F, [2013-09-20T23:15:04.443365 #14078] FATAL -- : Verla Upton
15
+ F, [2013-09-20T23:15:04.443579 #14078] FATAL -- : Stanley Schmitt DVM
16
+ F, [2013-09-20T23:15:53.531271 #14157] FATAL -- : Raegan Marquardt
17
+ F, [2013-09-20T23:15:53.531478 #14157] FATAL -- : Braulio Gislason
18
+ F, [2013-09-20T23:18:00.382555 #15851] FATAL -- : Cayla Bogan MD
19
+ F, [2013-09-20T23:18:00.382795 #15851] FATAL -- : Janis Greenholt
20
+ F, [2013-09-20T23:37:08.591708 #22027] FATAL -- : Ambrose Jerde
21
+ F, [2013-09-20T23:37:08.591895 #22027] FATAL -- : Carrie Waelchi
22
+ F, [2013-09-20T23:37:16.517208 #22057] FATAL -- : Mr. Frederique Gerhold
23
+ F, [2013-09-20T23:37:16.517419 #22057] FATAL -- : Cristopher Bruen
@@ -0,0 +1,63 @@
1
+ # Logfile created on 2013-09-01 11:04:27 +0800 by logger.rb/36483
2
+ F, [2013-09-01T11:04:27.792090 #22442] FATAL -- : aaa
3
+ F, [2013-09-01T11:12:18.088929 #24453] FATAL -- : aaa
4
+ F, [2013-09-01T11:25:56.308470 #25878] FATAL -- : aaa
5
+ F, [2013-09-01T11:25:59.488017 #25888] FATAL -- : aaa
6
+ F, [2013-09-01T11:42:22.179177 #28390] FATAL -- : aaa
7
+ F, [2013-09-01T11:55:26.053428 #31801] FATAL -- : aaa
8
+ F, [2013-09-01T12:09:17.376781 #2992] FATAL -- : aaa
9
+ F, [2013-09-01T12:09:19.282262 #3003] FATAL -- : aaa
10
+ F, [2013-09-03T21:10:42.031459 #19416] FATAL -- : aaa
11
+ F, [2013-09-03T21:10:42.031799 #19416] FATAL -- : bbb
12
+ F, [2013-09-03T21:11:45.323397 #19426] FATAL -- : aaa
13
+ F, [2013-09-03T21:11:45.323755 #19426] FATAL -- : bbb
14
+ F, [2013-09-03T21:13:01.342709 #19559] FATAL -- : aaa
15
+ F, [2013-09-03T21:13:12.293852 #19559] FATAL -- : bbb
16
+ F, [2013-09-03T21:13:59.103089 #20125] FATAL -- : aaa
17
+ F, [2013-09-03T21:14:01.109125 #20125] FATAL -- : bbb
18
+ F, [2013-09-03T21:14:36.309546 #20510] FATAL -- : aaa
19
+ F, [2013-09-03T21:14:36.311661 #20510] FATAL -- : bbb
20
+ F, [2013-09-03T21:17:47.442178 #20693] FATAL -- : #<Faker::Name:0x000000042700c0>
21
+ F, [2013-09-03T21:17:47.442542 #20693] FATAL -- : #<Faker::Name:0x00000004227f00>
22
+ F, [2013-09-03T21:18:04.180624 #20701] FATAL -- : #<Faker::Name:0x00000002763c50>
23
+ F, [2013-09-03T21:18:04.180959 #20701] FATAL -- : #<Faker::Name:0x00000002763ac0>
24
+ F, [2013-09-03T21:18:55.187644 #20713] FATAL -- : Jaydon Predovic
25
+ F, [2013-09-03T21:18:55.188009 #20713] FATAL -- : Buster Sipes
26
+ F, [2013-09-05T10:29:31.548631 #7496] FATAL -- : Fiona Champlin
27
+ F, [2013-09-05T10:29:31.548802 #7496] FATAL -- : Kurt DuBuque Jr.
28
+ F, [2013-09-05T10:31:51.407687 #10239] FATAL -- : Trystan Sipes PhD
29
+ F, [2013-09-05T10:31:51.407860 #10239] FATAL -- : Talon Marks
30
+ F, [2013-09-09T13:56:15.532775 #3740] FATAL -- : Corbin Keeling
31
+ F, [2013-09-09T13:56:15.533252 #3740] FATAL -- : Hershel Wuckert
32
+ F, [2013-09-09T13:57:17.449747 #5011] FATAL -- : Miss Kiera Abernathy
33
+ F, [2013-09-09T13:57:17.449989 #5011] FATAL -- : Miss Lester Erdman
34
+ F, [2013-09-09T14:01:12.614894 #20301] FATAL -- : Riley Greenfelder II
35
+ F, [2013-09-09T14:01:12.615138 #20301] FATAL -- : Miss Efrain Fay
36
+ F, [2013-09-09T14:01:59.740867 #23130] FATAL -- : Tamia Bergstrom
37
+ F, [2013-09-09T14:01:59.741121 #23130] FATAL -- : Jameson Jacobi
38
+ F, [2013-09-09T14:03:52.326632 #766] FATAL -- : Derek DuBuque III
39
+ F, [2013-09-09T14:03:52.326878 #766] FATAL -- : Dr. Carmen Hermann
40
+ F, [2013-09-09T14:11:05.411998 #3376] FATAL -- : Lue Senger
41
+ F, [2013-09-09T14:11:05.412422 #3376] FATAL -- : Lexie Crist
42
+ F, [2013-09-09T14:11:43.385727 #5481] FATAL -- : Immanuel Nitzsche
43
+ F, [2013-09-09T14:11:43.385942 #5481] FATAL -- : Arne Heidenreich
44
+ F, [2013-09-09T14:11:58.416208 #5790] FATAL -- : Michele Witting
45
+ F, [2013-09-09T14:11:58.416370 #5790] FATAL -- : Thora Dibbert
46
+ F, [2013-09-09T14:40:09.928169 #20249] FATAL -- : Kimberly Harris
47
+ F, [2013-09-09T14:40:09.928334 #20249] FATAL -- : Ms. Imogene Hoeger
48
+ F, [2013-09-09T14:45:30.308471 #23824] FATAL -- : Abner Sauer
49
+ F, [2013-09-09T14:45:30.308657 #23824] FATAL -- : Concepcion Abernathy DVM
50
+ F, [2013-09-09T16:11:13.289407 #31828] FATAL -- : Elsie Moen
51
+ F, [2013-09-09T16:11:13.289656 #31828] FATAL -- : Tia Marks I
52
+ F, [2013-09-19T11:04:20.871727 #26425] FATAL -- : Domenico Turner
53
+ F, [2013-09-19T11:04:20.871930 #26425] FATAL -- : Neoma Schaefer I
54
+ F, [2013-09-19T11:08:39.385125 #28003] FATAL -- : Johnpaul Abernathy PhD
55
+ F, [2013-09-19T11:08:39.385406 #28003] FATAL -- : Autumn MacGyver
56
+ F, [2013-09-19T11:09:44.838334 #28862] FATAL -- : Marisa Parker
57
+ F, [2013-09-19T11:09:44.838575 #28862] FATAL -- : Cleveland Runte
58
+ F, [2013-09-19T16:09:39.430289 #5744] FATAL -- : Chaz Tromp
59
+ F, [2013-09-19T16:09:39.430710 #5744] FATAL -- : Austen Tromp MD
60
+ F, [2013-09-19T16:14:53.671094 #6621] FATAL -- : Haley Paucek
61
+ F, [2013-09-19T16:14:53.671300 #6621] FATAL -- : Mr. Aracely Ullrich
62
+ F, [2013-09-19T16:15:43.769840 #7263] FATAL -- : Sigrid Senger
63
+ F, [2013-09-19T16:15:43.770090 #7263] FATAL -- : Kameron Zieme
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+ include Log
3
+
4
+ describe Log do
5
+ before do
6
+ Dir.chdir File.join $fixtures, 'for_log'
7
+ `rm -r ./*`
8
+ end
9
+
10
+ it 'raise_log(log_file, *contents)' do
11
+ content = Faker::Lorem.paragraph
12
+ raise_log(content, 'ro.log')
13
+ expect(File.read('ro.log')).to match content
14
+ end
15
+ end