extlib 0.9.2 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of extlib might be problematic. Click here for more details.

@@ -219,6 +219,24 @@ describe LazyArray do
219
219
  end
220
220
  end
221
221
 
222
+ it 'should provide #freeze' do
223
+ @lazy_array.should respond_to(:freeze)
224
+ end
225
+
226
+ describe '#freeze' do
227
+ it_should_return_self(:freeze)
228
+
229
+ it 'should freeze the underlying array' do
230
+ @lazy_array.should_not be_frozen
231
+ @lazy_array.instance_variable_get('@array').should_not be_frozen
232
+
233
+ @lazy_array.freeze
234
+
235
+ @lazy_array.should be_frozen
236
+ @lazy_array.instance_variable_get('@array').should be_frozen
237
+ end
238
+ end
239
+
222
240
  it 'should provide #eql?' do
223
241
  @lazy_array.should respond_to(:eql?)
224
242
  end
@@ -853,16 +871,12 @@ describe LazyArray do
853
871
 
854
872
  describe 'a method mixed into Array' do
855
873
  before :all do
856
- class Array
874
+ module Enumerable
857
875
  def group_by(&block)
858
- groups = []
876
+ groups = {}
859
877
  each do |entry|
860
878
  value = yield(entry)
861
- if(last_group = groups.last) && last_group.first == value
862
- last_group.last << entry
863
- else
864
- groups << [ value, [ entry ] ]
865
- end
879
+ (groups[value] ||= []).push(entry)
866
880
  end
867
881
  groups
868
882
  end
@@ -870,7 +884,7 @@ describe LazyArray do
870
884
  end
871
885
 
872
886
  it 'should delegate to the Array' do
873
- @lazy_array.group_by { |e| e.length }.should == [ [ 5, %w[ nancy ] ], [ 6, %w[ bessie ] ] ]
887
+ @lazy_array.group_by { |e| e.length }.should == { 5 => %w[ nancy ], 6 => %w[ bessie ] }
874
888
  end
875
889
  end
876
890
 
data/spec/module_spec.rb CHANGED
@@ -4,33 +4,55 @@ describe Module do
4
4
 
5
5
  before(:all) do
6
6
  module Foo
7
- class Bar
7
+ module Bar
8
+ module Noo
9
+ module Too
10
+ end
11
+ end
12
+ end
13
+
14
+ class Zed
8
15
  end
9
16
  end
10
-
17
+
11
18
  class Baz
12
19
  end
13
-
20
+
14
21
  class Bar
15
22
  end
16
23
  end
17
24
 
25
+ it "should raise NameError for a missing constant" do
26
+ lambda { Foo.find_const('Moo') }.should raise_error(NameError)
27
+ lambda { Object.find_const('MissingConstant') }.should raise_error(NameError)
28
+ end
29
+
18
30
  it "should be able to get a recursive constant" do
19
- Object::find_const('Foo::Bar').should == Foo::Bar
31
+ Object.find_const('Foo::Bar').should == Foo::Bar
20
32
  end
21
33
 
22
34
  it "should ignore get Constants from the Kernel namespace correctly" do
23
- Object::find_const('::Foo::Bar').should == ::Foo::Bar
35
+ Object.find_const('::Foo::Bar').should == ::Foo::Bar
24
36
  end
25
37
 
26
- it "should not cache unresolvable class string" do
27
- lambda { find_const('Foo::Bar::Baz') }.should raise_error(NameError)
28
- Object::send(:__nested_constants__).has_key?('Foo::Bar::Baz').should == false
29
- end
30
-
31
38
  it "should find relative constants" do
32
39
  Foo.find_const('Bar').should == Foo::Bar
33
40
  Foo.find_const('Baz').should == Baz
34
41
  end
35
42
 
36
- end
43
+ it "should find sibling constants" do
44
+ Foo::Bar.find_const("Zed").should == Foo::Zed
45
+ end
46
+
47
+ it "should find nested constants on nested constants" do
48
+ Foo::Bar.find_const('Noo::Too')
49
+ end
50
+
51
+ it "should be able to deal with constants being added and removed" do
52
+ Object.find_const('Bar') # First we load Bar with find_const
53
+ Object.module_eval { remove_const('Bar') } # Now we delete it
54
+ module Bar; end; # Now we redefine it
55
+ Object.find_const('Bar').should == Bar
56
+ end
57
+
58
+ end
data/spec/object_spec.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), 'spec_helper'))
2
2
 
3
3
  describe Object do
4
- end
4
+ end
data/spec/pooling_spec.rb CHANGED
@@ -6,7 +6,7 @@ describe "Extlib::Pooling" do
6
6
 
7
7
  module Extlib::Pooling
8
8
  def self.scavenger_interval
9
- 0.1
9
+ 1
10
10
  end
11
11
  end
12
12
 
@@ -22,10 +22,6 @@ describe "Extlib::Pooling" do
22
22
  def dispose
23
23
  @name = nil
24
24
  end
25
-
26
- def self.scavenge_interval
27
- 0.2
28
- end
29
25
  end
