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 CHANGED
@@ -1,3 +1,4 @@
1
+ MANIFEST
1
2
  test
2
3
  test/test_attribute.rb
3
4
  test/test_annotator.rb
data/README CHANGED
@@ -1,62 +1,91 @@
1
1
  = Anise
2
2
 
3
- http://anise.rubyforge.org
4
-
3
+ http://anise.rubyforge.org
5
4
 
6
5
  == INTRODUCTION
7
6
 
8
- Anise is an Annotations Systems for the Ruby programming lanaguage.
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
- gem install anise
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
- $ tar -xvzf anise-0.4.0.tgz
29
- $ cd annotated-0.4.0
30
- $ sudo setup.rb all
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
- == TESTING
31
+ The following example briefly demonstrates all three major features.
34
32
 
35
- We recommend using Turn (http://turn.rubyforge.org) to run Anise's
36
- unit tests.
33
+ require 'anise'
37
34
 
38
- $ turn test/test_*
35
+ class X
39
36
 
40
- But we have include a script +test/suite.rb+ so you can easily run the
41
- unit tests with the testrb command:
37
+ include Anise
42
38
 
43
- $ testrb test/suite.rb
39
+ # Annotations
44
40
 
45
- or with Ruby alone:
41
+ ann :grape, :class=>String
46
42
 
47
- $ ruby -rtest/unit test/suite.rb
43
+ # Annotators
48
44
 
45
+ annotator :doc
49
46
 
50
- == USAGE
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
- For the moment please see the API documentation to learn how to use the library.
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 ditributed under the terms of the LGPL License.
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
- http://anise.rubyforge.org
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.0 beta (2008-09-27)
1
+ anise 0.2.1 beta (2008-09-27)
@@ -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
@@ -6,6 +6,8 @@ module Anise
6
6
  # Annotator allows for the creation of dynamic method
7
7
  # annotations which attach to the next method defined.
8
8
  #
9
+ # require 'anise/annotator'
10
+ #
9
11
  # class X
10
12
  # include Anise::Annotator
11
13
  #
@@ -11,6 +11,8 @@ module Anise
11
11
  # annotations to added to them directly rather than requireing a
12
12
  # separate #ann statement.
13
13
  #
14
+ # require 'anise/attribute'
15
+ #
14
16
  # class X
15
17
  # include Anise::Attribute
16
18
  #
data/lib/anise.rb CHANGED
@@ -5,27 +5,29 @@ require 'anise/attribute'
5
5
  #
6
6
  # Dynamic Annotations system for Ruby.
7
7
  #
8
- # class X
8
+ # require 'anise'
9
9
  #
10
- # include Anise
10
+ # class X
11
11
  #
12
- # # Provides annotations:
12
+ # include Anise
13
13
  #
14
- # ann :foo, :class=>String
14
+ # # Provides annotations:
15
15
  #
16
- # # Provides annotators:
16
+ # ann :foo, :class=>String
17
17
  #
18
- # annotator :doc
19
- # doc "Underdog is here!"
20
- # def underdog
21
- # UnderDog.new
22
- # end
18
+ # # Provides annotators:
23
19
  #
24
- # # Provides annotated attributes:
20
+ # annotator :doc
21
+ # doc "Underdog is here!"
22
+ # def underdog
23
+ # UnderDog.new
24
+ # end
25
25
  #
26
- # attr :bar, Integer, :max => 10
26
+ # # Provides annotated attributes:
27
27
  #
28
- # end
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.0
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-28 00:00:00 -04:00
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: