pru 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +5 -3
- data/VERSION +1 -1
- data/lib/pru.rb +6 -0
- data/pru.gemspec +3 -3
- data/spec/pru_spec.rb +5 -1
- data/spec/test.txt +1 -1
- metadata +4 -12
data/Readme.md
CHANGED
@@ -4,10 +4,9 @@ Install
|
|
4
4
|
=======
|
5
5
|
sudo gem install pru
|
6
6
|
|
7
|
-
Working with rvm / many gemsets -> only install once
|
7
|
+
Working with rvm / many gemsets -> only install once (1.9 recommended)
|
8
8
|
|
9
|
-
rvm
|
10
|
-
gem install pru
|
9
|
+
rvm 1.9.2 exec gem install pru
|
11
10
|
echo 'alias pru="rvm 1.9.2 exec pru"' >> ~/.bash_profile
|
12
11
|
|
13
12
|
Usage
|
@@ -55,6 +54,9 @@ Reduce works on all lines as Array<br/>
|
|
55
54
|
# paste-friendly mime-types
|
56
55
|
curl https://github.com/mattetti/mimetype-fu/raw/master/lib/mime_types.yml | grep image | pru 'gsub(/(.*): (.*)/, %{"\\1" => "\\2",})'
|
57
56
|
|
57
|
+
# number of files by date:
|
58
|
+
ls -al | pru 'split(" ")[5]' 'grouped.map{|d, f| "#{d} : #{f.size}" }'
|
59
|
+
|
58
60
|
# quotes inside a string
|
59
61
|
something | pru 'include?(%{"string"})'
|
60
62
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/lib/pru.rb
CHANGED
data/pru.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{pru}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Michael Grosser"]
|
12
|
-
s.date = %q{2011-04-
|
12
|
+
s.date = %q{2011-04-21}
|
13
13
|
s.default_executable = %q{pru}
|
14
14
|
s.email = %q{michael@grosser.it}
|
15
15
|
s.executables = ["pru"]
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
]
|
29
29
|
s.homepage = %q{http://github.com/grosser/pru}
|
30
30
|
s.require_paths = ["lib"]
|
31
|
-
s.rubygems_version = %q{1.
|
31
|
+
s.rubygems_version = %q{1.6.2}
|
32
32
|
s.summary = %q{Pipeable Ruby - forget about grep / sed / awk / wc ... use pure, readable Ruby!}
|
33
33
|
s.test_files = [
|
34
34
|
"spec/pru_spec.rb",
|
data/spec/pru_spec.rb
CHANGED
@@ -23,7 +23,7 @@ describe Pru do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
it "selects and reduces" do
|
26
|
-
`cat spec/test.txt | ./bin/pru 'include?("abc")' 'size'`.should == "
|
26
|
+
`cat spec/test.txt | ./bin/pru 'include?("abc")' 'size'`.should == "3\n"
|
27
27
|
end
|
28
28
|
|
29
29
|
it "can open files" do
|
@@ -51,6 +51,10 @@ describe Pru do
|
|
51
51
|
it "can mean" do
|
52
52
|
`cat spec/test.txt | ./bin/pru -r 'mean(&:to_i)'`.should == "242.4\n"
|
53
53
|
end
|
54
|
+
|
55
|
+
it "can grouped" do
|
56
|
+
`cat spec/test.txt | ./bin/pru -r 'grouped.map{|a,b| b.size }'`.should include("2\n")
|
57
|
+
end
|
54
58
|
end
|
55
59
|
|
56
60
|
describe 'map and reduce' do
|
data/spec/test.txt
CHANGED
metadata
CHANGED
@@ -1,13 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pru
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 31
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 2
|
10
|
-
version: 0.1.2
|
5
|
+
version: 0.1.3
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
8
|
- Michael Grosser
|
@@ -15,7 +10,7 @@ autorequire:
|
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-04-
|
13
|
+
date: 2011-04-21 00:00:00 +02:00
|
19
14
|
default_executable: pru
|
20
15
|
dependencies: []
|
21
16
|
|
@@ -53,7 +48,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
53
48
|
requirements:
|
54
49
|
- - ">="
|
55
50
|
- !ruby/object:Gem::Version
|
56
|
-
hash:
|
51
|
+
hash: -655499885
|
57
52
|
segments:
|
58
53
|
- 0
|
59
54
|
version: "0"
|
@@ -62,14 +57,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
57
|
requirements:
|
63
58
|
- - ">="
|
64
59
|
- !ruby/object:Gem::Version
|
65
|
-
hash: 3
|
66
|
-
segments:
|
67
|
-
- 0
|
68
60
|
version: "0"
|
69
61
|
requirements: []
|
70
62
|
|
71
63
|
rubyforge_project:
|
72
|
-
rubygems_version: 1.
|
64
|
+
rubygems_version: 1.6.2
|
73
65
|
signing_key:
|
74
66
|
specification_version: 3
|
75
67
|
summary: Pipeable Ruby - forget about grep / sed / awk / wc ... use pure, readable Ruby!
|