cocoadex 1.4 → 1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. data/bin/cdex_completion +7 -0
  2. data/bin/cocoadex +5 -3
  3. data/changelog.md +5 -0
  4. data/lib/cocoadex/docset_helper.rb +8 -4
  5. data/lib/cocoadex/extensions.rb +4 -0
  6. data/lib/cocoadex/keyword.rb +30 -103
  7. data/lib/cocoadex/model.rb +56 -0
  8. data/lib/cocoadex/models/callback.rb +12 -0
  9. data/lib/cocoadex/models/class.rb +2 -2
  10. data/lib/cocoadex/models/constant.rb +41 -0
  11. data/lib/cocoadex/models/data_type.rb +47 -0
  12. data/lib/cocoadex/models/element.rb +14 -1
  13. data/lib/cocoadex/models/entity.rb +6 -0
  14. data/lib/cocoadex/models/function.rb +28 -0
  15. data/lib/cocoadex/models/generic_ref.rb +88 -0
  16. data/lib/cocoadex/models/method.rb +21 -70
  17. data/lib/cocoadex/models/nested_node_element.rb +17 -0
  18. data/lib/cocoadex/models/parameter.rb +20 -0
  19. data/lib/cocoadex/models/property.rb +3 -18
  20. data/lib/cocoadex/models/result_code.rb +17 -0
  21. data/lib/cocoadex/models/seq_node_element.rb +53 -0
  22. data/lib/cocoadex/parser.rb +22 -18
  23. data/lib/cocoadex/serializer.rb +18 -8
  24. data/lib/cocoadex/tokenizer.rb +123 -0
  25. data/lib/cocoadex/tools/completion_helper.rb +84 -0
  26. data/lib/cocoadex/version.rb +1 -1
  27. data/lib/cocoadex.rb +12 -10
  28. data/lib/ext/nil.rb +3 -0
  29. data/lib/ext/string.rb +9 -0
  30. data/lib/ext/template_helpers.rb +20 -0
  31. data/lib/ext/xml_element.rb +10 -0
  32. data/readme.md +36 -8
  33. data/views/class.erb +35 -0
  34. data/views/constant.erb +10 -0
  35. data/views/constant_group.erb +28 -0
  36. data/views/data_type.erb +47 -0
  37. data/views/generic_ref.erb +28 -0
  38. data/views/method.erb +34 -0
  39. data/views/multiple.erb +4 -0
  40. data/views/property.erb +14 -0
  41. data/views/result_code.erb +7 -0
  42. metadata +50 -10
  43. data/bin/cocoadex_completion.sh +0 -36
  44. data/lib/cocoadex/templates.rb +0 -114
