use 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +7 -0
- data/MANIFEST +9 -12
- data/README +13 -14
- data/Rakefile +24 -0
- data/lib/use.rb +1 -1
- data/test/tc_use.rb +3 -10
- data/test/test_data.rb +0 -8
- metadata +6 -3
data/CHANGES
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
== 1.2.1 - 22-May-2007
|
2
|
+
* Added a Rakefile, with tasks for testing and installation.
|
3
|
+
* Removed the install.rb file. Installation is now handled by the 'rake
|
4
|
+
install' and 'rake install_gem' tasks.
|
5
|
+
* Updated the MANIFEST and made it RDoc friendly.
|
6
|
+
* Minor updates to the README and test files.
|
7
|
+
|
1
8
|
== 1.2.0 - 24-Feb-2006
|
2
9
|
* Method is now redefined within Class instead of Module in order to make
|
3
10
|
the ability to use 'include' and 'alias' more flexible and work more nicely
|
data/MANIFEST
CHANGED
@@ -1,12 +1,9 @@
|
|
1
|
-
CHANGES
|
2
|
-
MANIFEST
|
3
|
-
README
|
4
|
-
|
5
|
-
use.gemspec
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
test/tc_use.rb
|
12
|
-
test/test_data.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* use.gemspec
|
6
|
+
* examples/example_use.rb
|
7
|
+
* lib/use.rb
|
8
|
+
* test/tc_use.rb
|
9
|
+
* test/test_data.rb
|
data/README
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
== Description
|
2
|
-
The 'use' package allows you to selectively
|
2
|
+
The 'use' package allows you to selectively mix in methods from a given
|
3
3
|
module.
|
4
4
|
|
5
5
|
== Prerequisites
|
@@ -7,13 +7,12 @@
|
|
7
7
|
|
8
8
|
== Installation
|
9
9
|
=== Standard
|
10
|
-
|
11
|
-
|
10
|
+
rake test (optional)
|
11
|
+
rake install
|
12
12
|
|
13
13
|
=== Gem install
|
14
|
-
|
15
|
-
|
16
|
-
gem install use.gem
|
14
|
+
rake test (optional)
|
15
|
+
rake install_gem
|
17
16
|
|
18
17
|
== Synopsis
|
19
18
|
module Foo
|
@@ -41,9 +40,9 @@
|
|
41
40
|
|
42
41
|
z = Zap.new
|
43
42
|
|
44
|
-
z.bar # "hello"
|
45
|
-
z.baz # NoMethodError
|
46
|
-
z.blah # "new york"
|
43
|
+
z.bar # => "hello"
|
44
|
+
z.baz # => NoMethodError
|
45
|
+
z.blah # =>"new york"
|
47
46
|
|
48
47
|
# Using the new keywords
|
49
48
|
class MyKlass
|
@@ -51,8 +50,8 @@
|
|
51
50
|
end
|
52
51
|
|
53
52
|
m = MyKlass.new
|
54
|
-
m.test # "hello"
|
55
|
-
m.bar # NoMethodError
|
53
|
+
m.test # => "hello"
|
54
|
+
m.bar # => NoMethodError
|
56
55
|
|
57
56
|
== Constants
|
58
57
|
USE_VERSION
|
@@ -60,8 +59,8 @@ USE_VERSION
|
|
60
59
|
|
61
60
|
== Acknowledgements
|
62
61
|
Thanks go to Ara Howard for providing the original solution and to
|
63
|
-
Mauricio Fernandez,
|
64
|
-
mixins.
|
62
|
+
Mauricio Fernandez, whose blog I plagiarized (and with whom I communicated)
|
63
|
+
in order to implement fine-grained mixins.
|
65
64
|
|
66
65
|
== Known Bugs
|
67
66
|
None that I'm aware of. If you find any, please log them on the project
|
@@ -76,7 +75,7 @@ USE_VERSION
|
|
76
75
|
Ruby's
|
77
76
|
|
78
77
|
== Copyright
|
79
|
-
(C) 2005-
|
78
|
+
(C) 2005-2007, Daniel J. Berger
|
80
79
|
All Rights Reserved
|
81
80
|
|
82
81
|
== Author
|
data/Rakefile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rbconfig'
|
4
|
+
include Config
|
5
|
+
|
6
|
+
desc 'Install the use package (non-gem)'
|
7
|
+
task :install do
|
8
|
+
sitelibdir = CONFIG["sitelibdir"]
|
9
|
+
file = "lib/use.rb"
|
10
|
+
FileUtils.cp(file, sitelibdir, :verbose => true)
|
11
|
+
end
|
12
|
+
|
13
|
+
task :install_gem do
|
14
|
+
ruby 'use.gemspec'
|
15
|
+
file = Dir["*.gem"].first
|
16
|
+
sh "gem install #{file}"
|
17
|
+
end
|
18
|
+
|
19
|
+
Rake::TestTask.new do |t|
|
20
|
+
t.libs << 'test'
|
21
|
+
t.verbose = true
|
22
|
+
t.warning = true
|
23
|
+
t.test_files = FileList['test/tc_use.rb']
|
24
|
+
end
|
data/lib/use.rb
CHANGED
data/test/tc_use.rb
CHANGED
@@ -2,16 +2,9 @@
|
|
2
2
|
# tc_use.rb
|
3
3
|
#
|
4
4
|
# Test cases for the 'use' package. The relevant modules and classes
|
5
|
-
# are stored in the 'test_data.rb' file.
|
5
|
+
# are stored in the 'test_data.rb' file. This test should be run via
|
6
|
+
# the 'rake test' task.
|
6
7
|
#######################################################################
|
7
|
-
base = File.basename(Dir.pwd)
|
8
|
-
if base == 'test' || base =~ /use/i
|
9
|
-
Dir.chdir '..' if base == 'test'
|
10
|
-
$LOAD_PATH.unshift Dir.pwd + '/lib'
|
11
|
-
Dir.chdir 'test' rescue nil
|
12
|
-
$LOAD_PATH.unshift Dir.pwd
|
13
|
-
end
|
14
|
-
|
15
8
|
require 'use'
|
16
9
|
require 'test_data'
|
17
10
|
require 'test/unit'
|
@@ -25,7 +18,7 @@ class TC_Use < Test::Unit::TestCase
|
|
25
18
|
end
|
26
19
|
|
27
20
|
def test_version
|
28
|
-
assert_equal('1.2.
|
21
|
+
assert_equal('1.2.1', Class::USE_VERSION)
|
29
22
|
end
|
30
23
|
|
31
24
|
def test_mod_a_methods
|
data/test/test_data.rb
CHANGED
@@ -3,14 +3,6 @@
|
|
3
3
|
#
|
4
4
|
# Test modules and classes for the 'use' package.
|
5
5
|
##################################################
|
6
|
-
#if File.basename(Dir.pwd) == "test"
|
7
|
-
# Dir.chdir(".."){
|
8
|
-
# $LOAD_PATH.unshift(Dir.pwd)
|
9
|
-
# $LOAD_PATH.unshift(Dir.pwd + "/lib")
|
10
|
-
# }
|
11
|
-
#end
|
12
|
-
#$LOAD_PATH.unshift(Dir.pwd + "/lib")
|
13
|
-
|
14
6
|
module ModA
|
15
7
|
def meth_a
|
16
8
|
"ModA#meth_a"
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: use
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.2.
|
7
|
-
date:
|
6
|
+
version: 1.2.1
|
7
|
+
date: 2007-05-22 00:00:00 -06:00
|
8
8
|
summary: Selectively mixin methods from a given module
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -25,6 +25,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
|
|
25
25
|
platform: ruby
|
26
26
|
signing_key:
|
27
27
|
cert_chain:
|
28
|
+
post_install_message:
|
28
29
|
authors:
|
29
30
|
- Daniel J. Berger
|
30
31
|
files:
|
@@ -32,6 +33,7 @@ files:
|
|
32
33
|
- CHANGES
|
33
34
|
- MANIFEST
|
34
35
|
- README
|
36
|
+
- Rakefile
|
35
37
|
- test/tc_use.rb
|
36
38
|
- test/test_data.rb
|
37
39
|
test_files:
|
@@ -39,6 +41,7 @@ test_files:
|
|
39
41
|
rdoc_options: []
|
40
42
|
|
41
43
|
extra_rdoc_files:
|
44
|
+
- MANIFEST
|
42
45
|
- README
|
43
46
|
- CHANGES
|
44
47
|
executables: []
|