anise 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/MANIFEST +1 -0
- data/README +51 -22
- data/RELEASE +1 -5
- data/VERSION +1 -1
- data/lib/anise/annotation.rb +17 -11
- data/lib/anise/annotator.rb +2 -0
- data/lib/anise/attribute.rb +2 -0
- data/lib/anise.rb +15 -13
- metadata +3 -3
data/MANIFEST
CHANGED
data/README
CHANGED
@@ -1,62 +1,91 @@
|
|
1
1
|
= Anise
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
http://anise.rubyforge.org
|
5
4
|
|
6
5
|
== INTRODUCTION
|
7
6
|
|
8
|
-
Anise is an Annotations Systems for the Ruby programming
|
7
|
+
Anise is an Annotations Systems for the Ruby programming language.
|
9
8
|
Unlike most other annotations systems it is not a comment-based
|
10
9
|
system, or a "macro" system that sits over-and-above the rest of the
|
11
10
|
code. Rather, Anise is a dynamic annotations system operating at runtime.
|
12
11
|
|
13
|
-
|
14
|
-
== RELEASE NOTES & RECENT CHANGES
|
12
|
+
== RELEASE NOTES
|
15
13
|
|
16
14
|
Please see the RELEASE file.
|
17
15
|
|
18
|
-
|
19
16
|
== INSTALLATION
|
20
17
|
|
21
18
|
To install with RubyGems simply open a console and type:
|
22
19
|
|
23
|
-
|
20
|
+
gem install anise
|
24
21
|
|
25
22
|
To manually install you will need Setup.rb (see http://setup.rubyforge.org).
|
26
23
|
Then download the tarball package and do:
|
27
24
|
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
$ tar -xvzf anise-0.2.0.tgz
|
26
|
+
$ cd anise-0.2.0
|
27
|
+
$ sudo setup.rb all
|
31
28
|
|
29
|
+
== USAGE
|
32
30
|
|
33
|
-
|
31
|
+
The following example briefly demonstrates all three major features.
|
34
32
|
|
35
|
-
|
36
|
-
unit tests.
|
33
|
+
require 'anise'
|
37
34
|
|
38
|
-
|
35
|
+
class X
|
39
36
|
|
40
|
-
|
41
|
-
unit tests with the testrb command:
|
37
|
+
include Anise
|
42
38
|
|
43
|
-
|
39
|
+
# Annotations
|
44
40
|
|
45
|
-
|
41
|
+
ann :grape, :class=>String
|
46
42
|
|
47
|
-
|
43
|
+
# Annotators
|
48
44
|
|
45
|
+
annotator :doc
|
49
46
|
|
50
|
-
|
47
|
+
doc "This is an entry."
|
48
|
+
|
49
|
+
def bar
|
50
|
+
# ...
|
51
|
+
end
|
52
|
+
|
53
|
+
# Annotated Attributes
|
54
|
+
|
55
|
+
attr :baz, Integer, :max => 10
|
56
|
+
|
57
|
+
end
|
51
58
|
|
52
|
-
|
59
|
+
Looking at the resulting annotations:
|
60
|
+
|
61
|
+
X.ann(:foo) #=> {:class=>String}
|
62
|
+
X.ann(:bar) #=> {:doc=>"This is an entry."}
|
63
|
+
X.ann(:baz) #=> {:class=>Integer, :max=>10}
|
64
|
+
|
65
|
+
The Anise library can be used as a whole, per the example above, or these
|
66
|
+
features can be used separately. For more details see the RDoc API
|
67
|
+
documentation.
|
68
|
+
|
69
|
+
== TESTING
|
70
|
+
|
71
|
+
Turn is the recommended way to run Anise's test suite (http://turn.rubyforge.org).
|
72
|
+
|
73
|
+
$ turn test/test_*
|
74
|
+
|
75
|
+
But a script +test/suite.rb+ script is include so you can easily run
|
76
|
+
the unit tests with the testrb command:
|
77
|
+
|
78
|
+
$ testrb -Ilib test/suite.rb
|
79
|
+
|
80
|
+
or with Ruby alone:
|
53
81
|
|
82
|
+
$ ruby -Ilib -rtest/unit test/suite.rb
|
54
83
|
|
55
84
|
== LICENSE
|
56
85
|
|
57
86
|
Copyright (c) 2008 TigerOps
|
58
87
|
|
59
|
-
This program is
|
88
|
+
This program is distributed under the terms of the LGPL License.
|
60
89
|
|
61
90
|
Please see COPYING file for details.
|
62
91
|
|
data/RELEASE
CHANGED
@@ -1,16 +1,12 @@
|
|
1
1
|
= Anise 0.2.0 hits the streets.
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
This is the initial public release of Anise.
|
3
|
+
This is the first public release of Anise.
|
6
4
|
|
7
5
|
Anise is a spin off the the Facets annotations.rb library.
|
8
6
|
It includes the Annotations functionality, and adds
|
9
7
|
a mixin, Annotator, that makes it easy to add new
|
10
8
|
annotations on the fly.
|
11
9
|
|
12
|
-
---
|
13
|
-
|
14
10
|
### 0.2.0 // 2008-09-23
|
15
11
|
|
16
12
|
2 Major Enhancments
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
anise 0.2.
|
1
|
+
anise 0.2.1 beta (2008-09-27)
|
data/lib/anise/annotation.rb
CHANGED
@@ -12,6 +12,8 @@ module Anise
|
|
12
12
|
#
|
13
13
|
# == Synopsis
|
14
14
|
#
|
15
|
+
# require 'anise/annotation'
|
16
|
+
#
|
15
17
|
# class X
|
16
18
|
# include Anise::Annotation
|
17
19
|
#
|
@@ -72,19 +74,14 @@ module Anise
|
|
72
74
|
base.extend self
|
73
75
|
end
|
74
76
|
|
75
|
-
# Stores this classes or modules annotations.
|
76
|
-
#
|
77
|
-
def annotations
|
78
|
-
#$annotations[self]
|
79
|
-
@annotations ||= {}
|
80
|
-
end
|
81
|
-
|
82
77
|
# Lookup an annotation. Unlike +annotations[ref]+
|
83
78
|
# this provides a complete annotation <i>heritage</i>,
|
84
|
-
# pulling annotations of the same reference name
|
79
|
+
# pulling annotations of the same reference name
|
85
80
|
# from ancestor classes and modules.
|
86
81
|
#
|
87
|
-
def annotation(ref)
|
82
|
+
def annotation(ref=nil)
|
83
|
+
return(@annotations ||= {}) if ref.nil?
|
84
|
+
|
88
85
|
ref = ref.to_sym
|
89
86
|
ann = {}
|
90
87
|
ancestors.reverse_each do |anc|
|
@@ -102,6 +99,16 @@ module Anise
|
|
102
99
|
#end
|
103
100
|
end
|
104
101
|
|
102
|
+
# Plural alias for #annotation.
|
103
|
+
alias_method :annotations, :annotation
|
104
|
+
|
105
|
+
# Stores this class' or module's annotations.
|
106
|
+
#
|
107
|
+
#def annotations
|
108
|
+
# #$annotations[self]
|
109
|
+
# @annotations ||= {}
|
110
|
+
#end
|
111
|
+
|
105
112
|
# Set or read annotations.
|
106
113
|
#
|
107
114
|
def ann( ref, keys_or_class=nil, keys=nil )
|
@@ -156,5 +163,4 @@ module Anise
|
|
156
163
|
end
|
157
164
|
|
158
165
|
# 2006-11-07 trans Created this ultra-concise version of annotations.
|
159
|
-
# Copyright (c) 2005, 2008 TigerOps
|
160
|
-
|
166
|
+
# Copyright (c) 2005, 2008 TigerOps
|
data/lib/anise/annotator.rb
CHANGED
data/lib/anise/attribute.rb
CHANGED
data/lib/anise.rb
CHANGED
@@ -5,27 +5,29 @@ require 'anise/attribute'
|
|
5
5
|
#
|
6
6
|
# Dynamic Annotations system for Ruby.
|
7
7
|
#
|
8
|
-
#
|
8
|
+
# require 'anise'
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# class X
|
11
11
|
#
|
12
|
-
#
|
12
|
+
# include Anise
|
13
13
|
#
|
14
|
-
#
|
14
|
+
# # Provides annotations:
|
15
15
|
#
|
16
|
-
#
|
16
|
+
# ann :foo, :class=>String
|
17
17
|
#
|
18
|
-
#
|
19
|
-
# doc "Underdog is here!"
|
20
|
-
# def underdog
|
21
|
-
# UnderDog.new
|
22
|
-
# end
|
18
|
+
# # Provides annotators:
|
23
19
|
#
|
24
|
-
#
|
20
|
+
# annotator :doc
|
21
|
+
# doc "Underdog is here!"
|
22
|
+
# def underdog
|
23
|
+
# UnderDog.new
|
24
|
+
# end
|
25
25
|
#
|
26
|
-
#
|
26
|
+
# # Provides annotated attributes:
|
27
27
|
#
|
28
|
-
#
|
28
|
+
# attr :bar, Integer, :max => 10
|
29
|
+
#
|
30
|
+
# end
|
29
31
|
#
|
30
32
|
module Anise
|
31
33
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: anise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tigerops-community@rubyforge.org
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2008-10-
|
13
|
+
date: 2008-10-31 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- lib
|
41
41
|
- meta
|
42
42
|
- test
|
43
|
+
- MANIFEST
|
43
44
|
- RELEASE
|
44
45
|
- README
|
45
46
|
- HISTORY
|
@@ -67,7 +68,6 @@ files:
|
|
67
68
|
- test/test_anise.rb
|
68
69
|
- test/test_anise_toplevel.rb
|
69
70
|
- test/test_annotations_toplevel.rb
|
70
|
-
- MANIFEST
|
71
71
|
has_rdoc: true
|
72
72
|
homepage: http://
|
73
73
|
post_install_message:
|