data/views/class.erb ADDED
@@ -0,0 +1,35 @@
1
+
2
+ <%= hrule( type + ": " + name ) %>
3
+ <%= print_origin( origin ) %>
4
+
5
+ <% if description.empty? %>
6
+ (no description...)
7
+ <% else %>
8
+ <%= "\n" + description %>
9
+ <% end %>
10
+ <% unless overview.empty? %>
11
+
12
+ <%= hrule %>
13
+
14
+ <%= section_header( "Overview:" ) %>
15
+ <%= Bri::Renderer.wrap_row(overview.join("\n\n"), Cocoadex.width) %>
16
+ <% end %>
17
+
18
+ <%= hrule %>
19
+
20
+ <% unless class_methods.empty? %>
21
+ <%= section_header( "Class methods:" ) %>
22
+ <%= Bri::Renderer.wrap_list( class_methods.sort ) %>
23
+
24
+
25
+ <% end %>
26
+ <% unless instance_methods.empty? %>
27
+ <%= section_header( "Instance methods:" ) %>
28
+ <%= Bri::Renderer.wrap_list( instance_methods.sort ) %>
29
+
30
+
31
+ <% end %>
32
+ <% unless properties.empty? %>
33
+ <%= section_header( "Properties:" ) %>
34
+ <%= Bri::Renderer.wrap_list( properties.sort ) %>
35
+ <% end %>
@@ -0,0 +1,10 @@
1
+
2
+ <%= hrule( "Constant: " + name ) %>
3
+ <%= print_origin( origin ) %>
4
+
5
+ <%= hrule %>
6
+ <% if description.empty? %>
7
+ (no description...)
8
+ <% else %>
9
+ <%= wrap(description) %>
10
+ <% end %>
@@ -0,0 +1,28 @@
1
+
2
+ <%= hrule( "Constant Group: " + name ) %>
3
+ <%= print_origin( origin ) %>
4
+
5
+ <%= wrap(declaration) %>
6
+ <%= hrule %>
7
+ <% if abstract.empty? %>
8
+ (no description...)
9
+ <% else %>
10
+ <%= wrap(abstract) %>
11
+
12
+ <% end %>
13
+ <% if discussion %>
14
+ <%= section_header( "Discussion:" ) %>
15
+ <%= wrap(discussion) %>
16
+ <% end %>
17
+
18
+ <% unless constants.empty? %>
19
+ <% max = constants.map {|c| c.name.length }.max %>
20
+ <%= section_header( "Constants:" ) %>
21
+ <% constants.each do |constant| %>
22
+ <%= inline_title(constant.name, constant.description.split("\n").first, max) %>
23
+
24
+ <% end %>
25
+ <% end %>
26
+ <% if declared_in %>
27
+ Declared in <%= declared_in %>
28
+ <% end %>
@@ -0,0 +1,47 @@
1
+
2
+ <%= hrule( "Data Type: " + name ) %>
3
+ <%= print_origin( origin ) %>
4
+
5
+
6
+ <% if declaration %>
7
+ <%= wrap(declaration) %>
8
+ <% end %>
9
+ <%= hrule %>
10
+ <% if abstract.empty? %>
11
+ (no description...)
12
+ <% else %>
13
+ <%= wrap(abstract) %>
14
+ <% end %>
15
+
16
+ <% if considerations %>
17
+ <%= wrap(considerations) %>
18
+ <% end %>
19
+
20
+ <% unless fields.empty? %>
21
+ <%= section_header( "Fields:" ) %>
22
+ <% fields.each do |param| %>
23
+
24
+ <%= h3(Cocoadex.indent(param.name, 2)).strip %>
25
+ <% wrap(param.description).split("\n").each do |line| %>
26
+ <%= Cocoadex.indent(line, 4) %>
27
+ <% end %>
28
+
29
+ <% end %>
30
+
31
+ <% end %>
32
+ <% unless constants.empty? %>
33
+ <%= section_header( "Constants:" ) %>
34
+ <% constants.each do |param| %>
35
+
36
+ <%= h3(Cocoadex.indent(param.name, 2)).strip %>
37
+ <% wrap(param.description).split("\n").each do |line| %>
38
+ <%= Cocoadex.indent(line, 4) %>
39
+ <% end %>
40
+
41
+ <% end %>
42
+
43
+ <% end %>
44
+ <%= availability %>
45
+
46
+
47
+ Declared in <%= declared_in %>
@@ -0,0 +1,28 @@
1
+
2
+ <%= hrule( name ) %>
3
+
4
+ <% unless specs.empty? %>
5
+ <% max = specs.keys.map {|s| s.length}.max %>
6
+ <% specs.each do |name,value| %>
7
+ <%= wrap(inline_title(name,value,max)) %>
8
+ <% end %>
9
+ <% end %>
10
+ <% unless overview.empty? %>
11
+ <%= hrule %>
12
+
13
+ <%= section_header( "Overview:" ) %>
14
+ <%= wrap(overview) %>
15
+ <% end %>
16
+
17
+ <%= hrule %>
18
+
19
+ <% unless data_types.empty? %>
20
+ <%= section_header( "Data Types:" ) %>
21
+ <%= Bri::Renderer.wrap_list( data_types.sort ) %>
22
+
23
+
24
+ <% end %>
25
+ <% unless result_codes.empty? %>
26
+ <%= section_header( "Result Codes:" ) %>
27
+ <%= Bri::Renderer.wrap_list( result_codes.sort ) %>
28
+ <% end %>
data/views/method.erb ADDED
@@ -0,0 +1,34 @@
1
+
2
+ <%= hrule( type + ": " + name ) %>
3
+ <%= print_origin( origin ) %>
4
+
5
+
6
+ <%= Cocoadex.trailing_indent(Bri::Renderer.wrap_row(declaration, Cocoadex.width), 2, 6) %>
7
+
8
+ <% if return_value %>
9
+
10
+ <%= wrap('Returns: ' + return_value) %>
11
+ <% end %>
12
+
13
+ <%= hrule %>
14
+ <% if abstract.empty? %>
15
+ (no description...)
16
+ <% else %>
17
+ <%= wrap(abstract) %>
18
+ <% end %>
19
+
20
+ <% unless parameters.empty? %>
21
+ <%= section_header( "Parameters:" ) %>
22
+ <% parameters.each do |param| %>
23
+
24
+ <%= h3(Cocoadex.indent(param.name, 2)).strip %>
25
+
26
+ <% wrap(param.description).split("\n").each do |line| %>
27
+ <%= Cocoadex.indent(line, 4) %>
28
+
29
+ <% end %>
30
+ <% end %>
31
+
32
+
33
+ <% end %>
34
+ <%= availability %>
@@ -0,0 +1,4 @@
1
+
2
+ <%= Bri::Templates::Helpers.hrule("Multiple choices:") %>
3
+
4
+ <%= Bri::Renderer.wrap_list( objects.sort ) %>
@@ -0,0 +1,14 @@
1
+
2
+ <%= hrule( "Property: "+ name ) %>
3
+ <%= print_origin( origin ) %>
4
+
5
+
6
+ <%= Bri::Renderer.wrap_row(declaration, Cocoadex.width) %>
7
+ <%= hrule %>
8
+ <% if abstract.empty? %>
9
+ (no description...)
10
+ <% else %>
11
+ <%= wrap(abstract) %>
12
+ <% end %>
13
+
14
+ <%= availability %>
@@ -0,0 +1,7 @@
1
+
2
+ <%= hrule( "Result Code: " + name ) %>
3
+ <%= print_origin( origin ) %>
4
+
5
+ <%= inline_title("Value", value) %>
6
+ <%= hrule %>
7
+ <%= wrap(description) %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoadex
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.4'
4
+ version: '1.5'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-23 00:00:00.000000000 Z
12
+ date: 2012-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -75,6 +75,22 @@ dependencies:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
77
  version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: ruby-progressbar
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :runtime
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
78
94
  - !ruby/object:Gem::Dependency
