rubyc 0.0.17 → 0.1.0.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/Guardfile +4 -3
- data/LICENSE.txt +22 -0
- data/README.md +6 -7
- data/Rakefile +1 -0
- data/features/fixtures/file1.csv +47420 -0
- data/features/fixtures/file1.txt +2 -0
- data/features/fixtures/file2.txt +2 -0
- data/lib/rubyc/cli.rb +3 -3
- data/lib/rubyc/colorize_stack.rb +37 -0
- data/lib/rubyc/version.rb +1 -1
- data/spec/cli_spec.rb +6 -8
- data/spec/colorize_stack_spec.rb +47 -0
- data/spec/spec_helper.rb +3 -35
- metadata +83 -108
- data/spec/rubyc_spec.rb +0 -0
data/Guardfile
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
|
4
4
|
guard 'minitest' do
|
5
5
|
watch(%r|^spec/(.*)_spec\.rb|)
|
6
|
-
watch(%r
|
7
|
-
watch(%r|^
|
8
|
-
watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
6
|
+
watch(%r|lib\/([^\/]+)\/([^\/]+)\.rb|) { |m| "spec/#{m[2]}_spec.rb"}
|
7
|
+
watch(%r|^spec/spec_helper\.rb|) { "spec" }
|
9
8
|
end
|
9
|
+
|
10
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Martin Chabot
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
## Description
|
3
3
|
Adds Ruby's power to the command line.
|
4
4
|
## Introduction
|
5
|
-
Sometimes we need to process files or streams at the bash prompt for filtering, parsing, calculating etc. Unix offers many tools for doing those actions: grep, sed, awk etc. However, their usage are not easy to remember besause of their cryptic syntax. They also use Unix regexes which are more limited than
|
5
|
+
Sometimes we need to process files or streams at the bash prompt for filtering, parsing, calculating etc. Unix offers many tools for doing those actions: grep, sed, awk etc. However, their usage are not easy to remember besause of their cryptic syntax. They also use Unix regexes which are more limited than Ruby's ones.
|
6
6
|
|
7
|
-
The Ruby interpreter offers us many command line options for processing files or pipes. The -p, -n options allows us to process lines one at a time.
|
7
|
+
The Ruby interpreter offers us many command line options for processing files or pipes. The -p, -n options in combination of the -e option, allows us to process lines one at a time. Personnaly I never remember how to use them.
|
8
8
|
|
9
9
|
For this reason, I have created Rubyc, which stands for Ruby Command line. Rubyc supports many enumerator methods applied to STDIN. The current line is represented by the "line" variable name or it's shorter alias 'l'.
|
10
10
|
## Installation
|
@@ -64,11 +64,10 @@ The Rubyc way:
|
|
64
64
|
``` bash
|
65
65
|
$ cat development.log | rubyc count_by 'l =~ /INSERT INTO \"(\w+)\"/; $1'
|
66
66
|
---
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
tf_call_records: 18
|
67
|
+
users: 14
|
68
|
+
adresses: 18
|
69
|
+
objects: 102191
|
70
|
+
phone_numbers: 47
|
72
71
|
```
|
73
72
|
|
74
73
|
|