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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2d48e9b46f81207f22c3cad486d708d9672dd08a
4
- data.tar.gz: cedaa1a2c240fdd77623018fee7f1c6d13d0e308
3
+ metadata.gz: 99f5920c4696438e1b2533cd737f7542b3696c10
4
+ data.tar.gz: a8158dc7f4b1b53d78d222d846c153f0402e901d
5
5
  SHA512:
6
- metadata.gz: bc1853e800776d2e3bf56d333caef9b51e140492b73326852307e1ba066111728b138b506bbb71eb59dc87d64998261c7e362825af18a609129fb24caca6e55e
7
- data.tar.gz: f22ffd481a742ccecb9b67d4890bdf2dda389a454c6aaf6894ab26c61eef9cf4f2aab40639e24f744c6dd730104fff063bf20b531fabdbde0ec4c6f87ee84996
6
+ metadata.gz: cd01fbe0866774b7101db3a29ff7bbbb9a4be8d96be8bb81cd3fc21e8ee80404b1754c68cc84cd33d43957ecfb75b25f417676bccd16371417f171ea0684cb70
7
+ data.tar.gz: a6a286d11780ff56fb724e6bbd6cbd68e28832216cf3d85dd9f5c432b76d4fa217c3934880ec79bc427148fde60281c10cb8a534144f8f7d8cdaabcbde9723bb
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -1,3 +1,8 @@
1
+ === 0.0.2 / 2013-11-12
2
+
3
+ * Save before status of stdout.
4
+
5
+
1
6
  === 0.0.1 / 2013-11-11
2
7
 
3
8
  * First release.
@@ -2,11 +2,11 @@
2
2
  # Name:: Stdout
3
3
  # Author:: 774 <http://id774.net>
4
4
  # Created:: Nov 11, 2013
5
- # Updated:: Nov 11, 2013
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.1"
10
+ VERSION = "0.0.2"
11
11
  require File.dirname(__FILE__) + "/stdout/output"
12
12
  end
@@ -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 11, 2013
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 = 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
@@ -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.1'
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
@@ -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.1 ruby lib
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.1"
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-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.1
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 00:00:00.000000000 Z
11
+ date: 2013-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber