Skip to content
This repository was archived by the owner on Mar 15, 2022. It is now read-only.

Commit 9b72184

Browse files
committed
Updated project to use bundler and explicit require statements.
1 parent aa65753 commit 9b72184

16 files changed

+67
-50
lines changed

Gemfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
source 'https://rubygems.org'
22

3+
gemspec
4+
35
group :development do
46
gem 'rake', '~> 10.3.2'
57
end
@@ -8,7 +10,7 @@ group :testing do
810
gem 'test-unit', '~> 3.0.9'
911
#gem 'rspec', '~> 3.0.0'
1012
#gem 'simplecov', '~> 0.8.2', :require => false
11-
#gem 'coveralls', '~> 0.7.0', :require => false
13+
gem 'coveralls', '~> 0.7.3', :require => false
1214
end
1315

1416
group :documentation do

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ref
22

3-
[![Gem Version](https://badge.fury.io/rb/ref.svg)](http://badge.fury.io/rb/ref) [![Build Status](https://travis-ci.org/ruby-concurrency/ref.svg?branch=master)](https://travis-ci.org/ruby-concurrency/ref) [![Code Climate](https://codeclimate.com/github/ruby-concurrency/ref.svg)](https://codeclimate.com/github/ruby-concurrency/ref) [![Dependency Status](https://gemnasium.com/ruby-concurrency/ref.svg)](https://gemnasium.com/ruby-concurrency/ref) [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT) [![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)
3+
[![Gem Version](https://badge.fury.io/rb/ref.svg)](http://badge.fury.io/rb/ref) [![Build Status](https://travis-ci.org/ruby-concurrency/ref.svg?branch=master)](https://travis-ci.org/ruby-concurrency/ref) [![Coverage Status](https://img.shields.io/coveralls/ruby-concurrency/ref/master.svg)](https://coveralls.io/r/ruby-concurrency/ref) [![Code Climate](https://codeclimate.com/github/ruby-concurrency/ref.svg)](https://codeclimate.com/github/ruby-concurrency/ref) [![Dependency Status](https://gemnasium.com/ruby-concurrency/ref.svg)](https://gemnasium.com/ruby-concurrency/ref) [![License](https://img.shields.io/badge/license-MIT-green.svg)](http://opensource.org/licenses/MIT) [![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/ruby-concurrency/concurrent-ruby)
44

55
This library provides object references for Ruby as well as some common utilities for working with references. Object references are used to point to other objects and come in three distinct flavors that interact differently with the garbage collector.
66

VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/ref.rb

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
11
module Ref
2-
require File.join(File.dirname(__FILE__), "ref", "abstract_reference_value_map.rb")
3-
require File.join(File.dirname(__FILE__), "ref", "abstract_reference_key_map.rb")
4-
require File.join(File.dirname(__FILE__), "ref", "reference.rb")
5-
require File.join(File.dirname(__FILE__), "ref", "reference_queue.rb")
6-
require File.join(File.dirname(__FILE__), "ref", "safe_monitor.rb")
2+
require 'ref/abstract_reference_value_map'
3+
require 'ref/abstract_reference_key_map'
4+
require 'ref/reference'
5+
require 'ref/reference_queue'
6+
require 'ref/safe_monitor'
77

88
# Set the best implementation for weak references based on the runtime.
99
if defined?(RUBY_PLATFORM) && RUBY_PLATFORM == 'java'
1010
# Use native Java references
1111
begin
1212
$LOAD_PATH.unshift(File.dirname(__FILE__))
13-
require 'org/jruby/ext/ref/references'
13+
require 'ref/org/jruby/ext/ref/references'
1414
ensure
1515
$LOAD_PATH.shift if $LOAD_PATH.first == File.dirname(__FILE__)
1616
end
1717
else
18-
require File.join(File.dirname(__FILE__), "ref", "soft_reference.rb")
18+
require 'ref/soft_reference'
1919
if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby'
2020
# IronRuby has it's own implementation of weak references.
21-
require File.join(File.dirname(__FILE__), "ref", "weak_reference", "iron_ruby.rb")
21+
require 'ref/weak_reference/iron_ruby'
2222
elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
2323
# If using Rubinius set the implementation to use WeakRef since it is very efficient and using finalizers is not.
24-
require File.join(File.dirname(__FILE__), "ref", "weak_reference", "weak_ref.rb")
24+
require 'ref/weak_reference/weak_ref'
2525
elsif defined?(::ObjectSpace::WeakMap)
2626
# Ruby 2.0 has a working implementation of weakref.rb backed by the new ObjectSpace::WeakMap
27-
require File.join(File.dirname(__FILE__), "ref", "weak_reference", "weak_ref.rb")
27+
require 'ref/weak_reference/weak_ref'
2828
elsif defined?(::ObjectSpace._id2ref)
2929
# If ObjectSpace can lookup objects from their object_id, then use the pure ruby implementation.
30-
require File.join(File.dirname(__FILE__), "ref", "weak_reference", "pure_ruby.rb")
30+
require 'ref/weak_reference/pure_ruby'
3131
else
3232
# Otherwise, wrap the standard library WeakRef class
33-
require File.join(File.dirname(__FILE__), "ref", "weak_reference", "weak_ref.rb")
33+
require 'ref/weak_reference/weak_ref'
3434
end
3535
end
36-
37-
require File.join(File.dirname(__FILE__), "ref", "soft_key_map.rb")
38-
require File.join(File.dirname(__FILE__), "ref", "soft_value_map.rb")
39-
require File.join(File.dirname(__FILE__), "ref", "strong_reference.rb")
40-
require File.join(File.dirname(__FILE__), "ref", "weak_key_map.rb")
41-
require File.join(File.dirname(__FILE__), "ref", "weak_value_map.rb")
42-
43-
# Used for testing
44-
autoload :Mock, File.join(File.dirname(__FILE__), "ref", "mock.rb")
36+
37+
require 'ref/soft_key_map'
38+
require 'ref/soft_value_map'
39+
require 'ref/strong_reference'
40+
require 'ref/weak_key_map'
41+
require 'ref/weak_value_map'
4542
end

lib/ref/version.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module Ref
2+
VERSION = '1.0.5'
3+
end

ref.gemspec

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1+
$:.push File.join(File.dirname(__FILE__), 'lib')
2+
3+
require 'ref/version'
4+
15
Gem::Specification.new do |s|
2-
s.name = 'ref'
3-
s.version = File.read(File.expand_path("../VERSION", __FILE__)).strip
4-
s.summary = "Library that implements weak, soft, and strong references in Ruby."
6+
s.name = 'ref'
7+
s.version = Ref::VERSION
8+
s.authors = ['Brian Durand']
9+
s.email = ['[email protected]']
10+
s.homepage = "http://github.com/ruby-concurrency/ref"
11+
s.summary = "Library that implements weak, soft, and strong references in Ruby."
512
s.description = "Library that implements weak, soft, and strong references in Ruby that work across multiple runtimes (MRI, REE, YARV, Jruby, Rubinius, and IronRuby). Also includes implementation of maps/hashes that use references and a reference queue."
13+
s.license = "MIT"
14+
s.date = Time.now.strftime('%Y-%m-%d')
615

7-
s.authors = ['Brian Durand']
8-
s.email = ['[email protected]']
9-
s.homepage = "http://github.com/bdurand/ref"
16+
s.files = ['README.md', 'MIT_LICENSE']
17+
s.files += Dir['lib/**/*.*']
18+
s.files += Dir['ext/**/*.*']
19+
s.files += Dir['test/**/*.*']
1020

11-
s.files = ['README.rdoc', 'VERSION', 'MIT_LICENSE'] + Dir.glob('lib/**/*'), Dir.glob('test/**/*'), Dir.glob('ext/**/*')
12-
s.require_path = 'lib'
21+
s.require_paths = ['lib']
1322

14-
s.has_rdoc = true
15-
s.rdoc_options = ["--charset=UTF-8", "--main", "README.rdoc"]
16-
s.extra_rdoc_files = ["README.rdoc"]
17-
18-
s.license = "MIT"
23+
s.has_rdoc = true
24+
s.rdoc_options = ["--charset=UTF-8", "--main", "README.md"]
25+
s.extra_rdoc_files = ["README.md"]
26+
27+
s.required_ruby_version = '>= 1.9.3'
1928
end

test/mock_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path("../test_helper", __FILE__)
1+
require_relative 'test_helper'
22

33
class TestMock < Test::Unit::TestCase
44
def test_gc_with_argument

test/reference_queue_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path("../test_helper", __FILE__)
1+
require_relative 'test_helper'
22

33
class TestReferenceQueue < Test::Unit::TestCase
44
def test_can_add_references

test/soft_key_map_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path("../test_helper", __FILE__)
1+
require_relative 'test_helper'
22

33
class TestSoftKeyMap < Test::Unit::TestCase
44
include ReferenceKeyMapBehavior

test/soft_reference_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require File.expand_path("../test_helper", __FILE__)
1+
require_relative 'test_helper'
22

33
class TestSoftReference < Test::Unit::TestCase
44
def test_can_get_non_garbage_collected_objects

0 commit comments

Comments
 (0)