stdout 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/doc/ChangeLog +5 -0
- data/lib/stdout.rb +2 -2
- data/lib/stdout/output.rb +4 -3
- data/spec/lib/stdout/stdout_spec.rb +31 -0
- data/spec/lib/stdout_spec.rb +1 -1
- data/stdout.gemspec +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99f5920c4696438e1b2533cd737f7542b3696c10
|
4
|
+
data.tar.gz: a8158dc7f4b1b53d78d222d846c153f0402e901d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd01fbe0866774b7101db3a29ff7bbbb9a4be8d96be8bb81cd3fc21e8ee80404b1754c68cc84cd33d43957ecfb75b25f417676bccd16371417f171ea0684cb70
|
7
|
+
data.tar.gz: a6a286d11780ff56fb724e6bbd6cbd68e28832216cf3d85dd9f5c432b76d4fa217c3934880ec79bc427148fde60281c10cb8a534144f8f7d8cdaabcbde9723bb
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/doc/ChangeLog
CHANGED
data/lib/stdout.rb
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# Name:: Stdout
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Nov 11, 2013
|
5
|
-
# Updated:: Nov
|
5
|
+
# Updated:: Nov 12, 2013
|
6
6
|
# Copyright:: 774 <http://id774.net> Copyright (c) 2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
9
9
|
module Stdout
|
10
|
-
VERSION = "0.0.
|
10
|
+
VERSION = "0.0.2"
|
11
11
|
require File.dirname(__FILE__) + "/stdout/output"
|
12
12
|
end
|
data/lib/stdout/output.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
# Name:: Stdout
|
2
|
+
# Name:: Stdout::Output
|
3
3
|
# Author:: 774 <http://id774.net>
|
4
4
|
# Created:: Nov 11, 2013
|
5
|
-
# Updated:: Nov
|
5
|
+
# Updated:: Nov 12, 2013
|
6
6
|
# Copyright:: 774 <http://id774.net> Copyright (c) 2013
|
7
7
|
# License:: Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3.0.
|
8
8
|
|
@@ -20,9 +20,10 @@ module Stdout
|
|
20
20
|
class << self
|
21
21
|
def capture(sep = $/)
|
22
22
|
output = self.new
|
23
|
+
saved_stdout = $stdout
|
23
24
|
$stdout = output
|
24
25
|
yield
|
25
|
-
$stdout =
|
26
|
+
$stdout = saved_stdout
|
26
27
|
output.print.join.each_line(sep = sep) {|line|
|
27
28
|
output.dump.push(line)
|
28
29
|
}
|
@@ -77,6 +77,37 @@ describe Stdout::Output do
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
describe 'giving block of puts' do
|
81
|
+
it "should save stdout status" do
|
82
|
+
|
83
|
+
class OutputMock
|
84
|
+
def write(msg); end
|
85
|
+
end
|
86
|
+
|
87
|
+
output = OutputMock.new
|
88
|
+
|
89
|
+
Stdout::Output.capture {
|
90
|
+
puts "aaa"
|
91
|
+
puts "bbb"
|
92
|
+
puts "ccc"
|
93
|
+
}
|
94
|
+
|
95
|
+
$stdout.should equal STDOUT
|
96
|
+
$stdout.should_not equal output
|
97
|
+
|
98
|
+
$stdout = output
|
99
|
+
|
100
|
+
Stdout::Output.capture {
|
101
|
+
puts "aaa"
|
102
|
+
puts "bbb"
|
103
|
+
puts "ccc"
|
104
|
+
}
|
105
|
+
|
106
|
+
$stdout.should_not equal STDOUT
|
107
|
+
$stdout.should equal output
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
80
111
|
end
|
81
112
|
|
82
113
|
context 'capture method with separator "\r"' do
|
data/spec/lib/stdout_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
5
5
|
describe Stdout do
|
6
6
|
context 'const get :VERSION should' do
|
7
7
|
it "return right version number" do
|
8
|
-
expect = '0.0.
|
8
|
+
expect = '0.0.2'
|
9
9
|
Stdout.const_get(:VERSION).should be_true
|
10
10
|
Stdout.const_get(:VERSION).should eq expect
|
11
11
|
end
|
data/stdout.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: stdout 0.0.
|
5
|
+
# stub: stdout 0.0.2 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "stdout"
|
9
|
-
s.version = "0.0.
|
9
|
+
s.version = "0.0.2"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.authors = ["id774"]
|
13
|
-
s.date = "2013-11-
|
13
|
+
s.date = "2013-11-12"
|
14
14
|
s.description = "Change stdout to array object"
|
15
15
|
s.email = "idnanashi@gmail.com"
|
16
16
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stdout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- id774
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|