monkey-lib 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,27 @@
1
+ copyright (c) 2009 Konstantin Haase. All rights reserved.
2
+
3
+ Developed by: Konstantin Haase
4
+ http://github.com/rkh/monkey-lib
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to
8
+ deal with the Software without restriction, including without limitation the
9
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
+ sell copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+ 1. Redistributions of source code must retain the above copyright notice,
13
+ this list of conditions and the following disclaimers.
14
+ 2. Redistributions in binary form must reproduce the above copyright
15
+ notice, this list of conditions and the following disclaimers in the
16
+ documentation and/or other materials provided with the distribution.
17
+ 3. Neither the name of Konstantin Haase, nor the names of other contributors
18
+ may be used to endorse or promote products derived from this Software without
19
+ specific prior written permission.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
27
+ WITH THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,51 @@
1
+ Sort of my own ruby extlib. There is a spec for everything and it is very clean.
2
+ It does avoid monkey patching and relies on modules.
3
+
4
+ = Template for extentiones
5
+
6
+ Say we want to extend Object by adding some methods dealing with magic.
7
+ This would go to the file lib/monkey/object/magic_stuff.rb:
8
+
9
+ module Monkey
10
+ module Object
11
+
12
+ # It's magic!
13
+ module MagicStuff
14
+
15
+ ::Object.send :include, self
16
+
17
+ def hokus_pokus
18
+ Spell.perform(self)
19
+ end
20
+
21
+ def vanish_in_thin_air
22
+ class << self
23
+ instance_methods.each { |m| undef_method(m) }
24
+ end
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+ end
31
+
32
+ Add to lib/monkey/object.rb:
33
+
34
+ require "monkey/object/magic_stuff"
35
+
36
+ If that file didn't exist before, add to lib/monkey.rb:
37
+
38
+ require "monkey/object"
39
+
40
+ Write a spec in spec/monkey/object/magic_stuff_spec.rb:
41
+
42
+ require __FILE__.sub("monkey/object/magic_stuff_spec.rb", "spec_helper")
43
+ require "monkey/object/magic_stuff"
44
+
45
+ describe Monkey::Object::MagicStuff do
46
+
47
+ it "performs magic" do
48
+ # ...
49
+ end
50
+
51
+ end
data/Rakefile ADDED
@@ -0,0 +1,49 @@
1
+ require "spec/rake/spectask"
2
+ require "rake/clean"
3
+ require "rake/rdoctask"
4
+ require "rake/gempackagetask"
5
+ require "rubygems/specification"
6
+
7
+ MONKEY_VERSION = "0.1.6"
8
+
9
+ spec = Gem::Specification.new do |s|
10
+ s.name = "monkey-lib"
11
+ s.version = MONKEY_VERSION
12
+ s.authors = ["Konstantin Haase"]
13
+ s.description = "collection of sane ruby extensions"
14
+ s.email = "konstantin.mailinglists@googlemail.com"
15
+ s.extra_rdoc_files = Dir["*.rdoc", "LICENSE", "lib/**/*.rb"]
16
+ s.files = Dir["LICENSE", "Rakefile", "README.rdoc", "lib/**/*.rb", "spec/**/*.rb"]
17
+ s.has_rdoc = true
18
+ s.homepage = "http://github.com/rkh/monkey-lib"
19
+ s.require_paths = ["lib"]
20
+ s.summary = s.description
21
+ s.add_dependency "extlib"
22
+ end
23
+
24
+ Rake::GemPackageTask.new(spec) do |pkg|
25
+ pkg.gem_spec = spec
26
+ end
27
+
28
+ desc "install the gem locally"
29
+ task :install => [:package] do
30
+ sh %{gem install pkg/monkey-lib-#{MONKEY_VERSION}.gem}
31
+ end
32
+
33
+ desc "create a gemspec file"
34
+ task :make_spec do
35
+ File.open("monkey-lib.gemspec", "w") do |file|
36
+ file.puts spec.to_ruby
37
+ end
38
+ end
39
+
40
+ Rake::RDocTask.new("doc") do |rdoc|
41
+ rdoc.rdoc_dir = 'doc'
42
+ rdoc.options += %w[--all --inline-source --line-numbers --main README.rdoc --quiet
43
+ --tab-width 2 --title monkey-lib]
44
+ rdoc.rdoc_files.add ['*.rdoc', 'lib/**/*.rb']
45
+ end
46
+
47
+ Spec::Rake::SpecTask.new('spec') do |t|
48
+ t.spec_files = Dir.glob 'spec/**/*_spec.rb'
49
+ end
data/lib/monkey-lib.rb ADDED
@@ -0,0 +1 @@
1
+ require "monkey"
data/lib/monkey.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "monkey/object"
2
+ require "monkey/hash"
3
+ require "monkey/string"
4
+ require "monkey/engine"
@@ -0,0 +1,89 @@
1
+ module Monkey
2
+
3
+ # Makes sure we always have RUBY_ENGINE, RUBY_ENGINE_VERSION and RUBY_DESCRIPTION
4
+ module Engine
5
+
6
+ include Rubinius if defined? Rubinius
7
+
8
+ unless defined? RUBY_ENGINE
9
+ if defined? JRUBY_VERSION
10
+ ::RUBY_ENGINE = "jruby"
11
+ elsif defined? Rubinius
12
+ ::RUBY_ENGINE = "rbx"
13
+ else
14
+ ::RUBY_ENGINE = "ruby"
15
+ end
16
+ end
17
+
18
+ unless RUBY_ENGINE.frozen?
19
+ RUBY_ENGINE.replace "rbx" if RUBY_ENGINE == "rubinius"
20
+ RUBY_ENGINE.downcase!
21
+ RUBY_ENGINE.freeze
22
+ end
23
+
24
+ ::RUBY_ENGINE_VERSION = const_get("#{RUBY_ENGINE.upcase}_VERSION")
25
+
26
+ unless defined? RUBY_DESCRIPTION
27
+ ::RUBY_DESCRIPTION = "#{RUBY_ENGINE} #{RUBY_ENGINE_VERSION} "
28
+ unless RUBY_ENGINE == "ruby"
29
+ ::RUBY_DESCRIPTION << "(ruby #{RUBY_VERSION}"
30
+ ::RUBY_DESCRIPTION << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
31
+ ::RUBY_DESCRIPTION << ") "
32
+ end
33
+ if defined? RUBY_RELEASE_DATE
34
+ ::RUBY_DESCRIPTION << "("
35
+ ::RUBY_DESCRIPTION << BUILDREV[0..8] << " " if defined? BUILDREV
36
+ ::RUBY_DESCRIPTION << RUBY_RELEASE_DATE << ") "
37
+ end
38
+ ::RUBY_DESCRIPTION << "[#{RUBY_PLATFORM}]"
39
+ end
40
+
41
+ def jruby?
42
+ RUBY_ENGINE == "jruby"
43
+ end
44
+
45
+ module_function :jruby?
46
+
47
+ def mri?
48
+ RUBY_ENGINE == "ruby"
49
+ end
50
+
51
+ module_function :mri?
52
+
53
+ def rbx?
54
+ RUBY_ENGINE == "rbx"
55
+ end
56
+
57
+ alias rubinius? rbx?
58
+ module_function :rbx?
59
+ module_function :rubinius?
60
+
61
+ def ironruby?
62
+ RUBY_ENGINE == "ironruby"
63
+ end
64
+
65
+ module_function :ironruby?
66
+
67
+ def macruby?
68
+ RUBY_ENGINE == "macruby"
69
+ end
70
+
71
+ module_function :macruby?
72
+
73
+ def ruby_engine(pretty = true)
74
+ return RUBY_ENGINE unless pretty
75
+ case RUBY_ENGINE
76
+ when "ruby" then "CRuby"
77
+ when "rbx" then "Rubinius"
78
+ when /ruby$/ then RUBY_ENGINE.capitalize.gsub("ruby", "Ruby")
79
+ end
80
+ end
81
+
82
+ module_function :ruby_engine
83
+
84
+ end
85
+
86
+ extend Engine
87
+ include Engine
88
+
89
+ end
@@ -0,0 +1,4 @@
1
+ require "extlib/class"
2
+ require "extlib/hash"
3
+ require "extlib/mash"
4
+ require "monkey/hash/sub_hash"
@@ -0,0 +1,23 @@
1
+ module Monkey
2
+ module Hash
3
+
4
+ # Adds sub hash ablilty (like Hash#[], but returning a hash rather than an array).
5
+ module SubHash
6
+
7
+ ::Hash.send :include, self
8
+
9
+ # Example:
10
+ # {:a => 42, :b => 23, :c => 1337}.sub_hash :a, :b, :d
11
+ # # => {:a => 42, :b => 23}
12
+ def sub_hash(*keys)
13
+ keys.inject({}) do |hash, key|
14
+ hash.merge! key => self[key] if include? key
15
+ hash
16
+ end
17
+ end
18
+
19
+ alias subhash sub_hash
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,2 @@
1
+ require "monkey/object/backports"
2
+ require "monkey/object/instance_yield"
@@ -0,0 +1,24 @@
1
+ module Monkey
2
+ module Object
3
+
4
+ # Backports from newer / alternate ruby implementations.
5
+ module Backports
6
+
7
+ ::Object.send :include, self
8
+
9
+ # From Ruby >= 1.8.7
10
+ def tap
11
+ yield self
12
+ self
13
+ end
14
+
15
+ # From Rubinius
16
+ def metaclass
17
+ class << self
18
+ self
19
+ end
20
+ end
21
+
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,38 @@
1
+ module Monkey
2
+ module Object
3
+
4
+ # Adds the private method instance_eval which is like instance_eval
5
+ # and yield depending on whether a block takes an argument or not.
6
+ #
7
+ # class Foo
8
+ #
9
+ # def foo
10
+ # 42
11
+ # end
12
+ #
13
+ # def bar(&block)
14
+ # instance_yield block
15
+ # end
16
+ #
17
+ # end
18
+ #
19
+ # conf = Foo.new
20
+ # conf.bar { foo }
21
+ # conf.bar { |c| c.foo }
22
+ module InstanceYield
23
+
24
+ ::Object.send :include, self
25
+
26
+ private
27
+
28
+ # See InstanceYield description.
29
+ def instance_yield(block = nil, &alternate_block)
30
+ raise ArgumentError, "too many blocks given" if block && alternate_block
31
+ block ||= alternate_block
32
+ raise LocalJumpError, "no block given (yield)" unless block
33
+ block.arity > 0 ? yield(self) : instance_eval(&block)
34
+ end
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,2 @@
1
+ require "extlib/string"
2
+ require "monkey/string/like_pathname"
@@ -0,0 +1,38 @@
1
+ require "pathname"
2
+ require "extlib/pathname"
3
+
4
+ module Monkey
5
+ module String
6
+
7
+ # Adds Pathname behaviour to String.
8
+ module LikePathname
9
+
10
+ ::String.send :include, self
11
+
12
+ Pathname.instance_methods(false).each do |m|
13
+ # Syntax error in Ruby < 1.9:
14
+ # define_method(m) { |*a, &b| ... }
15
+ next if "".respond_to? m or m.to_s == "to_path"
16
+ class_eval <<-EOS
17
+ def #{m}(*a, &b)
18
+ result = Pathname(self).#{m}(*a, &b)
19
+ return result unless result.is_a? Pathname
20
+ result.to_s
21
+ end
22
+ EOS
23
+ end
24
+
25
+ #def method_missing(meth, *args, &block)
26
+ # pathname = Pathname self
27
+ # return super unless pathname.respond_to? meth
28
+ # result = pathname.send(meth, *args, &block)
29
+ # return result.to_s if result.is_a? Pathname
30
+ # result
31
+ #end
32
+
33
+ alias exists? exist?
34
+
35
+ end
36
+
37
+ end
38
+ end
@@ -0,0 +1,18 @@
1
+ require __FILE__.sub("monkey/engine_spec.rb", "spec_helper")
2
+ require "monkey/engine"
3
+
4
+ describe Monkey::Engine do
5
+
6
+ it "defines RUBY_VERSION" do
7
+ defined?(RUBY_VERSION).should == "constant"
8
+ end
9
+
10
+ it "defines RUBY_ENGINE_VERSION" do
11
+ defined?(RUBY_ENGINE_VERSION).should == "constant"
12
+ end
13
+
14
+ it "defines RUBY_DESCRIPTION" do
15
+ defined?(RUBY_DESCRIPTION).should == "constant"
16
+ end
17
+
18
+ end
@@ -0,0 +1,15 @@
1
+ require __FILE__.sub("monkey/hash/sub_hash_spec.rb", "spec_helper")
2
+ require "monkey/hash/sub_hash"
3
+
4
+ describe Monkey::Hash::SubHash do
5
+
6
+ it "returns a hash with only the key-value-pairs requested for sub_hash" do
7
+ {:a => 10, :b => 20}.sub_hash(:a).should == {:a => 10}
8
+ {:a => 10, :b => 20}.sub_hash(:a, :b).should == {:a => 10, :b => 20}
9
+ end
10
+
11
+ it "should ignore keys passed to sub_hash, but not present" do
12
+ {:a => 10, :b => 20}.sub_hash(:a, :c).should == {:a => 10}
13
+ end
14
+
15
+ end
@@ -0,0 +1,24 @@
1
+ require __FILE__.sub("monkey/object/backports_spec.rb", "spec_helper")
2
+ require "monkey/object/backports"
3
+
4
+ describe Monkey::Object::Backports do
5
+
6
+ it "returns returns the reciever of #tap" do
7
+ obj = Object.new
8
+ obj.tap {}.should == obj
9
+ "example".tap {}.should == "example"
10
+ end
11
+
12
+ it "passes the reciever of #tap to the given block" do
13
+ "foo".tap { |s| s.replace "bar" }.should == "bar"
14
+ end
15
+
16
+ it "returns eigenclass for #metaclass" do
17
+ obj = Object.new
18
+ eigenclass = class << obj
19
+ self
20
+ end
21
+ obj.metaclass.should == eigenclass
22
+ end
23
+
24
+ end
@@ -0,0 +1,32 @@
1
+ require __FILE__.sub("monkey/object/instance_yield_spec.rb", "spec_helper")
2
+ require "monkey/object/instance_yield"
3
+
4
+ describe Monkey::Object::InstanceYield do
5
+
6
+ before do
7
+ @obj = Object.new
8
+ @obj.stub! :foo
9
+ end
10
+
11
+ it "calls a block if block takes at least one argument" do
12
+ foo = nil
13
+ @obj.should_not_receive :foo
14
+ @obj.send :instance_yield do |x|
15
+ foo
16
+ end
17
+ end
18
+
19
+ it "passes object as first argument to blog" do
20
+ @obj.send :instance_yield do |x|
21
+ x.should == @obj
22
+ end
23
+ end
24
+
25
+ it "passes the block to instance_eval if block doesn't take arguments" do
26
+ @obj.should_receive :foo
27
+ @obj.send :instance_yield do
28
+ foo
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,272 @@
1
+ require __FILE__.sub("monkey/string/like_pathname_spec.rb", "spec_helper")
2
+ require "monkey/string/like_pathname"
3
+
4
+ describe Monkey::String::LikePathname do
5
+
6
+ before do
7
+ @strings = ["/usr/bin/ruby", ".", "..", ENV["HOME"]]
8
+ @methods = Pathname.instance_methods(false).reject do |m|
9
+ String.methods.include? m or m.to_s == "to_path"
10
+ end
11
+ end
12
+
13
+ it "exposes sub_ext to String if in ruby 1.9" do
14
+ @strings.each do |s|
15
+ s.sub_ext(".png").should == Pathname(s).sub_ext(".png").to_s
16
+ end if RUBY_VERSION >= "1.9"
17
+ end
18
+
19
+ it "exposes cleanpath to String" do
20
+ @strings.each do |s|
21
+ s.cleanpath.should == Pathname(s).cleanpath.to_s
22
+ end
23
+ end
24
+
25
+ it "exposes realpath to String" do
26
+ @strings.each do |s|
27
+ s.realpath.should == Pathname(s).realpath.to_s
28
+ end
29
+ end
30
+
31
+ it "exposes parent to String" do
32
+ @strings.each do |s|
33
+ s.parent.should == Pathname(s).parent.to_s
34
+ end
35
+ end
36
+
37
+ it "exposes mountpoint? to String" do
38
+ @strings.each do |s|
39
+ s.mountpoint?.should == Pathname(s).mountpoint?
40
+ end
41
+ end
42
+
43
+ it "exposes root? to String" do
44
+ @strings.each do |s|
45
+ s.root?.should == Pathname(s).root?
46
+ end
47
+ end
48
+
49
+ it "exposes absolute? to String" do
50
+ @strings.each do |s|
51
+ s.absolute?.should == Pathname(s).absolute?
52
+ end
53
+ end
54
+
55
+ it "exposes relative? to String" do
56
+ @strings.each do |s|
57
+ s.relative?.should == Pathname(s).relative?
58
+ end
59
+ end
60
+
61
+ it "exposes each_filename to String if in ruby 1.9" do
62
+ @strings.each do |s|
63
+ s.each_filename.to_a.should == Pathname(s).each_filename.to_a
64
+ end if RUBY_VERSION >= "1.9"
65
+ end
66
+
67
+ it "exposes join to String" do
68
+ @strings.each do |s|
69
+ s.join.should == Pathname(s).join.to_s
70
+ end
71
+ end
72
+
73
+ it "exposes children to String" do
74
+ @strings.each do |s|
75
+ s.children.should == Pathname(s).children if s.directory?
76
+ end
77
+ end
78
+
79
+ it "exposes atime to String" do
80
+ @strings.each do |s|
81
+ s.atime.should == Pathname(s).atime
82
+ end
83
+ end
84
+
85
+ it "exposes ctime to String" do
86
+ @strings.each do |s|
87
+ s.ctime.should == Pathname(s).ctime
88
+ end
89
+ end
90
+
91
+ it "exposes mtime to String" do
92
+ @strings.each do |s|
93
+ s.mtime.should == Pathname(s).mtime
94
+ end
95
+ end
96
+
97
+ it "exposes ftype to String" do
98
+ @strings.each do |s|
99
+ s.ftype.should == Pathname(s).ftype.to_s
100
+ end
101
+ end
102
+
103
+ it "exposes basename to String" do
104
+ @strings.each do |s|
105
+ s.basename.should == Pathname(s).basename.to_s
106
+ end
107
+ end
108
+
109
+ it "exposes dirname to String" do
110
+ @strings.each do |s|
111
+ s.dirname.should == Pathname(s).dirname.to_s
112
+ end
113
+ end
114
+
115
+ it "exposes extname to String" do
116
+ @strings.each do |s|
117
+ s.extname.should == Pathname(s).extname.to_s
118
+ end
119
+ end
120
+
121
+ it "exposes expand_path to String" do
122
+ @strings.each do |s|
123
+ s.expand_path.should == Pathname(s).expand_path.to_s
124
+ end
125
+ end
126
+
127
+ it "exposes blockdev? to String" do
128
+ @strings.each do |s|
129
+ s.blockdev?.should == Pathname(s).blockdev?
130
+ end
131
+ end
132
+
133
+ it "exposes chardev? to String" do
134
+ @strings.each do |s|
135
+ s.chardev?.should == Pathname(s).chardev?
136
+ end
137
+ end
138
+
139
+ it "exposes executable? to String" do
140
+ @strings.each do |s|
141
+ s.executable?.should == Pathname(s).executable?
142
+ end
143
+ end
144
+
145
+ it "exposes executable_real? to String" do
146
+ @strings.each do |s|
147
+ s.executable_real?.should == Pathname(s).executable_real?
148
+ end
149
+ end
150
+
151
+ it "exposes exist? to String" do
152
+ @strings.each do |s|
153
+ s.exist?.should == Pathname(s).exist?
154
+ s.exists?.should == Pathname(s).exist?
155
+ end
156
+ end
157
+
158
+ it "exposes grpowned? to String" do
159
+ @strings.each do |s|
160
+ s.grpowned?.should == Pathname(s).grpowned?
161
+ end
162
+ end
163
+
164
+ it "exposes directory? to String" do
165
+ @strings.each do |s|
166
+ s.directory?.should == Pathname(s).directory?
167
+ end
168
+ end
169
+
170
+ it "exposes file? to String" do
171
+ @strings.each do |s|
172
+ s.file?.should == Pathname(s).file?
173
+ end
174
+ end
175
+
176
+ it "exposes pipe? to String" do
177
+ @strings.each do |s|
178
+ s.pipe?.should == Pathname(s).pipe?
179
+ end
180
+ end
181
+
182
+ it "exposes socket? to String" do
183
+ @strings.each do |s|
184
+ s.socket?.should == Pathname(s).socket?
185
+ end
186
+ end
187
+
188
+ it "exposes owned? to String" do
189
+ @strings.each do |s|
190
+ s.owned?.should == Pathname(s).owned?
191
+ end
192
+ end
193
+
194
+ it "exposes readable? to String" do
195
+ @strings.each do |s|
196
+ s.readable?.should == Pathname(s).readable?
197
+ end
198
+ end
199
+
200
+ it "exposes world_readable? to String in ruby 1.9" do
201
+ @strings.each do |s|
202
+ s.world_readable?.should == Pathname(s).world_readable?
203
+ end if RUBY_VERSION >= "1.9"
204
+ end
205
+
206
+ it "exposes readable_real? to String" do
207
+ @strings.each do |s|
208
+ s.readable_real?.should == Pathname(s).readable_real?
209
+ end
210
+ end
211
+
212
+ it "exposes setuid? to String" do
213
+ @strings.each do |s|
214
+ s.setuid?.should == Pathname(s).setuid?
215
+ end
216
+ end
217
+
218
+ it "exposes setgid? to String" do
219
+ @strings.each do |s|
220
+ s.setgid?.should == Pathname(s).setgid?
221
+ end
222
+ end
223
+
224
+ it "exposes size? to String" do
225
+ @strings.each do |s|
226
+ s.size?.should == Pathname(s).size?
227
+ end
228
+ end
229
+
230
+ it "exposes sticky? to String" do
231
+ @strings.each do |s|
232
+ s.sticky?.should == Pathname(s).sticky?
233
+ end
234
+ end
235
+
236
+ it "exposes symlink? to String" do
237
+ @strings.each do |s|
238
+ s.symlink?.should == Pathname(s).symlink?
239
+ end
240
+ end
241
+
242
+ it "exposes writable? to String" do
243
+ @strings.each do |s|
244
+ s.writable?.should == Pathname(s).writable?
245
+ end
246
+ end
247
+
248
+ it "exposes world_writable? to String in ruby 1.9" do
249
+ @strings.each do |s|
250
+ s.world_writable?.should == Pathname(s).world_writable?
251
+ end if RUBY_VERSION >= "1.9"
252
+ end
253
+
254
+ it "exposes writable_real? to String" do
255
+ @strings.each do |s|
256
+ s.writable_real?.should == Pathname(s).writable_real?
257
+ end
258
+ end
259
+
260
+ it "exposes zero? to String" do
261
+ @strings.each do |s|
262
+ s.zero?.should == Pathname(s).zero?
263
+ end
264
+ end
265
+
266
+ it "exposes entries to String in ruby 1.9" do
267
+ @strings.each do |s|
268
+ s.entries.should == Pathname(s).entries if s.directory?
269
+ end if RUBY_VERSION >= "1.9"
270
+ end
271
+
272
+ end
@@ -0,0 +1 @@
1
+ $LOAD_PATH.unshift File.expand_path(__FILE__.sub("spec/spec_helper.rb", "lib"))
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: monkey-lib
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
5
+ platform: ruby
6
+ authors:
7
+ - Konstantin Haase
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-07-22 00:00:00 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: extlib
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ description: collection of sane ruby extensions
26
+ email: konstantin.mailinglists@googlemail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - README.rdoc
33
+ - LICENSE
34
+ - lib/monkey/engine.rb
35
+ - lib/monkey/hash/sub_hash.rb
36
+ - lib/monkey/hash.rb
37
+ - lib/monkey/object/backports.rb
38
+ - lib/monkey/object/instance_yield.rb
39
+ - lib/monkey/object.rb
40
+ - lib/monkey/string/like_pathname.rb
41
+ - lib/monkey/string.rb
42
+ - lib/monkey-lib.rb
43
+ - lib/monkey.rb
44
+ files:
45
+ - LICENSE
46
+ - Rakefile
47
+ - README.rdoc
48
+ - lib/monkey/engine.rb
49
+ - lib/monkey/hash/sub_hash.rb
50
+ - lib/monkey/hash.rb
51
+ - lib/monkey/object/backports.rb
52
+ - lib/monkey/object/instance_yield.rb
53
+ - lib/monkey/object.rb
54
+ - lib/monkey/string/like_pathname.rb
55
+ - lib/monkey/string.rb
56
+ - lib/monkey-lib.rb
57
+ - lib/monkey.rb
58
+ - spec/monkey/engine_spec.rb
59
+ - spec/monkey/hash/sub_hash_spec.rb
60
+ - spec/monkey/object/backports_spec.rb
61
+ - spec/monkey/object/instance_yield_spec.rb
62
+ - spec/monkey/string/like_pathname_spec.rb
63
+ - spec/spec_helper.rb
64
+ has_rdoc: true
65
+ homepage: http://github.com/rkh/monkey-lib
66
+ licenses: []
67
+
68
+ post_install_message:
69
+ rdoc_options: []
70
+
71
+ require_paths:
72
+ - lib
73
+ required_ruby_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: "0"
78
+ version:
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
85
+ requirements: []
86
+
87
+ rubyforge_project:
88
+ rubygems_version: 1.3.5
89
+ signing_key:
90
+ specification_version: 3
91
+ summary: collection of sane ruby extensions
92
+ test_files: []
93
+