30
26
 
31
27
  class Overwriter
@@ -78,7 +74,7 @@ describe "Extlib::Pooling" do
78
74
  Person.__pools.size.should == 1
79
75
 
80
76
  Extlib::Pooling::pools.should_not be_empty
81
- sleep(1)
77
+ sleep(1.2)
82
78
  Extlib::Pooling::pools.should be_empty
83
79
  bob.name.should be_nil
84
80
  end
@@ -111,7 +107,7 @@ describe "Extlib::Pooling" do
111
107
  lambda do
112
108
  begin
113
109
  bob = Person.new('Bob')
114
- Person.new('Bob')
110
+ 9.times { Person.new('Bob') }
115
111
  ensure
116
112
  bob.release
117
113
  end
data/tasks/hoe.rb ADDED
@@ -0,0 +1,39 @@
1
+ require 'hoe'
2
+
3
+ @config_file = "~/.rubyforge/user-config.yml"
4
+ @config = nil
5
+ RUBYFORGE_USERNAME = "unknown"
6
+ def rubyforge_username
7
+ unless @config
8
+ begin
9
+ @config = YAML.load(File.read(File.expand_path(@config_file)))
10
+ rescue
11
+ puts <<-EOS
12
+ ERROR: No rubyforge config file found: #{@config_file}
13
+ Run 'rubyforge setup' to prepare your env for access to Rubyforge
14
+ - See http://newgem.rubyforge.org/rubyforge.html for more details
15
+ EOS
16
+ exit
17
+ end
18
+ end
19
+ RUBYFORGE_USERNAME.replace @config["username"]
20
+ end
21
+
22
+ hoe = Hoe.new(GEM_NAME, GEM_VERSION) do |p|
23
+
24
+ p.developer(AUTHOR, EMAIL)
25
+
26
+ p.description = PROJECT_DESCRIPTION
27
+ p.summary = PROJECT_SUMMARY
28
+ p.url = PROJECT_URL
29
+
30
+ p.rubyforge_name = PROJECT_NAME if PROJECT_NAME
31
+
32
+ p.clean_globs |= GEM_CLEAN
33
+ p.spec_extras = GEM_EXTRAS if GEM_EXTRAS
34
+
35
+ GEM_DEPENDENCIES.each do |dep|
36
+ p.extra_deps << dep
37
+ end
38
+
39
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Smoot
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-25 00:00:00 -05:00
12
+ date: 2008-07-24 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: english
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -22,24 +23,33 @@ dependencies:
22
23
  version: 0.2.0
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
- name: rspec
26
+ name: hoe
27
+ type: :development
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
29
31
  - - ">="
30
32
  - !ruby/object:Gem::Version
31
- version: 1.1.3
33
+ version: 1.7.0
32
34
  version:
33
- description: Conveniences
34
- email: ssmoot@gmail.com
35
+ description: Support Library for DataMapper and DataObjects
36
+ email:
37
+ - ssmoot@gmail.com
35
38
  executables: []
36
39
 
37
40
  extensions: []
38
41
 
39
- extra_rdoc_files: []
40
-
42
+ extra_rdoc_files:
43
+ - History.txt
44
+ - Manifest.txt
45
+ - README.txt
41
46
  files:
42
- - README
47
+ - .autotest
48
+ - History.txt
49
+ - Manifest.txt
50
+ - README.txt
51
+ - Rakefile
52
+ - lib/extlib.rb
43
53
  - lib/extlib/assertions.rb
44
54
  - lib/extlib/blank.rb
45
55
  - lib/extlib/hook.rb
@@ -51,7 +61,7 @@ files:
51
61
  - lib/extlib/pooling.rb
52
62
  - lib/extlib/string.rb
53
63
  - lib/extlib/struct.rb
54
- - lib/extlib.rb
64
+ - lib/extlib/version.rb
55
65
  - spec/blank_spec.rb
56
66
  - spec/hook_spec.rb
57
67
  - spec/inflection_spec.rb
@@ -62,11 +72,13 @@ files:
62
72
  - spec/spec_helper.rb
63
73
  - spec/string_spec.rb
64
74
  - spec/struct_spec.rb
75
+ - tasks/hoe.rb
65
76
  has_rdoc: false
66
77
  homepage: http://extlib.rubyforge.org
67
78
  post_install_message:
68
- rdoc_options: []
69
-
79
+ rdoc_options:
80
+ - --main
81
+ - README.txt
70
82
  require_paths:
71
83
  - lib
72
84
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -81,12 +93,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
93
  - !ruby/object:Gem::Version
82
94
  version: "0"
83
95
  version:
84
- requirements:
85
- - none
96
+ requirements: []
97
+
86
98
  rubyforge_project: extlib
87
- rubygems_version: 1.0.1
99
+ rubygems_version: 1.2.0
88
100
  signing_key:
89
101
  specification_version: 2
90
- summary: Support Library
102
+ summary: Support Library for DataMapper and DataObjects
91
103
  test_files: []
92
104
 
data/README DELETED
File without changes