79
95
  name: bri
80
96
  requirement: !ruby/object:Gem::Requirement
@@ -107,12 +123,12 @@ dependencies:
107
123
  - - ! '>='
108
124
  - !ruby/object:Gem::Version
109
125
  version: '0'
110
- description: A command-line class reference utility Cocoa APIs
126
+ description: CLI for Cocoa documentation reference
111
127
  email:
112
128
  - iskanamagus@gmail.com
113
129
  executables:
114
130
  - cocoadex
115
- - cocoadex_completion.sh
131
+ - cdex_completion
116
132
  extensions: []
117
133
  extra_rdoc_files:
118
134
  - readme.md
@@ -124,21 +140,45 @@ files:
124
140
  - changelog.md
125
141
  - readme.md
126
142
  - bin/cocoadex
127
- - bin/cocoadex_completion.sh
143
+ - bin/cdex_completion
128
144
  - lib/cocoadex.rb
129
145
  - lib/cocoadex/docset_helper.rb
146
+ - lib/cocoadex/extensions.rb
130
147
  - lib/cocoadex/keyword.rb
131
- - lib/cocoadex/parser.rb
132
- - lib/cocoadex/serializer.rb
133
- - lib/cocoadex/templates.rb
134
- - lib/cocoadex/version.rb
148
+ - lib/cocoadex/model.rb
149
+ - lib/cocoadex/models/callback.rb
135
150
  - lib/cocoadex/models/class.rb
151
+ - lib/cocoadex/models/constant.rb
152
+ - lib/cocoadex/models/data_type.rb
136
153
  - lib/cocoadex/models/docset.rb
137
154
  - lib/cocoadex/models/element.rb
138
155
  - lib/cocoadex/models/entity.rb
156
+ - lib/cocoadex/models/function.rb
157
+ - lib/cocoadex/models/generic_ref.rb
139
158
  - lib/cocoadex/models/method.rb
159
+ - lib/cocoadex/models/nested_node_element.rb
160
+ - lib/cocoadex/models/parameter.rb
140
161
  - lib/cocoadex/models/property.rb
162
+ - lib/cocoadex/models/result_code.rb
163
+ - lib/cocoadex/models/seq_node_element.rb
164
+ - lib/cocoadex/parser.rb
165
+ - lib/cocoadex/serializer.rb
166
+ - lib/cocoadex/tokenizer.rb
167
+ - lib/cocoadex/tools/completion_helper.rb
168
+ - lib/cocoadex/version.rb
169
+ - lib/ext/xml_element.rb
141
170
  - lib/ext/nil.rb
171
+ - lib/ext/string.rb
172
+ - lib/ext/template_helpers.rb
173
+ - views/class.erb
174
+ - views/constant.erb
175
+ - views/constant_group.erb
176
+ - views/data_type.erb
177
+ - views/generic_ref.erb
178
+ - views/method.erb
179
+ - views/multiple.erb
180
+ - views/property.erb
181
+ - views/result_code.erb
142
182
  homepage: http://kattrali.github.com/cocoadex
143
183
  licenses: []
144
184
  post_install_message:
@@ -162,5 +202,5 @@ rubyforge_project:
162
202
  rubygems_version: 1.8.24
163
203
  signing_key:
164
204
  specification_version: 3
165
- summary: A command-line class reference utility for Cocoa APIs, based on RI.
205
+ summary: A command-line class reference utility for Cocoa APIs, inspired by RI.
166
206
  test_files: []
