io-like 0.3.1 → 0.4.0.pre1
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 +7 -0
- data/LICENSE +1 -1
- data/NEWS.md +14 -1
- data/README.md +75 -94
- data/lib/io/like.rb +1916 -1314
- data/lib/io/like_helpers/abstract_io.rb +512 -0
- data/lib/io/like_helpers/blocking_io.rb +86 -0
- data/lib/io/like_helpers/buffered_io.rb +555 -0
- data/lib/io/like_helpers/character_io/basic_reader.rb +122 -0
- data/lib/io/like_helpers/character_io/converter_reader.rb +252 -0
- data/lib/io/like_helpers/character_io.rb +529 -0
- data/lib/io/like_helpers/delegated_io.rb +250 -0
- data/lib/io/like_helpers/duplexed_io.rb +259 -0
- data/lib/io/like_helpers/io.rb +21 -0
- data/lib/io/like_helpers/io_wrapper.rb +290 -0
- data/lib/io/like_helpers/pipeline.rb +77 -0
- data/lib/io/like_helpers/ruby_facts.rb +33 -0
- data/lib/io/like_helpers.rb +14 -0
- metadata +107 -224
- data/.yardopts +0 -1
- data/Rakefile +0 -228
- data/ruby.1.8.mspec +0 -7
- data/spec/binmode_spec.rb +0 -29
- data/spec/close_read_spec.rb +0 -64
- data/spec/close_spec.rb +0 -36
- data/spec/close_write_spec.rb +0 -61
- data/spec/closed_spec.rb +0 -16
- data/spec/each_byte_spec.rb +0 -38
- data/spec/each_line_spec.rb +0 -11
- data/spec/each_spec.rb +0 -11
- data/spec/eof_spec.rb +0 -11
- data/spec/fixtures/classes.rb +0 -96
- data/spec/fixtures/gets.txt +0 -9
- data/spec/fixtures/numbered_lines.txt +0 -5
- data/spec/fixtures/one_byte.txt +0 -1
- data/spec/fixtures/paragraphs.txt +0 -7
- data/spec/fixtures/readlines.txt +0 -6
- data/spec/flush_spec.rb +0 -8
- data/spec/getc_spec.rb +0 -44
- data/spec/gets_spec.rb +0 -212
- data/spec/isatty_spec.rb +0 -6
- data/spec/lineno_spec.rb +0 -84
- data/spec/output_spec.rb +0 -47
- data/spec/pos_spec.rb +0 -53
- data/spec/print_spec.rb +0 -97
- data/spec/printf_spec.rb +0 -24
- data/spec/putc_spec.rb +0 -57
- data/spec/puts_spec.rb +0 -99
- data/spec/read_spec.rb +0 -162
- data/spec/readchar_spec.rb +0 -49
- data/spec/readline_spec.rb +0 -60
- data/spec/readlines_spec.rb +0 -140
- data/spec/readpartial_spec.rb +0 -92
- data/spec/rewind_spec.rb +0 -56
- data/spec/seek_spec.rb +0 -72
- data/spec/shared/each.rb +0 -204
- data/spec/shared/eof.rb +0 -116
- data/spec/shared/pos.rb +0 -39
- data/spec/shared/tty.rb +0 -12
- data/spec/shared/write.rb +0 -53
- data/spec/sync_spec.rb +0 -56
- data/spec/sysread_spec.rb +0 -87
- data/spec/sysseek_spec.rb +0 -68
- data/spec/syswrite_spec.rb +0 -60
- data/spec/tell_spec.rb +0 -7
- data/spec/to_io_spec.rb +0 -19
- data/spec/tty_spec.rb +0 -6
- data/spec/ungetc_spec.rb +0 -118
- data/spec/write_spec.rb +0 -61
- data/spec_helper.rb +0 -49
- /data/{LICENSE-rubyspec → rubyspec/LICENSE} +0 -0
metadata
CHANGED
@@ -1,265 +1,148 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: io-like
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 1
|
10
|
-
version: 0.3.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0.pre1
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Jeremy Bopp
|
14
8
|
- Jarred Holman
|
15
9
|
- Grant Gardner
|
16
10
|
- Jordan Pickwell
|
17
|
-
autorequire:
|
18
11
|
bindir: bin
|
19
12
|
cert_chain: []
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
- !ruby/object:Gem::Dependency
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 37
|
30
|
-
segments:
|
31
|
-
- 10
|
32
|
-
- 3
|
33
|
-
version: "10.3"
|
34
|
-
version_requirements: *id001
|
13
|
+
date: 2025-05-08 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
35
16
|
name: rake
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '13.0'
|
36
22
|
type: :development
|
37
23
|
prerelease: false
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
name: mspec
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '13.0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: yard
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0.9'
|
51
36
|
type: :development
|
52
37
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
name: yard
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.9'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: github-markup
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '3.0'
|
66
50
|
type: :development
|
67
51
|
prerelease: false
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
name: yard-redcarpet-ext
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.0'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: redcarpet
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '3.1'
|
81
64
|
type: :development
|
82
65
|
prerelease: false
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
name: github-markup
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '3.1'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: simplecov
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.20.0
|
96
78
|
type: :development
|
97
79
|
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 0.20.0
|
98
85
|
description: |
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
email:
|
86
|
+
This gem makes it possible to build filters or pipelines for processing data
|
87
|
+
into or out of streams of bytes while maintaining compatibility with native Ruby
|
88
|
+
IO classes. Ruby IO classes may function as both sources and sinks, or entirely
|
89
|
+
new IO implementations may be created.
|
90
|
+
email:
|
106
91
|
- jeremy@bopp.net
|
107
92
|
- jarred.holman@gmail.com
|
108
93
|
- grant@lastweekend.com.au
|
109
94
|
- jpickwell@users.noreply.github.com
|
110
95
|
executables: []
|
111
|
-
|
112
96
|
extensions: []
|
113
|
-
|
114
|
-
extra_rdoc_files:
|
97
|
+
extra_rdoc_files:
|
115
98
|
- LICENSE
|
116
|
-
- LICENSE-rubyspec
|
117
99
|
- NEWS.md
|
118
100
|
- README.md
|
119
|
-
|
120
|
-
|
101
|
+
- rubyspec/LICENSE
|
102
|
+
files:
|
121
103
|
- LICENSE
|
122
|
-
- LICENSE-rubyspec
|
123
104
|
- NEWS.md
|
124
105
|
- README.md
|
125
|
-
- Rakefile
|
126
106
|
- lib/io/like.rb
|
127
|
-
-
|
128
|
-
-
|
129
|
-
-
|
130
|
-
-
|
131
|
-
-
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
136
|
-
-
|
137
|
-
-
|
138
|
-
-
|
139
|
-
-
|
140
|
-
-
|
141
|
-
- spec/fixtures/paragraphs.txt
|
142
|
-
- spec/fixtures/readlines.txt
|
143
|
-
- spec/flush_spec.rb
|
144
|
-
- spec/getc_spec.rb
|
145
|
-
- spec/gets_spec.rb
|
146
|
-
- spec/isatty_spec.rb
|
147
|
-
- spec/lineno_spec.rb
|
148
|
-
- spec/output_spec.rb
|
149
|
-
- spec/pos_spec.rb
|
150
|
-
- spec/print_spec.rb
|
151
|
-
- spec/printf_spec.rb
|
152
|
-
- spec/putc_spec.rb
|
153
|
-
- spec/puts_spec.rb
|
154
|
-
- spec/read_spec.rb
|
155
|
-
- spec/readchar_spec.rb
|
156
|
-
- spec/readline_spec.rb
|
157
|
-
- spec/readlines_spec.rb
|
158
|
-
- spec/readpartial_spec.rb
|
159
|
-
- spec/rewind_spec.rb
|
160
|
-
- spec/seek_spec.rb
|
161
|
-
- spec/shared/each.rb
|
162
|
-
- spec/shared/eof.rb
|
163
|
-
- spec/shared/pos.rb
|
164
|
-
- spec/shared/tty.rb
|
165
|
-
- spec/shared/write.rb
|
166
|
-
- spec/sync_spec.rb
|
167
|
-
- spec/sysread_spec.rb
|
168
|
-
- spec/sysseek_spec.rb
|
169
|
-
- spec/syswrite_spec.rb
|
170
|
-
- spec/tell_spec.rb
|
171
|
-
- spec/to_io_spec.rb
|
172
|
-
- spec/tty_spec.rb
|
173
|
-
- spec/ungetc_spec.rb
|
174
|
-
- spec/write_spec.rb
|
175
|
-
- spec_helper.rb
|
107
|
+
- lib/io/like_helpers.rb
|
108
|
+
- lib/io/like_helpers/abstract_io.rb
|
109
|
+
- lib/io/like_helpers/blocking_io.rb
|
110
|
+
- lib/io/like_helpers/buffered_io.rb
|
111
|
+
- lib/io/like_helpers/character_io.rb
|
112
|
+
- lib/io/like_helpers/character_io/basic_reader.rb
|
113
|
+
- lib/io/like_helpers/character_io/converter_reader.rb
|
114
|
+
- lib/io/like_helpers/delegated_io.rb
|
115
|
+
- lib/io/like_helpers/duplexed_io.rb
|
116
|
+
- lib/io/like_helpers/io.rb
|
117
|
+
- lib/io/like_helpers/io_wrapper.rb
|
118
|
+
- lib/io/like_helpers/pipeline.rb
|
119
|
+
- lib/io/like_helpers/ruby_facts.rb
|
120
|
+
- rubyspec/LICENSE
|
176
121
|
homepage: http://github.com/javanthropus/io-like
|
177
|
-
licenses:
|
122
|
+
licenses:
|
178
123
|
- MIT
|
179
|
-
|
180
|
-
rdoc_options:
|
181
|
-
- --title
|
124
|
+
metadata: {}
|
125
|
+
rdoc_options:
|
126
|
+
- "--title"
|
182
127
|
- IO::Like Documentation
|
183
|
-
- --charset
|
128
|
+
- "--charset"
|
184
129
|
- utf-8
|
185
|
-
- --line-numbers
|
186
|
-
- --inline-source
|
187
|
-
require_paths:
|
130
|
+
- "--line-numbers"
|
131
|
+
- "--inline-source"
|
132
|
+
require_paths:
|
188
133
|
- lib
|
189
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
190
|
-
|
191
|
-
requirements:
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
192
136
|
- - ">="
|
193
|
-
- !ruby/object:Gem::Version
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
- 8
|
198
|
-
- 1
|
199
|
-
version: 1.8.1
|
200
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
201
|
-
none: false
|
202
|
-
requirements:
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.5.0
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
203
141
|
- - ">="
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
|
206
|
-
segments:
|
207
|
-
- 0
|
208
|
-
version: "0"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
209
144
|
requirements: []
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
specification_version: 3
|
215
|
-
summary: A module which provides the functionality of an IO object to any including class which provides a couple of simple methods.
|
216
|
-
test_files:
|
217
|
-
- ruby.1.8.mspec
|
218
|
-
- spec/binmode_spec.rb
|
219
|
-
- spec/close_read_spec.rb
|
220
|
-
- spec/close_spec.rb
|
221
|
-
- spec/close_write_spec.rb
|
222
|
-
- spec/closed_spec.rb
|
223
|
-
- spec/each_byte_spec.rb
|
224
|
-
- spec/each_line_spec.rb
|
225
|
-
- spec/each_spec.rb
|
226
|
-
- spec/eof_spec.rb
|
227
|
-
- spec/fixtures/classes.rb
|
228
|
-
- spec/fixtures/gets.txt
|
229
|
-
- spec/fixtures/numbered_lines.txt
|
230
|
-
- spec/fixtures/one_byte.txt
|
231
|
-
- spec/fixtures/paragraphs.txt
|
232
|
-
- spec/fixtures/readlines.txt
|
233
|
-
- spec/flush_spec.rb
|
234
|
-
- spec/getc_spec.rb
|
235
|
-
- spec/gets_spec.rb
|
236
|
-
- spec/isatty_spec.rb
|
237
|
-
- spec/lineno_spec.rb
|
238
|
-
- spec/output_spec.rb
|
239
|
-
- spec/pos_spec.rb
|
240
|
-
- spec/print_spec.rb
|
241
|
-
- spec/printf_spec.rb
|
242
|
-
- spec/putc_spec.rb
|
243
|
-
- spec/puts_spec.rb
|
244
|
-
- spec/read_spec.rb
|
245
|
-
- spec/readchar_spec.rb
|
246
|
-
- spec/readline_spec.rb
|
247
|
-
- spec/readlines_spec.rb
|
248
|
-
- spec/readpartial_spec.rb
|
249
|
-
- spec/rewind_spec.rb
|
250
|
-
- spec/seek_spec.rb
|
251
|
-
- spec/shared/each.rb
|
252
|
-
- spec/shared/eof.rb
|
253
|
-
- spec/shared/pos.rb
|
254
|
-
- spec/shared/tty.rb
|
255
|
-
- spec/shared/write.rb
|
256
|
-
- spec/sync_spec.rb
|
257
|
-
- spec/sysread_spec.rb
|
258
|
-
- spec/sysseek_spec.rb
|
259
|
-
- spec/syswrite_spec.rb
|
260
|
-
- spec/tell_spec.rb
|
261
|
-
- spec/to_io_spec.rb
|
262
|
-
- spec/tty_spec.rb
|
263
|
-
- spec/ungetc_spec.rb
|
264
|
-
- spec/write_spec.rb
|
265
|
-
- spec_helper.rb
|
145
|
+
rubygems_version: 3.6.2
|
146
|
+
specification_version: 4
|
147
|
+
summary: A composable implementation of IO methods.
|
148
|
+
test_files: []
|
data/.yardopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--protected --private --plugin redcarpet-ext --main README.md lib/**/*.rb - NEWS.md LICENSE LICENSE-rubyspec
|
data/Rakefile
DELETED
@@ -1,228 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
# -*- ruby -*-
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
|
6
|
-
require 'erb'
|
7
|
-
require 'rake/testtask'
|
8
|
-
require 'rubygems/package_task'
|
9
|
-
require 'rake/clean'
|
10
|
-
require 'yard'
|
11
|
-
|
12
|
-
# Load the gemspec file for this project.
|
13
|
-
GEMSPEC = Dir['*.gemspec'].first
|
14
|
-
SPEC = eval(File.read(GEMSPEC), nil, GEMSPEC)
|
15
|
-
|
16
|
-
# A dynamically generated list of files that should match the manifest (the
|
17
|
-
# combined contents of SPEC.files and SPEC.test_files). The idea is for this
|
18
|
-
# list to contain all project files except for those that have been explicitly
|
19
|
-
# excluded. This list will be compared with the manifest from the SPEC in order
|
20
|
-
# to help catch the addition or removal of files to or from the project that
|
21
|
-
# have not been accounted for either by an exclusion here or an inclusion in the
|
22
|
-
# SPEC manifest.
|
23
|
-
#
|
24
|
-
# NOTE:
|
25
|
-
# It is critical that the manifest is *not* automatically generated via globbing
|
26
|
-
# and the like; otherwise, this will yield a simple comparison between
|
27
|
-
# redundantly generated lists of files that probably will not protect the
|
28
|
-
# project from the unintentional inclusion or exclusion of files in the
|
29
|
-
# distribution.
|
30
|
-
PKG_FILES = FileList.new(Dir.glob('**/*', File::FNM_DOTMATCH)) do |files|
|
31
|
-
# Exclude anything that doesn't exist as well as directories.
|
32
|
-
files.exclude {|file| ! File.exist?(file) || File.directory?(file)}
|
33
|
-
# Exclude Git administrative files.
|
34
|
-
files.exclude(%r{(^|[/\\])\.git(ignore|modules|keep)?([/\\]|$)})
|
35
|
-
# Exclude editor swap/temporary files.
|
36
|
-
files.exclude('**/.*.sw?')
|
37
|
-
# Exclude gemspec files.
|
38
|
-
files.exclude('*.gemspec')
|
39
|
-
# Exclude the README template file.
|
40
|
-
files.exclude('README.md.erb')
|
41
|
-
# Exclude resources for bundler.
|
42
|
-
files.exclude('Gemfile', 'Gemfile.lock')
|
43
|
-
files.exclude(%r{^.bundle([/\\]|$)})
|
44
|
-
files.exclude(%r{^vendor/bundle([/\\]|$)})
|
45
|
-
# Exclude generated content, except for the README file.
|
46
|
-
files.exclude(%r{^(pkg|doc|.yardoc)([/\\]|$)})
|
47
|
-
# Exclude examples.
|
48
|
-
files.exclude(%r{^examples([/\\]|$)})
|
49
|
-
# Exclude Rubinius compiled Ruby files.
|
50
|
-
files.exclude('**/*.rbc')
|
51
|
-
files.exclude('.rbx/**/*')
|
52
|
-
end
|
53
|
-
|
54
|
-
# Make sure that :clean and :clobber will not whack the repository files.
|
55
|
-
CLEAN.exclude('.git/**')
|
56
|
-
# Vim swap files are fair game for clean up.
|
57
|
-
CLEAN.include('**/.*.sw?')
|
58
|
-
|
59
|
-
# Returns the value of the VERSION environment variable as a Gem::Version object
|
60
|
-
# assuming it is set and a valid Gem version string. Otherwise, raises an
|
61
|
-
# exception.
|
62
|
-
def get_version_argument
|
63
|
-
version = ENV['VERSION']
|
64
|
-
if version.to_s.empty?
|
65
|
-
raise "No version specified: Add VERSION=X.Y.Z to the command line"
|
66
|
-
end
|
67
|
-
begin
|
68
|
-
Gem::Version.create(version.dup)
|
69
|
-
rescue ArgumentError
|
70
|
-
raise "Invalid version specified in `VERSION=#{version}'"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
# Performs an in place, per line edit of the file indicated by _path_ by calling
|
75
|
-
# the sub method on each line and passing _pattern_, _replacement_, and _b_ as
|
76
|
-
# arguments.
|
77
|
-
def file_sub(path, pattern, replacement = nil, &b)
|
78
|
-
tmp_path = "#{path}.tmp"
|
79
|
-
File.open(path) do |infile|
|
80
|
-
File.open(tmp_path, 'w') do |outfile|
|
81
|
-
infile.each do |line|
|
82
|
-
outfile.write(line.sub(pattern, replacement, &b))
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
File.rename(tmp_path, path)
|
87
|
-
end
|
88
|
-
|
89
|
-
# Updates the version string in the gemspec file to the string in _version_.
|
90
|
-
def set_version(version)
|
91
|
-
file_sub(GEMSPEC, /(\.version\s*=\s*).*/, "\\1'#{version}'")
|
92
|
-
end
|
93
|
-
|
94
|
-
# Returns a string that is line wrapped at word boundaries, where each line is
|
95
|
-
# no longer than _line_width_ characters.
|
96
|
-
#
|
97
|
-
# This is mostly lifted directly from ActionView::Helpers::TextHelper.
|
98
|
-
def word_wrap(text, line_width = 80)
|
99
|
-
text.split("\n").collect do |line|
|
100
|
-
line.length > line_width ?
|
101
|
-
line.gsub(/(.{1,#{line_width}})(\s+|$)/, "\\1\n").strip :
|
102
|
-
line
|
103
|
-
end * "\n"
|
104
|
-
end
|
105
|
-
|
106
|
-
desc 'Alias for build:gem'
|
107
|
-
task :build => 'build:gem'
|
108
|
-
|
109
|
-
# Build related tasks.
|
110
|
-
namespace :build do
|
111
|
-
# Ensure that the manifest is consulted when building the gem. Any
|
112
|
-
# generated/compiled files should be available at that time.
|
113
|
-
task :gem => :check_manifest
|
114
|
-
|
115
|
-
# Create the gem and package tasks.
|
116
|
-
Gem::PackageTask.new(SPEC).define
|
117
|
-
|
118
|
-
desc 'Verify the manifest'
|
119
|
-
task :check_manifest do
|
120
|
-
manifest_files = (SPEC.files + SPEC.test_files).sort.uniq
|
121
|
-
pkg_files = PKG_FILES.sort.uniq
|
122
|
-
if manifest_files != pkg_files then
|
123
|
-
common_files = manifest_files & pkg_files
|
124
|
-
manifest_files -= common_files
|
125
|
-
pkg_files -= common_files
|
126
|
-
message = ["The manifest does not match the automatic file list."]
|
127
|
-
unless manifest_files.empty? then
|
128
|
-
message << " Extraneous files:\n " + manifest_files.join("\n ")
|
129
|
-
end
|
130
|
-
unless pkg_files.empty?
|
131
|
-
message << " Missing files:\n " + pkg_files.join("\n ")
|
132
|
-
end
|
133
|
-
raise message.join("\n")
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
# Creates the README.md file from a template, the license files, and the
|
138
|
-
# gemspec contents.
|
139
|
-
file 'README.md' => ['README.md.erb', 'LICENSE', 'LICENSE-rubyspec', GEMSPEC] do
|
140
|
-
spec = SPEC
|
141
|
-
File.open('README.md', 'w') do |readme|
|
142
|
-
readme.write(
|
143
|
-
ERB.new(File.read('README.md.erb'), nil, '-').result(binding)
|
144
|
-
)
|
145
|
-
end
|
146
|
-
end
|
147
|
-
end
|
148
|
-
|
149
|
-
# Ensure that the clobber task also clobbers package files.
|
150
|
-
task :clobber => 'build:clobber_package'
|
151
|
-
|
152
|
-
# Ensure that the README file is (re)generated before generating documentation.
|
153
|
-
task :yard => 'README.md'
|
154
|
-
# Create the documentation task.
|
155
|
-
YARD::Rake::YardocTask.new
|
156
|
-
|
157
|
-
# Gem related tasks.
|
158
|
-
namespace :gem do
|
159
|
-
desc 'Alias for build:gem'
|
160
|
-
task :build => 'build:gem'
|
161
|
-
|
162
|
-
desc 'Publish the gemfile'
|
163
|
-
task :publish => ['version:check', :test, 'repo:tag', :build] do
|
164
|
-
sh "gem push pkg/#{SPEC.name}-#{SPEC.version}*.gem"
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
# Create the test task.
|
169
|
-
desc 'Run tests'
|
170
|
-
task :test do
|
171
|
-
sh "mspec"
|
172
|
-
end
|
173
|
-
|
174
|
-
# Version string management tasks.
|
175
|
-
namespace :version do
|
176
|
-
desc 'Set the version for the project to a specified version'
|
177
|
-
task :set do
|
178
|
-
set_version(get_version_argument)
|
179
|
-
end
|
180
|
-
|
181
|
-
desc 'Set the version for the project back to 0.0.0'
|
182
|
-
task :reset do
|
183
|
-
set_version('0.0.0')
|
184
|
-
end
|
185
|
-
|
186
|
-
desc 'Check that all version strings are correctly set'
|
187
|
-
task :check => ['version:check:spec', 'version:check:news']
|
188
|
-
|
189
|
-
namespace :check do
|
190
|
-
desc 'Check that the version in the gemspec is correctly set'
|
191
|
-
task :spec do
|
192
|
-
version = get_version_argument
|
193
|
-
if version != SPEC.version
|
194
|
-
raise "The given version `#{version}' does not match the gemspec version `#{SPEC.version}'"
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
|
-
desc 'Check that the NEWS.md file mentions the version'
|
199
|
-
task :news do
|
200
|
-
version = get_version_argument
|
201
|
-
begin
|
202
|
-
File.open('NEWS.md') do |news|
|
203
|
-
unless news.each_line.any? {|l| l =~ /^## v#{Regexp.escape(version.to_s)} /}
|
204
|
-
raise "The NEWS.md file does not mention version `#{version}'"
|
205
|
-
end
|
206
|
-
end
|
207
|
-
rescue Errno::ENOENT
|
208
|
-
raise 'No NEWS.md file found'
|
209
|
-
end
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
# Repository and workspace management tasks.
|
215
|
-
namespace :repo do
|
216
|
-
desc 'Tag the current HEAD with the version string'
|
217
|
-
task :tag => :check_workspace do
|
218
|
-
version = get_version_argument
|
219
|
-
sh "git tag -s -m 'Release v#{version}' v#{version}"
|
220
|
-
end
|
221
|
-
|
222
|
-
desc 'Ensure the workspace is fully committed and clean'
|
223
|
-
task :check_workspace => ['README.md'] do
|
224
|
-
unless `git status --untracked-files=all --porcelain`.empty?
|
225
|
-
raise 'Workspace has been modified. Commit pending changes and try again.'
|
226
|
-
end
|
227
|
-
end
|
228
|
-
end
|
data/ruby.1.8.mspec
DELETED
data/spec/binmode_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
-
require File.dirname(__FILE__) + '/fixtures/classes'
|
3
|
-
|
4
|
-
describe "IO::Like#binmode" do
|
5
|
-
before :each do
|
6
|
-
@filename = tmp("IO_binmode_file")
|
7
|
-
@file = File.open(@filename, "w")
|
8
|
-
@iowrapper = WritableIOWrapper.open(@file)
|
9
|
-
end
|
10
|
-
|
11
|
-
after :each do
|
12
|
-
@iowrapper.close unless @iowrapper.closed?
|
13
|
-
@file.close unless @file.closed?
|
14
|
-
File.delete(@filename) if File.exist?(@filename)
|
15
|
-
end
|
16
|
-
|
17
|
-
it "returns a reference to the stream" do
|
18
|
-
@iowrapper.binmode.should == @iowrapper
|
19
|
-
end
|
20
|
-
|
21
|
-
it "does not raise any errors on closed stream" do
|
22
|
-
lambda { IOSpecs.closed_file.binmode }.should_not raise_error()
|
23
|
-
end
|
24
|
-
|
25
|
-
# Even if it does nothing in Unix it should not raise any errors.
|
26
|
-
it "puts a stream in binary mode" do
|
27
|
-
lambda { @iowrapper.binmode }.should_not raise_error
|
28
|
-
end
|
29
|
-
end
|