ariete 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +31 -0
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.md +56 -55
- data/Rakefile +4 -16
- data/ariete.gemspec +23 -0
- data/lib/ariete.rb +6 -26
- data/lib/ariete/version.rb +3 -0
- data/spec/ariete_spec.rb +37 -0
- data/spec/spec_helper.rb +2 -0
- metadata +70 -80
- data/CHANGELOG.md +0 -7
- data/CHANGELOG_jp.md +0 -7
- data/README_jp.md +0 -74
- data/doc/Ariete.html +0 -230
- data/doc/CaptureStdTest.html +0 -254
- data/doc/LICENSE.html +0 -105
- data/doc/Rakefile.html +0 -106
- data/doc/created.rid +0 -5
- data/doc/images/add.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -82
- data/doc/js/darkfish.js +0 -153
- data/doc/js/jquery.js +0 -18
- data/doc/js/navigation.js +0 -142
- data/doc/js/search.js +0 -94
- data/doc/js/search_index.js +0 -1
- data/doc/js/searcher.js +0 -228
- data/doc/rdoc.css +0 -543
- data/doc/table_of_contents.html +0 -69
- data/test/tb_capture_std.rb +0 -24
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 67e5520cfbf95af12618034a3f9d792cafd393c4
|
4
|
+
data.tar.gz: 87e1641f107b1a79e9fea63b842079fefaa1b236
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 93c9ea004d9382bf677d727b4db87cb9de837330241a6527b2c4a1534888c44556408429ba8deb08c34aae0f78afee6988bd0b48c9c7b6636415c22cd8995913
|
7
|
+
data.tar.gz: 1b7cd7145f59092778ada592d9133999221fab96410c3884fb307ab1aab2b9cd7c873ede9eed0eea182f1ee072dd3f2342026d8279565b857d4e791e00a79b66
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ariete (0.3.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.2.5)
|
10
|
+
rake (10.3.2)
|
11
|
+
rspec (3.1.0)
|
12
|
+
rspec-core (~> 3.1.0)
|
13
|
+
rspec-expectations (~> 3.1.0)
|
14
|
+
rspec-mocks (~> 3.1.0)
|
15
|
+
rspec-core (3.1.7)
|
16
|
+
rspec-support (~> 3.1.0)
|
17
|
+
rspec-expectations (3.1.2)
|
18
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
+
rspec-support (~> 3.1.0)
|
20
|
+
rspec-mocks (3.1.3)
|
21
|
+
rspec-support (~> 3.1.0)
|
22
|
+
rspec-support (3.1.2)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
ariete!
|
29
|
+
bundler (~> 1.7)
|
30
|
+
rake (~> 10.0)
|
31
|
+
rspec
|
data/{LICENSE → LICENSE.txt}
RENAMED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (c)
|
1
|
+
Copyright (c) 2014 Moza USANE
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
4
|
|
data/README.md
CHANGED
@@ -1,74 +1,75 @@
|
|
1
|
-
Ariete
|
2
|
-
=======================================
|
1
|
+
# Ariete
|
3
2
|
|
4
|
-
|
3
|
+
Ariete is a module that captures $stdout($stderr) and return as String.
|
4
|
+
It is useful on an unit test.
|
5
5
|
|
6
|
-
|
6
|
+
## Requirement
|
7
7
|
|
8
|
-
|
8
|
+
- Ruby 2.0 or later.
|
9
9
|
|
10
|
-
|
11
|
-
require "ariete"
|
12
|
-
require_relative "klass"
|
10
|
+
## Installation
|
13
11
|
|
14
|
-
|
15
|
-
|
12
|
+
```shell
|
13
|
+
$ (sudo) gem install 'ariete'
|
14
|
+
```
|
16
15
|
|
17
|
-
|
18
|
-
result = capture_stdout {Klass.output_out("Ariete")}
|
19
|
-
assert_equal("Ariete is a kind of rabbit.", result)
|
20
|
-
end
|
16
|
+
## Usage
|
21
17
|
|
22
|
-
|
23
|
-
result = capture_stderr {Klass.output_err("Ariete")}
|
24
|
-
assert_equal("Ariete means 'Lop' in Italian.", result)
|
25
|
-
end
|
26
|
-
end
|
18
|
+
### rspec
|
27
19
|
|
28
|
-
|
20
|
+
#### klass.rb
|
29
21
|
|
30
|
-
|
22
|
+
```ruby
|
23
|
+
class Klass
|
24
|
+
class << self
|
25
|
+
def output_out
|
26
|
+
puts "Ariete is a kind of rabbit."
|
27
|
+
end
|
31
28
|
|
32
|
-
|
33
|
-
|
29
|
+
def output_err
|
30
|
+
warn "Ariete means 'Lop' in Italian."
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
```
|
34
35
|
|
35
|
-
|
36
|
+
#### klass_spec.rb
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
- **ariete.rb** :: Main unit of Ariete
|
41
|
-
- **LICENSE**
|
42
|
-
- **Rakefile** :: Rakefile that is used to generate gem file
|
43
|
-
- **README.md**
|
44
|
-
- **README_jp.md**
|
45
|
-
- **test** :: Unit tests
|
46
|
-
- **tb_capture_std.rb** :: Unit test for Ariete
|
47
|
-
|
48
|
-
## Install
|
38
|
+
```ruby
|
39
|
+
require "ariete"
|
40
|
+
require_relative "klass"
|
49
41
|
|
50
|
-
|
42
|
+
RSpec.describe Klass do
|
43
|
+
include Ariete
|
51
44
|
|
52
|
-
|
45
|
+
# You can use without 'Ariete.' if you include Ariete.
|
46
|
+
describe ".output_out" do
|
47
|
+
subject { capture_stdout { Klass.output_out } }
|
48
|
+
it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
|
49
|
+
end
|
53
50
|
|
54
|
-
|
51
|
+
describe ".output_err" do
|
52
|
+
subject { capture_stderr { Klass.output_err } }
|
53
|
+
it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
|
54
|
+
end
|
55
55
|
|
56
|
-
|
56
|
+
# Also you can use as 'Ariete.capture_xxx'
|
57
|
+
describe ".output_out" do
|
58
|
+
subject { Ariete.capture_stdout { Klass.output_out } }
|
59
|
+
it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
|
60
|
+
end
|
57
61
|
|
58
|
-
|
62
|
+
describe ".output_err" do
|
63
|
+
subject { Ariete.capture_stderr { Klass.output_err } }
|
64
|
+
it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
|
65
|
+
end
|
66
|
+
end
|
67
|
+
```
|
59
68
|
|
60
|
-
|
69
|
+
## Contributing
|
61
70
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
Hakto is distributed with MIT License. See the LICENSE file to read the detail of license.
|
69
|
-
|
70
|
-
## About Author
|
71
|
-
|
72
|
-
Moza USANE
|
73
|
-
[http://blog.quellencode.org/](http://blog.quellencode.org/ "")
|
74
|
-
mozamimy@quellencode.org
|
71
|
+
1. Fork it ( https://github.com/mozamimy/ariete/fork )
|
72
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
73
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
74
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
75
|
+
5. Create a new Pull Request
|
data/Rakefile
CHANGED
@@ -1,18 +1,6 @@
|
|
1
|
-
require "
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
2
3
|
|
3
|
-
|
4
|
-
s.name = "ariete"
|
5
|
-
s.summary = "Ariete STDOUT & STDERR Capture Module."
|
6
|
-
s.description = File.read(File.join(File.dirname(__FILE__), "README.md"))
|
7
|
-
s.version = "0.1.0"
|
8
|
-
s.author = "Moza USANE"
|
9
|
-
s.email = "mozamimy@quellencode.org"
|
10
|
-
s.homepage = "http://quellencode.org/"
|
11
|
-
s.platform = Gem::Platform::RUBY
|
12
|
-
s.required_ruby_version = ">=1.9"
|
13
|
-
s.files = Dir["**/**"]
|
14
|
-
s.test_files = Dir["test/test*.rb"]
|
15
|
-
s.has_rdoc = true
|
16
|
-
end
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
17
5
|
|
18
|
-
|
6
|
+
task default: :spec
|
data/ariete.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
lib = File.expand_path('../lib', __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require 'ariete/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "ariete"
|
7
|
+
spec.version = Ariete::VERSION
|
8
|
+
spec.authors = ["Moza USANE"]
|
9
|
+
spec.email = ["mozamimy@quellencode.org"]
|
10
|
+
spec.summary = %q{Ariete is capturing module for STDOUT & STDERR.}
|
11
|
+
spec.description = %q{Ariete is capturing module for STDOUT & STDERR.}
|
12
|
+
spec.homepage = "http://quellencode.org/"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files -z`.split("\x0")
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "rspec"
|
23
|
+
end
|
data/lib/ariete.rb
CHANGED
@@ -1,33 +1,12 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
# Ariete
|
2
|
+
# Copyright (c) 2014 Moza USANE
|
3
|
+
# This software is released under the MIT License.
|
4
|
+
# http://opensource.org/licenses/mit-license.php
|
3
5
|
|
4
6
|
require "stringio"
|
5
7
|
|
6
|
-
# Ariete STDOUT & STDERR Capture Module
|
7
|
-
# Author:: Moza USANE (mailto:mozamimy@quellencode.org)
|
8
|
-
# Copyright:: Copyright (c) 2012 Moza USANE
|
9
|
-
# License:: MIT License (see the LICENSE file)
|
10
8
|
module Ariete
|
11
|
-
|
12
9
|
["stdout", "stderr"].each do |name|
|
13
|
-
##
|
14
|
-
# :method: capture_stdout
|
15
|
-
# Capture STDOUT's output and return as String.
|
16
|
-
# ==== Args
|
17
|
-
# &block :: a block that you want to capture
|
18
|
-
# ==== Return
|
19
|
-
# Captured string
|
20
|
-
|
21
|
-
##
|
22
|
-
# :method: capture_stderr
|
23
|
-
# Capture STDERR's output and return as String.
|
24
|
-
# ==== Args
|
25
|
-
# &block :: a block that you want to capture
|
26
|
-
# ==== Return
|
27
|
-
# Captured string
|
28
|
-
|
29
|
-
##
|
30
|
-
|
31
10
|
define_method("capture_#{name}") do |*args, &block|
|
32
11
|
original = eval("$#{name}")
|
33
12
|
eval("$#{name} = StringIO.new")
|
@@ -41,6 +20,7 @@ module Ariete
|
|
41
20
|
|
42
21
|
ret_str
|
43
22
|
end
|
44
|
-
end
|
45
23
|
|
24
|
+
module_function "capture_#{name}"
|
25
|
+
end
|
46
26
|
end
|
data/spec/ariete_spec.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Ariete
|
2
|
+
# Copyright (c) 2014 Moza USANE
|
3
|
+
# This software is released under the MIT License.
|
4
|
+
# http://opensource.org/licenses/mit-license.php
|
5
|
+
|
6
|
+
require "spec_helper"
|
7
|
+
|
8
|
+
RSpec.describe Ariete do
|
9
|
+
include Ariete
|
10
|
+
|
11
|
+
def output
|
12
|
+
puts "Ariete is a kind of rabbit."
|
13
|
+
warn "Ariete means 'Lop' in Italian."
|
14
|
+
end
|
15
|
+
|
16
|
+
describe "#capture_stdout" do
|
17
|
+
subject { capture_stdout { output } }
|
18
|
+
it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "#capture_stderr" do
|
22
|
+
subject { capture_stderr { output } }
|
23
|
+
it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "module_function" do
|
27
|
+
describe "#capture_stdout" do
|
28
|
+
subject { Ariete.capture_stdout { output } }
|
29
|
+
it { expect(subject).to eq "Ariete is a kind of rabbit.\n" }
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#capture_stderr" do
|
33
|
+
subject { Ariete.capture_stderr { output } }
|
34
|
+
it { expect(subject).to eq "Ariete means 'Lop' in Italian.\n" }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -1,111 +1,101 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ariete
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Moza USANE
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
11
|
+
date: 2014-11-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Ariete is capturing module for STDOUT & STDERR.
|
56
|
+
email:
|
57
|
+
- mozamimy@quellencode.org
|
37
58
|
executables: []
|
38
59
|
extensions: []
|
39
60
|
extra_rdoc_files: []
|
40
61
|
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- Gemfile
|
66
|
+
- Gemfile.lock
|
67
|
+
- LICENSE.txt
|
41
68
|
- README.md
|
42
|
-
- CHANGELOG_jp.md
|
43
69
|
- Rakefile
|
44
|
-
-
|
45
|
-
- README_jp.md
|
70
|
+
- ariete.gemspec
|
46
71
|
- lib/ariete.rb
|
47
|
-
-
|
48
|
-
-
|
49
|
-
-
|
50
|
-
- doc/CaptureStdTest.html
|
51
|
-
- doc/images/plugin.png
|
52
|
-
- doc/images/zoom.png
|
53
|
-
- doc/images/page_green.png
|
54
|
-
- doc/images/bullet_toggle_plus.png
|
55
|
-
- doc/images/wrench.png
|
56
|
-
- doc/images/brick.png
|
57
|
-
- doc/images/delete.png
|
58
|
-
- doc/images/transparent.png
|
59
|
-
- doc/images/bug.png
|
60
|
-
- doc/images/ruby.png
|
61
|
-
- doc/images/loadingAnimation.gif
|
62
|
-
- doc/images/page_white_width.png
|
63
|
-
- doc/images/macFFBgHack.png
|
64
|
-
- doc/images/bullet_black.png
|
65
|
-
- doc/images/wrench_orange.png
|
66
|
-
- doc/images/brick_link.png
|
67
|
-
- doc/images/package.png
|
68
|
-
- doc/images/tag_blue.png
|
69
|
-
- doc/images/bullet_toggle_minus.png
|
70
|
-
- doc/images/page_white_text.png
|
71
|
-
- doc/images/date.png
|
72
|
-
- doc/images/find.png
|
73
|
-
- doc/images/add.png
|
74
|
-
- doc/images/tag_green.png
|
75
|
-
- doc/js/searcher.js
|
76
|
-
- doc/js/navigation.js
|
77
|
-
- doc/js/darkfish.js
|
78
|
-
- doc/js/search_index.js
|
79
|
-
- doc/js/search.js
|
80
|
-
- doc/js/jquery.js
|
81
|
-
- doc/LICENSE.html
|
82
|
-
- doc/table_of_contents.html
|
83
|
-
- doc/Rakefile.html
|
84
|
-
- doc/index.html
|
85
|
-
- CHANGELOG.md
|
86
|
-
- LICENSE
|
72
|
+
- lib/ariete/version.rb
|
73
|
+
- spec/ariete_spec.rb
|
74
|
+
- spec/spec_helper.rb
|
87
75
|
homepage: http://quellencode.org/
|
88
|
-
licenses:
|
76
|
+
licenses:
|
77
|
+
- MIT
|
78
|
+
metadata: {}
|
89
79
|
post_install_message:
|
90
80
|
rdoc_options: []
|
91
81
|
require_paths:
|
92
82
|
- lib
|
93
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
-
none: false
|
95
84
|
requirements:
|
96
|
-
- -
|
85
|
+
- - ">="
|
97
86
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
87
|
+
version: '0'
|
99
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
89
|
requirements:
|
102
|
-
- -
|
90
|
+
- - ">="
|
103
91
|
- !ruby/object:Gem::Version
|
104
92
|
version: '0'
|
105
93
|
requirements: []
|
106
94
|
rubyforge_project:
|
107
|
-
rubygems_version:
|
95
|
+
rubygems_version: 2.2.2
|
108
96
|
signing_key:
|
109
|
-
specification_version:
|
110
|
-
summary: Ariete STDOUT & STDERR
|
111
|
-
test_files:
|
97
|
+
specification_version: 4
|
98
|
+
summary: Ariete is capturing module for STDOUT & STDERR.
|
99
|
+
test_files:
|
100
|
+
- spec/ariete_spec.rb
|
101
|
+
- spec/spec_helper.rb
|