devnull 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gemtest +0 -0
- data/History.txt +8 -0
- data/README.txt +75 -0
- data/lib/devnull.rb +1 -1
- data/spec/devnull_spec.rb +1 -1
- metadata +71 -151
- data/.document +0 -5
- data/.rspec +0 -1
- data/Gemfile +0 -13
- data/LICENSE.txt +0 -20
- data/README.rdoc +0 -47
- data/Rakefile +0 -80
- data/VERSION +0 -1
- data/devnull.gemspec +0 -92
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YjNkMmFiODI0YmMzNmQ5YWM3OTQ3YzY0NWQ4NTU3Mjk2MzdhYmI2Nw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTdkNzAwMzAzZmY3ZjRlNmEyZjlhNTczYzEzMTBjMGM0ZDk0NGMyNQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
Y2ExMDFhNDZiZTk5NTZhMTNjZDViNWI1YTQ4NTRhYmY1OWQxODQ1ZjUxNDgw
|
10
|
+
NWU3ODMxMzJhYmE1ZDE1YjMyNDNiMGM1OGE2OGJhY2U5NTVmYzk2MTVlYTI4
|
11
|
+
NWFmMjM0YjA1Y2JmNGVkZmQ2YjJiZTJkZDM5NmFkNzRjM2Y1NDg=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZGQ3N2QxYzg3Y2JlMThiOGU5N2RlNGFlZDJlZTQxYTc1MDk2MTk2ZTc4YzI0
|
14
|
+
MTc5ZjUxNzI4YmIzNjE2MWZhNWIzODM4OGMxZjVkMGVkNGM0Nzg2OTQ0ZDhj
|
15
|
+
MWQ3MDY5OGYwMTg0NzZhNDFiOWFhNWQyNTEzYTUyMGI0YWM5NGQ=
|
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
= devnull
|
2
|
+
|
3
|
+
http://github.com/maraigue/devnull
|
4
|
+
|
5
|
+
Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
DevNull behaves a null file, and works like an IO object. For example:
|
10
|
+
|
11
|
+
dn = DevNull.new
|
12
|
+
dn.puts "foo" # => nil (do nothing)
|
13
|
+
dn.gets # => nil
|
14
|
+
dn.read # => ""
|
15
|
+
|
16
|
+
The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
|
17
|
+
|
18
|
+
def some_process(arg, logfile = nil)
|
19
|
+
# You may set an IO object as 'logfile', and logs are written to the file.
|
20
|
+
|
21
|
+
result = process1(arg)
|
22
|
+
logfile.puts result if logfile
|
23
|
+
|
24
|
+
result = process2(arg)
|
25
|
+
logfile.puts result if logfile
|
26
|
+
|
27
|
+
result = process3(arg)
|
28
|
+
logfile.puts result if logfile
|
29
|
+
end
|
30
|
+
|
31
|
+
can be rewritten as follows:
|
32
|
+
|
33
|
+
def some_process(arg, logfile = DevNull.new)
|
34
|
+
logfile.puts process1(arg)
|
35
|
+
logfile.puts process2(arg)
|
36
|
+
logfile.puts process3(arg)
|
37
|
+
end
|
38
|
+
|
39
|
+
== INSTALL:
|
40
|
+
|
41
|
+
gem install devnull
|
42
|
+
|
43
|
+
== DEVELOPERS:
|
44
|
+
|
45
|
+
After checking out the source, run:
|
46
|
+
|
47
|
+
$ rake newb
|
48
|
+
|
49
|
+
This task will install any missing dependencies, run the tests/specs,
|
50
|
+
and generate the RDoc.
|
51
|
+
|
52
|
+
== LICENSE:
|
53
|
+
|
54
|
+
(The MIT License)
|
55
|
+
|
56
|
+
Copyright (c) 2011 H.Hiro (Maraigue)
|
57
|
+
|
58
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
59
|
+
a copy of this software and associated documentation files (the
|
60
|
+
"Software"), to deal in the Software without restriction, including
|
61
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
62
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
63
|
+
permit persons to whom the Software is furnished to do so, subject to
|
64
|
+
the following conditions:
|
65
|
+
|
66
|
+
The above copyright notice and this permission notice shall be
|
67
|
+
included in all copies or substantial portions of the Software.
|
68
|
+
|
69
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
70
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
71
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
72
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
73
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
74
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
75
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/devnull.rb
CHANGED
@@ -32,6 +32,7 @@
|
|
32
32
|
# end</pre>
|
33
33
|
|
34
34
|
require "enumerator"
|
35
|
+
VERSION = "0.1.1"
|
35
36
|
|
36
37
|
class DevNull
|
37
38
|
def initialize
|
@@ -58,7 +59,6 @@ class DevNull
|
|
58
59
|
def print(*args); end
|
59
60
|
def printf(arg1, *other_args); end
|
60
61
|
def puts(*args); end
|
61
|
-
def syswrite(*args); end
|
62
62
|
def ungetbyte(arg); end
|
63
63
|
def ungetc(arg); end
|
64
64
|
|
data/spec/devnull_spec.rb
CHANGED
@@ -53,7 +53,7 @@ describe DevNull do
|
|
53
53
|
it "should return an Enumerator for Devnull##{method_name}" do
|
54
54
|
# First, check whether the method returns an Enumerator.
|
55
55
|
enum = eval("@null.#{method_name}")
|
56
|
-
enum.should be_instance_of(
|
56
|
+
enum.should be_instance_of(Enumerator)
|
57
57
|
# Then, check whether the Enumerator is empty.
|
58
58
|
lambda{ enum.each{ raise RuntimeError } }.should_not raise_error
|
59
59
|
lambda{ eval("@null.#{method_name} { raise RuntimeError }") }.should_not raise_error
|
metadata
CHANGED
@@ -1,170 +1,90 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: devnull
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
- H.Hiro (
|
6
|
+
authors:
|
7
|
+
- H.Hiro (maraigue)
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 2
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
version: 2.3.0
|
34
|
-
prerelease: false
|
35
|
-
type: :development
|
36
|
-
requirement: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: bundler
|
39
|
-
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
-
none: false
|
41
|
-
requirements:
|
42
|
-
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
hash: 23
|
45
|
-
segments:
|
46
|
-
- 1
|
47
|
-
- 0
|
48
|
-
- 0
|
49
|
-
version: 1.0.0
|
50
|
-
prerelease: false
|
11
|
+
date: 2013-06-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rdoc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
51
20
|
type: :development
|
52
|
-
requirement: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: jeweler
|
55
|
-
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
|
-
requirements:
|
58
|
-
- - ">="
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
hash: 7
|
61
|
-
segments:
|
62
|
-
- 1
|
63
|
-
- 5
|
64
|
-
- 2
|
65
|
-
version: 1.5.2
|
66
21
|
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hoe
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.6'
|
67
34
|
type: :development
|
68
|
-
requirement: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rcov
|
71
|
-
version_requirements: &id004 !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
|
-
requirements:
|
74
|
-
- - ">="
|
75
|
-
- !ruby/object:Gem::Version
|
76
|
-
hash: 3
|
77
|
-
segments:
|
78
|
-
- 0
|
79
|
-
version: "0"
|
80
35
|
prerelease: false
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
dn.puts "foo" # => nil (do nothing)
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
result = process2(arg)
|
100
|
-
logfile.puts result if logfile
|
101
|
-
|
102
|
-
result = process3(arg)
|
103
|
-
logfile.puts result if logfile
|
104
|
-
end
|
105
|
-
|
106
|
-
can be rewritten as follows:
|
107
|
-
|
108
|
-
def some_process(arg, logfile = DevNull.new)
|
109
|
-
logfile.puts process1(arg)
|
110
|
-
logfile.puts process2(arg)
|
111
|
-
logfile.puts process3(arg)
|
112
|
-
end
|
113
|
-
|
114
|
-
email: main@hhiro.net
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.6'
|
41
|
+
description: ! "DevNull behaves a null file, and works like an IO object. For example:\n\n
|
42
|
+
dn = DevNull.new\n dn.puts \"foo\" # => nil (do nothing)\n dn.gets # => nil\n dn.read
|
43
|
+
# => \"\"\n\nThe library may be a good solution if you would like to switch whether
|
44
|
+
an input/output file is needed. For example:\n\n def some_process(arg, logfile =
|
45
|
+
nil)\n # You may set an IO object as 'logfile', and logs are written to the file.\n
|
46
|
+
\ \n result = process1(arg)\n logfile.puts result if logfile\n \n result
|
47
|
+
= process2(arg)\n logfile.puts result if logfile\n \n result = process3(arg)\n
|
48
|
+
\ logfile.puts result if logfile\n end\n\ncan be rewritten as follows:\n\n def
|
49
|
+
some_process(arg, logfile = DevNull.new)\n logfile.puts process1(arg)\n logfile.puts
|
50
|
+
process2(arg)\n logfile.puts process3(arg)\n end"
|
51
|
+
email:
|
52
|
+
- main@hhiro.net
|
115
53
|
executables: []
|
116
|
-
|
117
54
|
extensions: []
|
118
|
-
|
119
|
-
|
120
|
-
-
|
121
|
-
|
122
|
-
|
123
|
-
- .
|
124
|
-
- .rspec
|
125
|
-
- Gemfile
|
126
|
-
- LICENSE.txt
|
127
|
-
- README.rdoc
|
128
|
-
- Rakefile
|
129
|
-
- VERSION
|
130
|
-
- devnull.gemspec
|
55
|
+
extra_rdoc_files:
|
56
|
+
- History.txt
|
57
|
+
- README.txt
|
58
|
+
files:
|
59
|
+
- History.txt
|
60
|
+
- README.txt
|
131
61
|
- lib/devnull.rb
|
132
62
|
- spec/devnull_spec.rb
|
133
63
|
- spec/spec_helper.rb
|
134
|
-
|
64
|
+
- .gemtest
|
135
65
|
homepage: http://github.com/maraigue/devnull
|
136
|
-
licenses:
|
137
|
-
|
66
|
+
licenses: []
|
67
|
+
metadata: {}
|
138
68
|
post_install_message:
|
139
|
-
rdoc_options:
|
140
|
-
|
141
|
-
|
69
|
+
rdoc_options:
|
70
|
+
- --main
|
71
|
+
- README.txt
|
72
|
+
require_paths:
|
142
73
|
- lib
|
143
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
none: false
|
154
|
-
requirements:
|
155
|
-
- - ">="
|
156
|
-
- !ruby/object:Gem::Version
|
157
|
-
hash: 3
|
158
|
-
segments:
|
159
|
-
- 0
|
160
|
-
version: "0"
|
74
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
79
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
161
84
|
requirements: []
|
162
|
-
|
163
|
-
|
164
|
-
rubygems_version: 1.6.2
|
85
|
+
rubyforge_project: devnull
|
86
|
+
rubygems_version: 2.0.3
|
165
87
|
signing_key:
|
166
|
-
specification_version:
|
167
|
-
summary:
|
168
|
-
test_files:
|
169
|
-
- spec/devnull_spec.rb
|
170
|
-
- spec/spec_helper.rb
|
88
|
+
specification_version: 4
|
89
|
+
summary: DevNull behaves a null file, and works like an IO object
|
90
|
+
test_files: []
|
data/.document
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/Gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
# gem "activesupport", ">= 2.3.5"
|
5
|
-
|
6
|
-
# Add dependencies to develop your gem here.
|
7
|
-
# Include everything needed to run rake, tests, features, etc.
|
8
|
-
group :development do
|
9
|
-
gem "rspec", ">= 2.3.0"
|
10
|
-
gem "bundler", ">= 1.0.0"
|
11
|
-
gem "jeweler", ">= 1.5.2"
|
12
|
-
gem "rcov", ">= 0"
|
13
|
-
end
|
data/LICENSE.txt
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
Copyright (c) 2011 H.Hiro (Maraigue)
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
-
a copy of this software and associated documentation files (the
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
9
|
-
the following conditions:
|
10
|
-
|
11
|
-
The above copyright notice and this permission notice shall be
|
12
|
-
included in all copies or substantial portions of the Software.
|
13
|
-
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
= devnull
|
2
|
-
|
3
|
-
DevNull behaves a null file, and works like an IO object. For example:
|
4
|
-
|
5
|
-
dn = DevNull.new
|
6
|
-
dn.puts "foo" # => nil (do nothing)
|
7
|
-
dn.gets # => nil
|
8
|
-
dn.read # => ""
|
9
|
-
|
10
|
-
The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
|
11
|
-
|
12
|
-
def some_process(arg, logfile = nil)
|
13
|
-
# You may set an IO object as 'logfile', and logs are written to the file.
|
14
|
-
|
15
|
-
result = process1(arg)
|
16
|
-
logfile.puts result if logfile
|
17
|
-
|
18
|
-
result = process2(arg)
|
19
|
-
logfile.puts result if logfile
|
20
|
-
|
21
|
-
result = process3(arg)
|
22
|
-
logfile.puts result if logfile
|
23
|
-
end
|
24
|
-
|
25
|
-
can be rewritten as follows:
|
26
|
-
|
27
|
-
def some_process(arg, logfile = DevNull.new)
|
28
|
-
logfile.puts process1(arg)
|
29
|
-
logfile.puts process2(arg)
|
30
|
-
logfile.puts process3(arg)
|
31
|
-
end
|
32
|
-
|
33
|
-
== Contributing to devnull
|
34
|
-
|
35
|
-
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
36
|
-
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
37
|
-
* Fork the project
|
38
|
-
* Start a feature/bugfix branch
|
39
|
-
* Commit and push until you are happy with your contribution
|
40
|
-
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
41
|
-
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
42
|
-
|
43
|
-
== Copyright
|
44
|
-
|
45
|
-
Copyright (c) 2011 maraigue. See LICENSE.txt for
|
46
|
-
further details.
|
47
|
-
|
data/Rakefile
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'bundler'
|
3
|
-
begin
|
4
|
-
Bundler.setup(:default, :development)
|
5
|
-
rescue Bundler::BundlerError => e
|
6
|
-
$stderr.puts e.message
|
7
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
-
exit e.status_code
|
9
|
-
end
|
10
|
-
require 'rake'
|
11
|
-
|
12
|
-
require 'jeweler'
|
13
|
-
Jeweler::Tasks.new do |gem|
|
14
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
-
gem.name = "devnull"
|
16
|
-
gem.homepage = "http://github.com/maraigue/devnull"
|
17
|
-
gem.license = "MIT"
|
18
|
-
gem.summary = %Q{Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)}
|
19
|
-
gem.description = <<DESC
|
20
|
-
DevNull behaves a null file, and works like an IO object. For example:
|
21
|
-
|
22
|
-
dn = DevNull.new
|
23
|
-
dn.puts "foo" # => nil (do nothing)
|
24
|
-
dn.gets # => nil
|
25
|
-
dn.read # => ""
|
26
|
-
|
27
|
-
The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
|
28
|
-
|
29
|
-
def some_process(arg, logfile = nil)
|
30
|
-
# You may set an IO object as 'logfile', and logs are written to the file.
|
31
|
-
|
32
|
-
result = process1(arg)
|
33
|
-
logfile.puts result if logfile
|
34
|
-
|
35
|
-
result = process2(arg)
|
36
|
-
logfile.puts result if logfile
|
37
|
-
|
38
|
-
result = process3(arg)
|
39
|
-
logfile.puts result if logfile
|
40
|
-
end
|
41
|
-
|
42
|
-
can be rewritten as follows:
|
43
|
-
|
44
|
-
def some_process(arg, logfile = DevNull.new)
|
45
|
-
logfile.puts process1(arg)
|
46
|
-
logfile.puts process2(arg)
|
47
|
-
logfile.puts process3(arg)
|
48
|
-
end
|
49
|
-
DESC
|
50
|
-
gem.email = "main@hhiro.net"
|
51
|
-
gem.authors = ["H.Hiro (Maraigue)"]
|
52
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
53
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
54
|
-
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
55
|
-
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
56
|
-
end
|
57
|
-
Jeweler::RubygemsDotOrgTasks.new
|
58
|
-
|
59
|
-
require 'rspec/core'
|
60
|
-
require 'rspec/core/rake_task'
|
61
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
62
|
-
spec.pattern = FileList['spec/**/*_spec.rb']
|
63
|
-
end
|
64
|
-
|
65
|
-
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
66
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
67
|
-
spec.rcov = true
|
68
|
-
end
|
69
|
-
|
70
|
-
task :default => :spec
|
71
|
-
|
72
|
-
require 'rake/rdoctask'
|
73
|
-
Rake::RDocTask.new do |rdoc|
|
74
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
75
|
-
|
76
|
-
rdoc.rdoc_dir = 'rdoc'
|
77
|
-
rdoc.title = "devnull #{version}"
|
78
|
-
rdoc.rdoc_files.include('README*')
|
79
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
80
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.0
|
data/devnull.gemspec
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{devnull}
|
8
|
-
s.version = "0.1.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["H.Hiro (Maraigue)"]
|
12
|
-
s.date = %q{2011-03-28}
|
13
|
-
s.description = %q{DevNull behaves a null file, and works like an IO object. For example:
|
14
|
-
|
15
|
-
dn = DevNull.new
|
16
|
-
dn.puts "foo" # => nil (do nothing)
|
17
|
-
dn.gets # => nil
|
18
|
-
dn.read # => ""
|
19
|
-
|
20
|
-
The library may be a good solution if you would like to switch whether an input/output file is needed. For example:
|
21
|
-
|
22
|
-
def some_process(arg, logfile = nil)
|
23
|
-
# You may set an IO object as 'logfile', and logs are written to the file.
|
24
|
-
|
25
|
-
result = process1(arg)
|
26
|
-
logfile.puts result if logfile
|
27
|
-
|
28
|
-
result = process2(arg)
|
29
|
-
logfile.puts result if logfile
|
30
|
-
|
31
|
-
result = process3(arg)
|
32
|
-
logfile.puts result if logfile
|
33
|
-
end
|
34
|
-
|
35
|
-
can be rewritten as follows:
|
36
|
-
|
37
|
-
def some_process(arg, logfile = DevNull.new)
|
38
|
-
logfile.puts process1(arg)
|
39
|
-
logfile.puts process2(arg)
|
40
|
-
logfile.puts process3(arg)
|
41
|
-
end
|
42
|
-
}
|
43
|
-
s.email = %q{main@hhiro.net}
|
44
|
-
s.extra_rdoc_files = [
|
45
|
-
"LICENSE.txt",
|
46
|
-
"README.rdoc"
|
47
|
-
]
|
48
|
-
s.files = [
|
49
|
-
".document",
|
50
|
-
".rspec",
|
51
|
-
"Gemfile",
|
52
|
-
"LICENSE.txt",
|
53
|
-
"README.rdoc",
|
54
|
-
"Rakefile",
|
55
|
-
"VERSION",
|
56
|
-
"devnull.gemspec",
|
57
|
-
"lib/devnull.rb",
|
58
|
-
"spec/devnull_spec.rb",
|
59
|
-
"spec/spec_helper.rb"
|
60
|
-
]
|
61
|
-
s.homepage = %q{http://github.com/maraigue/devnull}
|
62
|
-
s.licenses = ["MIT"]
|
63
|
-
s.require_paths = ["lib"]
|
64
|
-
s.rubygems_version = %q{1.6.2}
|
65
|
-
s.summary = %q{Ruby implementation of null file (like /dev/null on Un*x, NUL on Windows)}
|
66
|
-
s.test_files = [
|
67
|
-
"spec/devnull_spec.rb",
|
68
|
-
"spec/spec_helper.rb"
|
69
|
-
]
|
70
|
-
|
71
|
-
if s.respond_to? :specification_version then
|
72
|
-
s.specification_version = 3
|
73
|
-
|
74
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
75
|
-
s.add_development_dependency(%q<rspec>, [">= 2.3.0"])
|
76
|
-
s.add_development_dependency(%q<bundler>, [">= 1.0.0"])
|
77
|
-
s.add_development_dependency(%q<jeweler>, [">= 1.5.2"])
|
78
|
-
s.add_development_dependency(%q<rcov>, [">= 0"])
|
79
|
-
else
|
80
|
-
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
81
|
-
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
82
|
-
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
83
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
84
|
-
end
|
85
|
-
else
|
86
|
-
s.add_dependency(%q<rspec>, [">= 2.3.0"])
|
87
|
-
s.add_dependency(%q<bundler>, [">= 1.0.0"])
|
88
|
-
s.add_dependency(%q<jeweler>, [">= 1.5.2"])
|
89
|
-
s.add_dependency(%q<rcov>, [">= 0"])
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|