yard-gobject 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2010 Stojan Dimitrovski
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the
9
+ Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ OTHER DEALINGS IN THE SOFTWARE.
23
+
data/Manifest ADDED
@@ -0,0 +1,8 @@
1
+ LICENSE.txt
2
+ README.md
3
+ Rakefile
4
+ templates/default/fulldoc/html/css/common.css
5
+ templates/default/tags/html/properties.erb
6
+ templates/default/tags/setup.rb
7
+ yard-gobject.rb
8
+ Manifest
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ YARD GObject Plugin
2
+ ===================
3
+
4
+ This is a YARD plugin that assists in the documentation of Ruby bindings that make use of GObject, i.e. the Ruby-GNOME2 bindings.
5
+
6
+ Features
7
+ --------
8
+
9
+ For now, it supports only one tag: <code>@properties</code>. This tag can be applied to any Class (<code>G_DEF_CLASS</code> macros), or Module (<code>G_DEF_INTERFACE</code> macros). It provides meta-data for the various GObject properties belonging to a GObject Class or GObject Interface.
10
+
11
+ **Syntax**
12
+
13
+ # @properties property-name [PropertyType] description,
14
+ # another-property [PropertyType] description...
15
+
16
+ <code>PropertyType</code> is formatted the same way YARD formats types. <code>description</code> can be ommited.
17
+
18
+ License
19
+ -------
20
+
21
+ This plugin is Copyright © 2010 Stojan Dimitrovski, licensed under the MIT License. See the LICENSE.txt file included in this distribution for more information.
22
+
23
+ References
24
+ ----------
25
+
26
+ * [Ruby-GNOME2](http://http://ruby-gnome2.sourceforge.jp/)
27
+ * [YARD](http://yardoc.org)
28
+
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'echoe'
2
+
3
+ Echoe.new("yard-gobject") do |s|
4
+ s.version = "0.0.1"
5
+ s.author = "Stojan Dimitrovski"
6
+ s.email = "sdimitrovski@gmail.com"
7
+ s.url = "http://theact1v8.org"
8
+ s.summary = "Aids in the documentation of Ruby Objects derived from GObject"
9
+ s.lib_files = FileList["templates/**/*", "yard-gobject.rb"].to_a
10
+ s.runtime_dependencies = ['yard >=0.5.2']
11
+ s.development_dependencies = []
12
+ end
13
+
@@ -0,0 +1,32 @@
1
+ .tags ul.gobject_properties {
2
+ list-style: none;
3
+ }
4
+
5
+ .tags ul.gobject_properties li {
6
+ margin-bottom: 14px;
7
+ }
8
+
9
+ .tags ul.gobject_properties li .name {
10
+ font-family: monospace;
11
+ font-size: 1em;
12
+ color: #609200;
13
+ background-color: #eaffd7;
14
+ padding: 1px 10px;
15
+ border: 1px solid #c9ff82;
16
+ border-radius: 3px;
17
+ -moz-border-radius: 3px;
18
+ -webkit-border-radius: 3px;
19
+ }
20
+
21
+ .tags ul.gobject_properties li .type {
22
+ font-family: monospace;
23
+ font-size: 1em;
24
+ color: gray;
25
+ }
26
+
27
+ .tags ul.gobject_properties li .description {
28
+ display: block;
29
+ margin: 0.45em auto auto 35px;
30
+ font-family: sans-serif;
31
+ }
32
+
@@ -0,0 +1,16 @@
1
+ <h2><%= @label ? @label : YARD::Tags::Library.labels[@name] %></h2>
2
+ <ul class="gobject_properties">
3
+ <% object.tags(@name).each do |tag| %>
4
+ <% props = format_gobject_properties(tag) %>
5
+ <% props.each do |prop| %>
6
+ <li>
7
+ <span class="name"><%= prop[:name] %></span>
8
+ <span class="type"><%= format_types prop[:type] %></span>
9
+ <% if !prop[:description].nil? and !prop[:description].empty? %>
10
+ <span class="description"><%= htmlify_line prop[:description] %></span>
11
+ <% end %>
12
+ </li>
13
+ <% end %>
14
+ <% end %>
15
+ </ul>
16
+
@@ -0,0 +1,20 @@
1
+ def init
2
+ super
3
+
4
+ sections.last.place(:properties).after(:return)
5
+ end
6
+
7
+ def tag(name, opts = {})
8
+ return unless object.has_tag?(name)
9
+ @no_names = true if opts[:no_names]
10
+ @no_types = true if opts[:no_types]
11
+ @name = name
12
+ out = erb(name.to_s)
13
+ @no_names, @no_types = nil, nil
14
+ out
15
+ end
16
+
17
+ def properties
18
+ tag :properties
19
+ end
20
+
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{yard-gobject}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Stojan Dimitrovski"]
9
+ s.date = %q{2009-12-31}
10
+ s.description = %q{Aids in the documentation of Ruby Objects derived from GObject}
11
+ s.email = %q{sdimitrovski@gmail.com}
12
+ s.extra_rdoc_files = ["LICENSE.txt", "README.md"]
13
+ s.files = ["LICENSE.txt", "README.md", "Rakefile", "templates/default/fulldoc/html/css/common.css", "templates/default/tags/html/properties.erb", "templates/default/tags/setup.rb", "yard-gobject.rb", "Manifest", "yard-gobject.gemspec"]
14
+ s.homepage = %q{http://theact1v8.org}
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Yard-gobject", "--main", "README.md"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = %q{yard-gobject}
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{Aids in the documentation of Ruby Objects derived from GObject}
20
+
21
+ if s.respond_to? :specification_version then
22
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
23
+ s.specification_version = 3
24
+
25
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
26
+ s.add_runtime_dependency(%q<yard>, [">= 0.5.2"])
27
+ else
28
+ s.add_dependency(%q<yard>, [">= 0.5.2"])
29
+ end
30
+ else
31
+ s.add_dependency(%q<yard>, [">= 0.5.2"])
32
+ end
33
+ end
data/yard-gobject.rb ADDED
@@ -0,0 +1,66 @@
1
+ #
2
+ # yard-gobject.rb
3
+ # This file is part of yard-gobject
4
+ #
5
+ # Copyright (C) 2009 - Stojan Dimitrovski
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person
8
+ # obtaining a copy of this software and associated documentation
9
+ # files (the "Software"), to deal in the Software without
10
+ # restriction, including without limitation the rights to use,
11
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the
13
+ # Software is furnished to do so, subject to the following
14
+ # conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21
+ # OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23
+ # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24
+ # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
+ # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26
+ # OTHER DEALINGS IN THE SOFTWARE.
27
+ #
28
+
29
+ require 'pathname'
30
+
31
+ template_dir = Pathname.new(File.dirname(__FILE__) + '/templates').realpath.to_s
32
+
33
+ YARD::Templates::Engine.register_template_path(template_dir)
34
+ puts YARD::Templates::Engine.template_paths.inspect
35
+
36
+ YARD::Tags::Library.define_tag("GObject Properties", :properties)
37
+
38
+ module YARD::Templates::Helpers::HtmlHelper
39
+ def format_gobject_properties(tag)
40
+ puts 'Here'
41
+ text = tag.text
42
+ # text = tag
43
+
44
+ text.gsub! /\n\r?\t?/, ''
45
+ text.gsub! /\ +/, ' '
46
+ text.gsub! /-/, '_'
47
+
48
+ unformatted_properties = text.split /,\ */
49
+ properties = []
50
+
51
+ unformatted_properties.each do |prop|
52
+ p = {:name => nil, :type => nil, :description => nil}
53
+ prop_regex = prop.match(/\A([\w\-]+) \[([\w\S ]+)\] *(.*)\z/)
54
+
55
+ unless prop_regex.nil?
56
+ p[:name], p[:type], p[:description] = prop_regex.captures
57
+ p[:type] = p[:type].split /,\ */
58
+ end
59
+
60
+ properties << p
61
+ end
62
+
63
+ return properties
64
+ end
65
+ end
66
+
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yard-gobject
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Stojan Dimitrovski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-31 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: yard
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.5.2
24
+ version:
25
+ description: Aids in the documentation of Ruby Objects derived from GObject
26
+ email: sdimitrovski@gmail.com
27
+ executables: []
28
+
29
+ extensions: []
30
+
31
+ extra_rdoc_files:
32
+ - LICENSE.txt
33
+ - README.md
34
+ files:
35
+ - LICENSE.txt
36
+ - README.md
37
+ - Rakefile
38
+ - templates/default/fulldoc/html/css/common.css
39
+ - templates/default/tags/html/properties.erb
40
+ - templates/default/tags/setup.rb
41
+ - yard-gobject.rb
42
+ - Manifest
43
+ - yard-gobject.gemspec
44
+ has_rdoc: true
45
+ homepage: http://theact1v8.org
46
+ licenses: []
47
+
48
+ post_install_message:
49
+ rdoc_options:
50
+ - --line-numbers
51
+ - --inline-source
52
+ - --title
53
+ - Yard-gobject
54
+ - --main
55
+ - README.md
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: "0"
63
+ version:
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: "1.2"
69
+ version:
70
+ requirements: []
71
+
72
+ rubyforge_project: yard-gobject
73
+ rubygems_version: 1.3.5
74
+ signing_key:
75
+ specification_version: 3
76
+ summary: Aids in the documentation of Ruby Objects derived from GObject
77
+ test_files: []
78
+