@@ -1,36 +0,0 @@
1
- #!/usr/bin/env sh
2
- #
3
- # cocoadex_completion.sh
4
- #
5
- # Bash completion for Cocoa classes
6
- # Install by adding the following to your .bash_profile:
7
- #
8
- # complete -C /path/to/cocoadex_completion.sh -o default cocoadex
9
-
10
- /usr/bin/env ruby <<-EORUBY
11
-
12
- require 'cocoadex'
13
-
14
- class TagCompletion
15
- def initialize(command)
16
- @command = command
17
- end
18
-
19
- def matches
20
- tags.select do |tag|
21
- tag[0, typed.length] == typed
22
- end
23
- end
24
-
25
- def typed
26
- @command[/\s(.+?)$/, 1] || ''
27
- end
28
-
29
- def tags
30
- @tags ||= Cocoadex::Keyword.tags
31
- end
32
- end
33
-
34
- puts TagCompletion.new(ENV["COMP_LINE"]).matches
35
-
36
- EORUBY
@@ -1,114 +0,0 @@
1
- module Cocoadex
2
- module Templates
3
- MULTIPLE_CHOICES =<<-EOT
4
- <%= Bri::Templates::Helpers.hrule("Multiple choices:") %>
5
-
6
- <%= Bri::Renderer.wrap_list( objects.sort ) %>
7
-
8
- EOT
9
-
10
- CLASS_DESCRIPTION =<<-EOT
11
-
12
- <%= hrule( type + ": " + name ) %>
13
- <%= print_origin( origin ) %>
14
-
15
- <% if description.empty? %>
16
- (no description...)
17
- <% else %>
18
- <%= '\n' + description %>
19
- <% end %>
20
- <% unless overview.empty? %>
21
- <%= hrule %>
22
-
23
- <%= section_header( "Overview:" ) %>
24
- <%= Bri::Renderer.wrap_row(overview.join('\n\n'), Cocoadex.width) %>
25
- <% end %>
26
-
27
- <%= hrule %>
28
-
29
- <% unless class_methods.empty? %>
30
- <%= section_header( "Class methods:" ) %>
31
- <%= Bri::Renderer.wrap_list( class_methods.sort ) %>
32
-
33
-
34
- <% end %>
35
- <% unless instance_methods.empty? %>
36
- <%= section_header( "Instance methods:" ) %>
37
- <%= Bri::Renderer.wrap_list( instance_methods.sort ) %>
38
-
39
-
40
- <% end %>
41
- <% unless properties.empty? %>
42
- <%= section_header( "Properties:" ) %>
43
- <%= Bri::Renderer.wrap_list( properties.sort ) %>
44
-
45
-
46
- <% end %>
47
- EOT
48
-
49
- METHOD_DESCRIPTION =<<-EOT
50
-
51
- <%= hrule( name ) %>
52
- <%= print_origin( origin ) %>
53
-
54
-
55
- <%= Cocoadex.trailing_indent(Bri::Renderer.wrap_row(declaration, Cocoadex.width), 2, 6) %>
56
-
57
- <% if return_value %>
58
-
59
- <%= 'Returns: ' + return_value %>
60
- <% end %>
61
-
62
- <%= hrule %>
63
- <% if abstract.empty? %>
64
- (no description...)
65
- <% else %>
66
- <%= Bri::Renderer.wrap_row(abstract, Cocoadex.width) %>
67
- <% end %>
68
-
69
- <% unless parameters.empty? %>
70
- <%= section_header( "Parameters:" ) %>
71
- <% parameters.each do |param| %>
72
-
73
- <%= h3(Cocoadex.indent(param.name, 2)).strip %>
74
- <% Bri::Renderer.wrap_row(param.description, Cocoadex.width).split('\n').each do |line| %>
75
- <%= Cocoadex.indent(line, 4) %>
76
- <% end %>
77
- <% end %>
78
-
79
-
80
- <% end %>
81
- <%= availability %>
82
-
83
- EOT
84
-
85
- PROPERTY_DESCRIPTION =<<-EOT
86
-
87
- <%= hrule( name ) %>
88
- <%= print_origin( origin ) %>
89
-
90
-
91
- <%= Bri::Renderer.wrap_row(declaration, Cocoadex.width) %>
92
- <%= hrule %>
93
- <% if abstract.empty? %>
94
- (no description...)
95
- <% else %>
96
- <%= Bri::Renderer.wrap_row(abstract, Cocoadex.width) %>
97
- <% end %>
98
-
99
- <%= availability %>
100
-
101
- EOT
102
- end
103
- end
104
-
105
- module Bri
106
- module Templates
107
- module Helpers
108
- def h3 text
109
- Term::ANSIColor::blue + text + Term::ANSIColor::reset + "\n"
110
- end
111
- module_function :h3
112
- end
113
- end
114
- end