rft 0.1.1

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.
@@ -0,0 +1,106 @@
1
+ # Ruby Files Tamer - ver. beta
2
+
3
+ BEGIN {
4
+
5
+ require_relative 'modules_rft/options' # module Options
6
+ require_relative 'modules_rft/access' # module Access
7
+ require_relative 'modules_rft/mutation' # module Mutation
8
+
9
+ $rft_path = File.expand_path File.dirname(__FILE__)
10
+
11
+ Dir.chdir ($rft_path)
12
+ Dir.chdir("../")
13
+
14
+ $folder_path = Dir.pwd
15
+
16
+ if File.file?(ARGV[0]) && ['.txt', '.md', '.otd', '.doc', '.docx'].any? { |format| ARGV[0].include?(format) }
17
+ $file_name = ARGV[0]
18
+ $file_path = File.expand_path File.dirname(__FILE__) + '/' +ARGV[0]
19
+ end
20
+
21
+ }
22
+
23
+ def list
24
+ dir = Dir.entries($folder_path).join(' ').split(' ')
25
+ dir.delete('.') if dir.include? '.'
26
+ dir.delete('..') if dir.include? '..'
27
+ dir.each do |rm_file|
28
+ dir.delete(rm_file) unless rm_file.include? '.'
29
+ #dir.delete(rm_file) unless ['.txt', '.md', '.otd', '.doc', '.docx'].any? { |inc| rm_file.include? inc }
30
+ end
31
+ #dir.sort!
32
+ dir.each do |rm_file|
33
+ #dir.delete(rm_file) unless rm_file.include? '.'
34
+ dir.delete(rm_file) unless ['.txt', '.md', '.otd', '.doc', '.docx'].any? { |inc| rm_file.include? inc }
35
+ end
36
+ dir.sort!
37
+ end
38
+
39
+ case ARGV.length
40
+
41
+ when 1
42
+ Access.reader($file_name) if File.file? ARGV[0]
43
+
44
+ case ARGV[0]
45
+ when '-list' then puts list
46
+ when '-help' then Options.help
47
+ when '--All' then Access.reader(list)
48
+ when '-folder' then Options.folder
49
+ end
50
+
51
+ when 2
52
+ if File.file? ARGV[0]
53
+ case ARGV[1]
54
+ when '-props' then Options.properties($file_name)
55
+ when '-owtxt' then Mutation.overwrite_text($file_name)
56
+ when '-apptxt' then Mutation.append_text($file_name)
57
+ when '-clr' then Mutation.clear_text($file_name)
58
+ when '-del' then Mutation.del($file_name)
59
+ else Options.syntax_error
60
+ end
61
+ elsif ARGV[0] == '--A'
62
+ case ARGV[1]
63
+ when '-del' then Mutation.del(list)
64
+ else Options.syntax_error
65
+ end
66
+ elsif ARGV[0] == '-new'
67
+ unless list.include? ARGV[1]
68
+ Mutation.create(ARGV[1])
69
+ else
70
+ puts "File " + ARGV[1] + " already exist!"
71
+ end
72
+ end
73
+
74
+ when 3
75
+ if File.file? ARGV[0]
76
+ case ARGV[1]
77
+ when '-find' then Access.seeker($file_name)
78
+ when '-rename' then Mutation.rename($file_name, ARGV[2])
79
+ when '-copy' then Mutation.copy($file_name, ARGV[2])
80
+ when '-remove' then Mutation.remove($file_name, ARGV[2])
81
+ when '-uniqs' then Access.uniqs($file_name, ARGV[2])
82
+ when '-end' then Mutation.end_of_line($file_name, ARGV[2])
83
+ else Options.syntax_error
84
+ end
85
+ elsif ARGV[0] == '--All'
86
+ case ARGV[1]
87
+ when '-find' then Access.seeker(list)
88
+ when '-remove' then Mutation.remove(list, ARGV[2])
89
+ else Options.syntax_error
90
+ end
91
+ end
92
+
93
+ when 4
94
+ if File.file? ARGV[0]
95
+ case ARGV[1]
96
+ when '-rep' then replace($file_name, ARGV[3])
97
+ else Options.syntax_error
98
+ end
99
+ elsif ARGV[0] == '--A'
100
+ case ARGV[1]
101
+ when '-rep' then replace(list, ARGV[3])
102
+ else Options.syntax_error
103
+ end
104
+ end
105
+
106
+ end
@@ -0,0 +1,3 @@
1
+ Knocking
2
+ 123
3
+ abc
@@ -0,0 +1,5 @@
1
+ gogogo
2
+ 2
3
+ xzf
4
+ abc
5
+ Knocking
@@ -0,0 +1,3 @@
1
+ Knocking
2
+ Knocking
3
+ Knocking
@@ -0,0 +1,39 @@
1
+ # Ruby_Files_Tamer
2
+ Ruby project with File I/O handling.
3
+
4
+ ### Options Commands with 1 parameter ###
5
+ $ rft -help # displays this info <br />
6
+ $ rft -folder # displays current working path <br />
7
+
8
+ ### Options Commands with 2 parameters ###
9
+ $ rft filename.format -props # displays file properties <br />
10
+
11
+ ### Access Commands with 1 paramater ###
12
+ $ rft filename.format # reads filename content <br />
13
+ $ rft --All # reads all files contents <br />
14
+ $ rft -list # lists all text-like files <br />
15
+
16
+ ### Access Commands with 3 paramaters ###
17
+ $ rft filename.format -find phrase # searches for phrase in file and, if spoted, displays the lines <br />
18
+ $ rft --All -find phrase # searches for phrase in all textlike files and, if spoted, displays the lines <br />
19
+ $ rftfilename.format -uniqs uniqsname.format # creates new file with uniq phrases only <br />
20
+
21
+ ### Mutation Commands with 2 parameters ###
22
+ $ rft filename.format -owtxt # overwrites text in file content by user input <br />
23
+ $ rft filename.format -apptxt # appends at the end of text in file content with user input <br />
24
+ $ rft filename.format -clr # clears the file content, and makes it a blank file <br />
25
+ $ rft filename.format -del # deletes the file <br />
26
+ $ rft --All -del # deletes all textlike files <br />
27
+ $ rft filename.format -new # creates new file by given filename.format <br />
28
+
29
+ ### Mutation Commands with 3 parameters ###
30
+ $ rft filename.format -rename renamed.format # renames the file, can also change the format <br />
31
+ $ rft filename.format -rename renamed.format # renames the file, can also change the format <br />
32
+ $ rft filename.format -remove phrase # removes phrase from file <br />
33
+ $ rft --All -remove phrase # removes phrase from textlike files <br />
34
+ $ rft filename.format -copy new_file.format # copies all content from file to newly created new_file <br />
35
+
36
+ ### Mutation Commands with 4 parameters ###
37
+ $ rft filename.format -rep from_phrase to_phrase # find/replace words in file by provided from_/to_ phrases <br />
38
+ $ rft --All -rep from_phrase to_phrase # find/replace words in all textlike files by provided from_/to_ phrases <br />
39
+
@@ -0,0 +1,6 @@
1
+ Following text was added at: 2017-08-04 19:27:18 +0200
2
+ 123
3
+
4
+ Following text was added at: 2017-08-04 19:27:22 +0200
5
+ abc
6
+
@@ -0,0 +1,702 @@
1
+ ACL
2
+ <br />
3
+ ARGF
4
+ <br />
5
+ AST
6
+ <br />
7
+ Abbrev
8
+ <br />
9
+ AbstractController
10
+ <br />
11
+ ActionCable
12
+ <br />
13
+ ActionController
14
+ <br />
15
+ ActionDispatch
16
+ <br />
17
+ ActionMailer
18
+ <br />
19
+ ActionPack
20
+ <br />
21
+ ActionView
22
+ <br />
23
+ ActiveJobs
24
+ <br />
25
+ ActiveModel
26
+ <br />
27
+ ActiveRecord
28
+ <br />
29
+ ActiveSupport
30
+ <br />
31
+ Addressable
32
+ <br />
33
+ Addrinfo
34
+ <br />
35
+ ApplicationCable
36
+ <br />
37
+ ArJdbcMySQL
38
+ <br />
39
+ Arel
40
+ <br />
41
+ ArgumentError
42
+ <br />
43
+ Arrayh
44
+ <br />
45
+ BCrypt
46
+ <br />
47
+ Base64
48
+ <br />
49
+ BasicObject
50
+ <br />
51
+ BasicSocket
52
+ <br />
53
+ Benchmark
54
+ <br />
55
+ BigDecimal
56
+ <br />
57
+ BigMath
58
+ <br />
59
+ BinaryReaderMixin
60
+ <br />
61
+ BinaryWriterMixin
62
+ <br />
63
+ Bindex
64
+ <br />
65
+ Binding
66
+ <br />
67
+ BlankSlate
68
+ <br />
69
+ Buffer
70
+ <br />
71
+ Builder
72
+ <br />
73
+ Bundler
74
+ <br />
75
+ Byebug
76
+ <br />
77
+ ByteOrder
78
+ <br />
79
+ CGI
80
+ <br />
81
+ CMath
82
+ <br />
83
+ CSV
84
+ <br />
85
+ CacheDigests
86
+ <br />
87
+ Capistrano
88
+ <br />
89
+ Capybara
90
+ <br />
91
+ ChildProcess
92
+ <br />
93
+ Class
94
+ <br />
95
+ ClosedQueueError
96
+ <br />
97
+ Coffee
98
+ <br />
99
+ CoffeeScript
100
+ <br />
101
+ Comparable
102
+ <br />
103
+ Complex
104
+ <br />
105
+ Concurrent
106
+ <br />
107
+ ConditionVariable
108
+ <br />
109
+ Continuation
110
+ <br />
111
+ Coverage
112
+ <br />
113
+ Crypt
114
+ <br />
115
+ DBM
116
+ <br />
117
+ DBMError
118
+ <br />
119
+ DEBUGGER__
120
+ <br />
121
+ DRb
122
+ <br />
123
+ Data
124
+ <br />
125
+ DatabaseError
126
+ <br />
127
+ Date
128
+ <br />
129
+ DateAndTime
130
+ <br />
131
+ DateTime
132
+ <br />
133
+ Delegator
134
+ <br />
135
+ DidYouMean
136
+ <br />
137
+ Digest
138
+ <br />
139
+ Dir
140
+ <br />
141
+ ENV
142
+ <br />
143
+ EOFError
144
+ <br />
145
+ ERB
146
+ <br />
147
+ EXCEPTION_TYPE
148
+ <br />
149
+ Encoding
150
+ <br />
151
+ EncodingError
152
+ <br />
153
+ English
154
+ <br />
155
+ Enumerable
156
+ <br />
157
+ Enumerator
158
+ <br />
159
+ Errno
160
+ <br />
161
+ Error
162
+ <br />
163
+ Erubi
164
+ <br />
165
+ Etc
166
+ <br />
167
+ Exception
168
+ <br />
169
+ Exception2MessageMapper
170
+ <br />
171
+ ExecJS
172
+ <br />
173
+ FCGI
174
+ <br />
175
+ FFI
176
+ <br />
177
+ FSEvent
178
+ <br />
179
+ FalseClass
180
+ <br />
181
+ Fcntl
182
+ <br />
183
+ Fiber
184
+ <br />
185
+ FiberError
186
+ <br />
187
+ Fiddle
188
+ <br />
189
+ File
190
+ <br />
191
+ FileTest
192
+ <br />
193
+ FileUtils
194
+ <br />
195
+ Find
196
+ <br />
197
+ Float
198
+ <br />
199
+ FloatDomainError
200
+ <br />
201
+ Forwardable
202
+ <br />
203
+ GC
204
+ <br />
205
+ GDBM
206
+ <br />
207
+ GDBMError
208
+ <br />
209
+ GDBMFatalError
210
+ <br />
211
+ Gem
212
+ <br />
213
+ GetText
214
+ <br />
215
+ GetoptLong
216
+ <br />
217
+ GlobalID
218
+ <br />
219
+ HTMLSelector
220
+ <br />
221
+ HTTPMovedTemporarily
222
+ <br />
223
+ HTTPMultipleChoice
224
+ <br />
225
+ HTTPRequestURITooLarge
226
+ <br />
227
+ Hash
228
+ <br />
229
+ Hoe
230
+ <br />
231
+ I18n
232
+ <br />
233
+ INotify
234
+ <br />
235
+ IO
236
+ <br />
237
+ IOError
238
+ <br />
239
+ IPAddr
240
+ <br />
241
+ IPSocket
242
+ <br />
243
+ IRB
244
+ <br />
245
+ IndexError
246
+ <br />
247
+ Insertion
248
+ <br />
249
+ Integer
250
+ <br />
251
+ Interrupt
252
+ <br />
253
+ JSON
254
+ <br />
255
+ Jacobian
256
+ <br />
257
+ Java
258
+ <br />
259
+ Jbuilder
260
+ <br />
261
+ JbuilderTemplate
262
+ <br />
263
+ Kconv
264
+ <br />
265
+ Kernel
266
+ <br />
267
+ KeyError
268
+ <br />
269
+ LUSolve
270
+ <br />
271
+ LibXML
272
+ <br />
273
+ Listen
274
+ <br />
275
+ LoadError
276
+ <br />
277
+ LocalJumpError
278
+ <br />
279
+ Logger
280
+ <br />
281
+ LoggerSilence
282
+ <br />
283
+ Loofah
284
+ <br />
285
+ MIME
286
+ <br />
287
+ Mail
288
+ <br />
289
+ MakeMakefile
290
+ <br />
291
+ Marshal
292
+ <br />
293
+ MatchData
294
+ <br />
295
+ Math
296
+ <br />
297
+ Matrix
298
+ <br />
299
+ Merb
300
+ <br />
301
+ Method
302
+ <br />
303
+ MethodSource
304
+ <br />
305
+ Mime
306
+ <br />
307
+ MiniPortile
308
+ <br />
309
+ MiniPortileCMake
310
+ <br />
311
+ Minitest
312
+ <br />
313
+ MockExpectationError
314
+ <br />
315
+ Module
316
+ <br />
317
+ Monitor
318
+ <br />
319
+ MonitorMixin
320
+ <br />
321
+ MultiJson
322
+ <br />
323
+ Mutex_m
324
+ <br />
325
+ MyHandler
326
+ <br />
327
+ Mysql2
328
+ <br />
329
+ NIO
330
+ <br />
331
+ NKF
332
+ <br />
333
+ NameError
334
+ <br />
335
+ Net
336
+ <br />
337
+ Newton
338
+ <br />
339
+ NilClass
340
+ <br />
341
+ NoMemoryError
342
+ <br />
343
+ NoMethodError
344
+ <br />
345
+ Nokogiri
346
+ <br />
347
+ NotImplementedError
348
+ <br />
349
+ Numeric
350
+ <br />
351
+ OLEProperty
352
+ <br />
353
+ OTNetstring
354
+ <br />
355
+ Object
356
+ <br />
357
+ ObjectSpace
358
+ <br />
359
+ Observable
360
+ <br />
361
+ Open3
362
+ <br />
363
+ OpenSSL
364
+ <br />
365
+ OpenStruct
366
+ <br />
367
+ OpenURI
368
+ <br />
369
+ OptParse
370
+ <br />
371
+ OptionParser
372
+ <br />
373
+ PG
374
+ <br />
375
+ PGError
376
+ <br />
377
+ PGconn
378
+ <br />
379
+ PGresult
380
+ <br />
381
+ PP
382
+ <br />
383
+ PStore
384
+ <br />
385
+ PTY
386
+ <br />
387
+ Parser
388
+ <br />
389
+ ParserGauntlet
390
+ <br />
391
+ Pathname
392
+ <br />
393
+ Pg
394
+ <br />
395
+ Postgres
396
+ <br />
397
+ PostgresPR
398
+ <br />
399
+ PowerAssert
400
+ <br />
401
+ PrettyPrint
402
+ <br />
403
+ Prime
404
+ <br />
405
+ Proc
406
+ <br />
407
+ Process
408
+ <br />
409
+ Profiler__
410
+ <br />
411
+ Psych
412
+ <br />
413
+ PublicSuffix
414
+ <br />
415
+ Puma
416
+ <br />
417
+ Queue
418
+ <br />
419
+ RDoc
420
+ <br />
421
+ RDocTask
422
+ <br />
423
+ REXML
424
+ <br />
425
+ RSS
426
+ <br />
427
+ RSpec
428
+ <br />
429
+ Racc
430
+ <br />
431
+ Rack
432
+ <br />
433
+ Rails
434
+ <br />
435
+ Rails12factor
436
+ <br />
437
+ RailsServeStaticAssets
438
+ <br />
439
+ RailsStdoutLogging
440
+ <br />
441
+ Rake
442
+ <br />
443
+ Random
444
+ <br />
445
+ Range
446
+ <br />
447
+ RangeError
448
+ <br />
449
+ Rational
450
+ <br />
451
+ RbConfig
452
+ <br />
453
+ Readline
454
+ <br />
455
+ Regexp
456
+ <br />
457
+ RegexpError
458
+ <br />
459
+ Resolv
460
+ <br />
461
+ Rinda
462
+ <br />
463
+ Ripper
464
+ <br />
465
+ RubyDep
466
+ <br />
467
+ RubyInstaller
468
+ <br />
469
+ RubyLex
470
+ <br />
471
+ RubyToken
472
+ <br />
473
+ RubyVM
474
+ <br />
475
+ RuntimeError
476
+ <br />
477
+ SDBM
478
+ <br />
479
+ SDBMError
480
+ <br />
481
+ SOCKSSocket
482
+ <br />
483
+ SQLite3
484
+ <br />
485
+ Sass
486
+ <br />
487
+ SassListen
488
+ <br />
489
+ Scanf
490
+ <br />
491
+ ScriptError
492
+ <br />
493
+ Scss
494
+ <br />
495
+ SecureRandom
496
+ <br />
497
+ SecurityError
498
+ <br />
499
+ Selenium
500
+ <br />
501
+ Set
502
+ <br />
503
+ Shell
504
+ <br />
505
+ Shellwords
506
+ <br />
507
+ Signal
508
+ <br />
509
+ SignalException
510
+ <br />
511
+ SignedGlobalID
512
+ <br />
513
+ SimpleDelegator
514
+ <br />
515
+ Sinatra
516
+ <br />
517
+ SingleForwardable
518
+ <br />
519
+ Singleton
520
+ <br />
521
+ SizedQueue
522
+ <br />
523
+ Socket
524
+ <br />
525
+ SocketError
526
+ <br />
527
+ Solargraph
528
+ <br />
529
+ SortedSet
530
+ <br />
531
+ Spring
532
+ <br />
533
+ Sprockets
534
+ <br />
535
+ StandardError
536
+ <br />
537
+ StopIteration
538
+ <br />
539
+ String
540
+ <br />
541
+ StringIO
542
+ <br />
543
+ StringScanner
544
+ <br />
545
+ Struct
546
+ <br />
547
+ SubstitutionContext
548
+ <br />
549
+ Symbol
550
+ <br />
551
+ SymbolHash
552
+ <br />
553
+ Sync
554
+ <br />
555
+ Sync_m
556
+ <br />
557
+ SynchronizedDelegator
558
+ <br />
559
+ Synchronizer
560
+ <br />
561
+ Synchronizer_m
562
+ <br />
563
+ SyntaxError
564
+ <br />
565
+ Syslog
566
+ <br />
567
+ SystemCallError
568
+ <br />
569
+ SystemExit
570
+ <br />
571
+ SystemStackError
572
+ <br />
573
+ TCPServer
574
+ <br />
575
+ TCPSocket
576
+ <br />
577
+ TC_Conversion
578
+ <br />
579
+ TSort
580
+ <br />
581
+ TZInfo
582
+ <br />
583
+ TempIO
584
+ <br />
585
+ Tempfile
586
+ <br />
587
+ Template
588
+ <br />
589
+ Test
590
+ <br />
591
+ TestApp
592
+ <br />
593
+ ThWait
594
+ <br />
595
+ Thor
596
+ <br />
597
+ Thread
598
+ <br />
599
+ ThreadError
600
+ <br />
601
+ ThreadGroup
602
+ <br />
603
+ ThreadSafe
604
+ <br />
605
+ ThreadsWait
606
+ <br />
607
+ Threadsafe
608
+ <br />
609
+ Tilt
610
+ <br />
611
+ Time
612
+ <br />
613
+ Timeout
614
+ <br />
615
+ TracePoint
616
+ <br />
617
+ Tracer
618
+ <br />
619
+ TrueClass
620
+ <br />
621
+ Turbolinks
622
+ <br />
623
+ TypeError
624
+ <br />
625
+ UDPSocket
626
+ <br />
627
+ UNIXServer
628
+ <br />
629
+ UNIXSocket
630
+ <br />
631
+ URI
632
+ <br />
633
+ Uglifier
634
+ <br />
635
+ UnboundMethod
636
+ <br />
637
+ UncaughtThrowError
638
+ <br />
639
+ UnicodeNormalize
640
+ <br />
641
+ Vector
642
+ <br />
643
+ WEBrick
644
+ <br />
645
+ WIN32OLE
646
+ <br />
647
+ WIN32OLERuntimeError
648
+ <br />
649
+ WIN32OLE_EVENT
650
+ <br />
651
+ WIN32OLE_METHOD
652
+ <br />
653
+ WIN32OLE_PARAM
654
+ <br />
655
+ WIN32OLE_RECORD
656
+ <br />
657
+ WIN32OLE_TYPE
658
+ <br />
659
+ WIN32OLE_TYPELIB
660
+ <br />
661
+ WIN32OLE_VARIABLE
662
+ <br />
663
+ WIN32OLE_VARIANT
664
+ <br />
665
+ Warning
666
+ <br />
667
+ WeakRef
668
+ <br />
669
+ WebConsole
670
+ <br />
671
+ WebSocket
672
+ <br />
673
+ XML
674
+ <br />
675
+ XMLEncoding_ja
676
+ <br />
677
+ XMLRPC
678
+ <br />
679
+ XMP
680
+ <br />
681
+ XPath
682
+ <br />
683
+ XSD
684
+ <br />
685
+ YAML
686
+ <br />
687
+ YARD
688
+ <br />
689
+ YardHandlerExtension
690
+ <br />
691
+ ZeroDivisionError
692
+ <br />
693
+ Zip
694
+ <br />
695
+ Zlib
696
+ <br />
697
+ fatal
698
+ <br />
699
+ recipe
700
+ <br />
701
+ unknown
702
+ <br />