interface 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/MANIFEST +11 -11
- data/README +5 -10
- data/Rakefile +46 -0
- data/interface.gemspec +25 -0
- data/lib/interface.rb +10 -2
- data/test/test_interface.rb +1 -1
- metadata +7 -5
data/CHANGES
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
== 1.0.2 - 7-Oct-2009
|
2
|
+
* Fixed packaging bug in the gemspec, and made some other minor changes.
|
3
|
+
* Added the 'gem' rake task.
|
4
|
+
* Updated copyright and license in the README.
|
5
|
+
|
1
6
|
== 1.0.1 - 29-Jul-2009
|
2
7
|
* Now compatible with Ruby 1.9.x.
|
3
8
|
* Replaced the install.rb with a Rakefile and various tasks.
|
data/MANIFEST
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
CHANGES
|
2
|
-
MANIFEST
|
3
|
-
README
|
4
|
-
Rakefile
|
5
|
-
interface.gemspec
|
6
|
-
examples/example_instance.rb
|
7
|
-
examples/example_interface.rb
|
8
|
-
examples/example_sub.rb
|
9
|
-
examples/example_unrequire.rb
|
10
|
-
lib/interface.rb
|
11
|
-
test/test_interface.rb
|
1
|
+
* CHANGES
|
2
|
+
* MANIFEST
|
3
|
+
* README
|
4
|
+
* Rakefile
|
5
|
+
* interface.gemspec
|
6
|
+
* examples/example_instance.rb
|
7
|
+
* examples/example_interface.rb
|
8
|
+
* examples/example_sub.rb
|
9
|
+
* examples/example_unrequire.rb
|
10
|
+
* lib/interface.rb
|
11
|
+
* test/test_interface.rb
|
data/README
CHANGED
@@ -7,12 +7,10 @@
|
|
7
7
|
== Installation
|
8
8
|
|
9
9
|
=== Manual
|
10
|
-
|
11
|
-
ruby install.rb
|
10
|
+
rake install
|
12
11
|
|
13
12
|
=== Gem Install
|
14
|
-
|
15
|
-
gem install interface-<version>.gem
|
13
|
+
gem install interface
|
16
14
|
|
17
15
|
== Synopsis
|
18
16
|
require "interface"
|
@@ -64,7 +62,7 @@
|
|
64
62
|
series of discussions on IRC.
|
65
63
|
|
66
64
|
== Copyright
|
67
|
-
(C) 2004 Daniel J. Berger
|
65
|
+
(C) 2004-2009 Daniel J. Berger
|
68
66
|
All rights reserved.
|
69
67
|
|
70
68
|
== Warranty
|
@@ -73,10 +71,7 @@
|
|
73
71
|
warranties of merchantability and fitness for a particular purpose.
|
74
72
|
|
75
73
|
== License
|
76
|
-
|
74
|
+
Artistic 2.0
|
77
75
|
|
78
76
|
== Author
|
79
|
-
Daniel J. Berger
|
80
|
-
modified by Mauricio Fernandez)
|
81
|
-
djberg96 at gmail dot com
|
82
|
-
imperator on IRC (irc.freenode.net)
|
77
|
+
Daniel J. Berger
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rbconfig'
|
4
|
+
include Config
|
5
|
+
|
6
|
+
desc 'Install the interface library (non-gem)'
|
7
|
+
task :install do
|
8
|
+
sitelibdir = CONFIG["sitelibdir"]
|
9
|
+
file = "lib/interface.rb"
|
10
|
+
FileUtils.cp(file, sitelibdir, :verbose => true)
|
11
|
+
end
|
12
|
+
|
13
|
+
task :gem do
|
14
|
+
spec = eval(IO.read('interface.gemspec'))
|
15
|
+
Gem::Builder.new(spec).build
|
16
|
+
end
|
17
|
+
|
18
|
+
task :install_gem => [:gem] do
|
19
|
+
file = Dir["*.gem"].first
|
20
|
+
sh "gem install #{file}"
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Run the example_instance.rb sample program'
|
24
|
+
task :example_instance do
|
25
|
+
ruby '-Ilib examples/example_instance.rb'
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'Run the example_interface.rb sample program'
|
29
|
+
task :example_interface do
|
30
|
+
ruby '-Ilib examples/example_interface.rb'
|
31
|
+
end
|
32
|
+
|
33
|
+
desc 'Run the example_sub.rb sample program'
|
34
|
+
task :example_sub do
|
35
|
+
ruby '-Ilib examples/example_sub.rb'
|
36
|
+
end
|
37
|
+
|
38
|
+
desc 'Run the example_unrequire.rb sample program'
|
39
|
+
task :example_unrequire do
|
40
|
+
ruby '-Ilib examples/example_unrequire.rb'
|
41
|
+
end
|
42
|
+
|
43
|
+
Rake::TestTask.new do |t|
|
44
|
+
t.verbose = true
|
45
|
+
t.warning = true
|
46
|
+
end
|
data/interface.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = 'interface'
|
5
|
+
gem.version = '1.0.2'
|
6
|
+
gem.author = 'Daniel J. Berger'
|
7
|
+
gem.license = 'Artistic 2.0'
|
8
|
+
gem.email = 'djberg96@gmail.com'
|
9
|
+
gem.homepage = 'http://www.rubyforge.org/projects/shards'
|
10
|
+
gem.summary = 'Java style interfaces for Ruby'
|
11
|
+
gem.test_file = 'test/test_interface.rb'
|
12
|
+
gem.has_rdoc = true
|
13
|
+
gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
|
14
|
+
|
15
|
+
gem.extra_rdoc_files = ['README', 'CHANGES', 'MANIFEST']
|
16
|
+
gem.rubyforge_project = 'shards'
|
17
|
+
|
18
|
+
gem.add_development_dependency('test-unit', '>= 2.0.3')
|
19
|
+
|
20
|
+
gem.description = <<-EOF
|
21
|
+
The interface library implements Java style interfaces for Ruby.
|
22
|
+
It lets you define a set a methods that must be defined in the
|
23
|
+
including class or module, or an error is raised.
|
24
|
+
EOF
|
25
|
+
end
|
data/lib/interface.rb
CHANGED
@@ -4,8 +4,8 @@
|
|
4
4
|
# http://java.sun.com/docs/books/tutorial/java/concepts/interface.html
|
5
5
|
#
|
6
6
|
module Interface
|
7
|
-
# The version of
|
8
|
-
Interface::VERSION = '1.0.
|
7
|
+
# The version of the interface library.
|
8
|
+
Interface::VERSION = '1.0.2'
|
9
9
|
|
10
10
|
# Raised if a class or instance does not meet the interface requirements.
|
11
11
|
class MethodMissing < RuntimeError; end
|
@@ -81,6 +81,14 @@ end
|
|
81
81
|
# unrequired_methods :alpha
|
82
82
|
# }
|
83
83
|
#
|
84
|
+
# # Raises an Interface::MethodMissing error because :beta is not defined.
|
85
|
+
# class MyClass
|
86
|
+
# def alpha
|
87
|
+
# # ...
|
88
|
+
# end
|
89
|
+
# implements AlphaInterface
|
90
|
+
# end
|
91
|
+
#
|
84
92
|
def interface(&block)
|
85
93
|
mod = Module.new
|
86
94
|
mod.extend(Interface)
|
data/test/test_interface.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: interface
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07
|
12
|
+
date: 2009-10-07 00:00:00 -06:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -33,15 +33,17 @@ extra_rdoc_files:
|
|
33
33
|
- CHANGES
|
34
34
|
- MANIFEST
|
35
35
|
files:
|
36
|
+
- CHANGES
|
36
37
|
- examples/example_instance.rb
|
37
38
|
- examples/example_interface.rb
|
38
39
|
- examples/example_sub.rb
|
39
40
|
- examples/example_unrequire.rb
|
41
|
+
- interface.gemspec
|
40
42
|
- lib/interface.rb
|
41
|
-
- test/test_interface.rb
|
42
|
-
- README
|
43
|
-
- CHANGES
|
44
43
|
- MANIFEST
|
44
|
+
- Rakefile
|
45
|
+
- README
|
46
|
+
- test/test_interface.rb
|
45
47
|
has_rdoc: true
|
46
48
|
homepage: http://www.rubyforge.org/projects/shards
|
47
49
|
licenses:
|