yard-contextify 0.1.0
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.
- data/.gitignore +9 -0
- data/.specopts +1 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +5 -0
- data/LICENSE.txt +21 -0
- data/README.md +25 -0
- data/Rakefile +40 -0
- data/VERSION +1 -0
- data/lib/yard-contextify.rb +2 -0
- data/lib/yard-contextify/contextify_handler.rb +26 -0
- data/lib/yard-contextify/legacy.rb +1 -0
- data/lib/yard-contextify/legacy/contextify_handler.rb +24 -0
- data/spec/contextify_handler_spec.rb +29 -0
- data/spec/helpers/examples.rb +18 -0
- data/spec/helpers/examples/bad_contextify.rb.txt +7 -0
- data/spec/helpers/examples/simple_contextify.rb.txt +7 -0
- data/spec/spec_helper.rb +8 -0
- data/yard-contextify.gemspec +69 -0
- metadata +119 -0
data/.gitignore
ADDED
data/.specopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour --format specdoc
|
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--markup markdown --title 'YARD Contextify Documentation' --protected --files ChangeLog.md,LICENSE.txt
|
data/ChangeLog.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
Copyright (c) 2010 Hal Brodigan
|
3
|
+
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
a copy of this software and associated documentation files (the
|
6
|
+
"Software"), to deal in the Software without restriction, including
|
7
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
the following 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 OF
|
17
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# yard-contextify
|
2
|
+
|
3
|
+
* [github.com/postmodern/yard-contextify](http://github.com/postmodern/yard-contextify)
|
4
|
+
* [github.com/postmodern/yard-contextify/issues](http://github.com/postmodern/yard-contextify/issues)
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
yard-contextify is a plugin for YARD for parsing contextified classes.
|
9
|
+
|
10
|
+
## Features
|
11
|
+
|
12
|
+
* Parses `contextify :name` class method-calls.
|
13
|
+
|
14
|
+
## Requirements
|
15
|
+
|
16
|
+
* [yard](http://yardoc.org/) >= 0.4.0
|
17
|
+
|
18
|
+
## Install
|
19
|
+
|
20
|
+
$ sudo gem install yard-contextify
|
21
|
+
|
22
|
+
## Copyright
|
23
|
+
|
24
|
+
See {file:LICENSE.txt} for license information.
|
25
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "yard-contextify"
|
8
|
+
gem.license = 'MIT'
|
9
|
+
gem.summary = %Q{A plugin for YARD for parsing contextified classes.}
|
10
|
+
gem.description = %Q{yard-contextify is a plugin for YARD for parsing contextified classes.}
|
11
|
+
gem.email = "postmodern.mod3@gmail.com"
|
12
|
+
gem.homepage = "http://github.com/postmodern/yard-contextify"
|
13
|
+
gem.authors = ["postmodern"]
|
14
|
+
gem.add_dependency "yard", ">= 0.4.0"
|
15
|
+
gem.add_development_dependency "rspec", "~> 1.3.0"
|
16
|
+
gem.has_rdoc = 'yard'
|
17
|
+
end
|
18
|
+
Jeweler::GemcutterTasks.new
|
19
|
+
rescue LoadError
|
20
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
21
|
+
end
|
22
|
+
|
23
|
+
require 'spec/rake/spectask'
|
24
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
25
|
+
spec.libs += ['lib', 'spec']
|
26
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
+
spec.spec_opts = ['--options', '.specopts']
|
28
|
+
end
|
29
|
+
|
30
|
+
task :spec => :check_dependencies
|
31
|
+
task :default => :spec
|
32
|
+
|
33
|
+
begin
|
34
|
+
require 'yard'
|
35
|
+
YARD::Rake::YardocTask.new
|
36
|
+
rescue LoadError
|
37
|
+
task :yard do
|
38
|
+
abort "YARD is not available. In order to run yard, you must: gem install yard"
|
39
|
+
end
|
40
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module YARD
|
2
|
+
module Contextify
|
3
|
+
class ContextifyHandler < YARD::Handlers::Ruby::Base
|
4
|
+
|
5
|
+
handles method_call(:contextify)
|
6
|
+
|
7
|
+
def process
|
8
|
+
nobj = ModuleObject.new(:root, 'Kernel')
|
9
|
+
mscope = scope
|
10
|
+
name = statement.parameters[0].first
|
11
|
+
|
12
|
+
if name.type == :symbol
|
13
|
+
name = name.source[1..-1]
|
14
|
+
|
15
|
+
register MethodObject.new(nobj, name, :instance) do |o|
|
16
|
+
o.visibility = :public
|
17
|
+
o.source = statement.source
|
18
|
+
o.signature = "def #{name}"
|
19
|
+
o.parameters = [['*args', nil], ['&block', nil]]
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'yard-contextify/legacy/contextify_handler'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module YARD
|
2
|
+
module Contextify
|
3
|
+
module Legacy
|
4
|
+
class ContextifyHandler < YARD::Handlers::Ruby::Legacy::Base
|
5
|
+
|
6
|
+
handles /\Acontextify\s+:/
|
7
|
+
|
8
|
+
def process
|
9
|
+
nobj = ModuleObject.new(:root, 'Kernel')
|
10
|
+
mscope = scope
|
11
|
+
name = statement.tokens[2,1].to_s[1..-1]
|
12
|
+
|
13
|
+
register MethodObject.new(nobj, name, :instance) do |o|
|
14
|
+
o.visibility = :public
|
15
|
+
o.source = statement.source
|
16
|
+
o.signature = "def #{name}"
|
17
|
+
o.parameters = [['*args', nil], ['&block', nil]]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'helpers/examples'
|
3
|
+
|
4
|
+
require 'yard-contextify/contextify_handler'
|
5
|
+
require 'yard-contextify/legacy/contextify_handler'
|
6
|
+
|
7
|
+
describe "ContextifyHandler" do
|
8
|
+
include Helpers::Examples
|
9
|
+
|
10
|
+
context "valid" do
|
11
|
+
before(:all) do
|
12
|
+
parse_file :simple_contextify
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should register a Kernel method for the class" do
|
16
|
+
yard('Kernel#simple_context').should be_instance_of(CodeObjects::MethodObject)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
context "invalid" do
|
21
|
+
before(:all) do
|
22
|
+
parse_file :bad_contextify
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should not register a Kernel methods for variables" do
|
26
|
+
yard('Kenrel#contextify').should be_nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'yard'
|
2
|
+
|
3
|
+
module Helpers
|
4
|
+
module Examples
|
5
|
+
EXAMPLES_DIR = File.expand_path(File.join(File.dirname(__FILE__),'examples'))
|
6
|
+
|
7
|
+
def parse_file(file,thisfile=__FILE__)
|
8
|
+
YARD::Registry.clear
|
9
|
+
|
10
|
+
path = File.join(Helpers::Examples::EXAMPLES_DIR, "#{file}.rb.txt")
|
11
|
+
YARD::Parser::SourceParser.parse(path)
|
12
|
+
end
|
13
|
+
|
14
|
+
def yard(name)
|
15
|
+
YARD::Registry.at(name)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{yard-contextify}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["postmodern"]
|
12
|
+
s.date = %q{2010-05-23}
|
13
|
+
s.description = %q{yard-contextify is a plugin for YARD for parsing contextified classes.}
|
14
|
+
s.email = %q{postmodern.mod3@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"ChangeLog.md",
|
17
|
+
"LICENSE.txt",
|
18
|
+
"README.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
".gitignore",
|
22
|
+
".specopts",
|
23
|
+
".yardopts",
|
24
|
+
"ChangeLog.md",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.md",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"lib/yard-contextify.rb",
|
30
|
+
"lib/yard-contextify/contextify_handler.rb",
|
31
|
+
"lib/yard-contextify/legacy.rb",
|
32
|
+
"lib/yard-contextify/legacy/contextify_handler.rb",
|
33
|
+
"spec/contextify_handler_spec.rb",
|
34
|
+
"spec/helpers/examples.rb",
|
35
|
+
"spec/helpers/examples/bad_contextify.rb.txt",
|
36
|
+
"spec/helpers/examples/simple_contextify.rb.txt",
|
37
|
+
"spec/spec_helper.rb",
|
38
|
+
"yard-contextify.gemspec"
|
39
|
+
]
|
40
|
+
s.has_rdoc = %q{yard}
|
41
|
+
s.homepage = %q{http://github.com/postmodern/yard-contextify}
|
42
|
+
s.licenses = ["MIT"]
|
43
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubygems_version = %q{1.3.7}
|
46
|
+
s.summary = %q{A plugin for YARD for parsing contextified classes.}
|
47
|
+
s.test_files = [
|
48
|
+
"spec/spec_helper.rb",
|
49
|
+
"spec/contextify_handler_spec.rb",
|
50
|
+
"spec/helpers/examples.rb"
|
51
|
+
]
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
+
s.specification_version = 3
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
|
+
s.add_runtime_dependency(%q<yard>, [">= 0.4.0"])
|
59
|
+
s.add_development_dependency(%q<rspec>, ["~> 1.3.0"])
|
60
|
+
else
|
61
|
+
s.add_dependency(%q<yard>, [">= 0.4.0"])
|
62
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
63
|
+
end
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<yard>, [">= 0.4.0"])
|
66
|
+
s.add_dependency(%q<rspec>, ["~> 1.3.0"])
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yard-contextify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- postmodern
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-05-23 00:00:00 -07:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: yard
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 4
|
33
|
+
- 0
|
34
|
+
version: 0.4.0
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 27
|
46
|
+
segments:
|
47
|
+
- 1
|
48
|
+
- 3
|
49
|
+
- 0
|
50
|
+
version: 1.3.0
|
51
|
+
type: :development
|
52
|
+
version_requirements: *id002
|
53
|
+
description: yard-contextify is a plugin for YARD for parsing contextified classes.
|
54
|
+
email: postmodern.mod3@gmail.com
|
55
|
+
executables: []
|
56
|
+
|
57
|
+
extensions: []
|
58
|
+
|
59
|
+
extra_rdoc_files:
|
60
|
+
- ChangeLog.md
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.md
|
63
|
+
files:
|
64
|
+
- .gitignore
|
65
|
+
- .specopts
|
66
|
+
- .yardopts
|
67
|
+
- ChangeLog.md
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- VERSION
|
72
|
+
- lib/yard-contextify.rb
|
73
|
+
- lib/yard-contextify/contextify_handler.rb
|
74
|
+
- lib/yard-contextify/legacy.rb
|
75
|
+
- lib/yard-contextify/legacy/contextify_handler.rb
|
76
|
+
- spec/contextify_handler_spec.rb
|
77
|
+
- spec/helpers/examples.rb
|
78
|
+
- spec/helpers/examples/bad_contextify.rb.txt
|
79
|
+
- spec/helpers/examples/simple_contextify.rb.txt
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
- yard-contextify.gemspec
|
82
|
+
has_rdoc: yard
|
83
|
+
homepage: http://github.com/postmodern/yard-contextify
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
post_install_message:
|
87
|
+
rdoc_options:
|
88
|
+
- --charset=UTF-8
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
none: false
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
hash: 3
|
97
|
+
segments:
|
98
|
+
- 0
|
99
|
+
version: "0"
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
hash: 3
|
106
|
+
segments:
|
107
|
+
- 0
|
108
|
+
version: "0"
|
109
|
+
requirements: []
|
110
|
+
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 1.3.7
|
113
|
+
signing_key:
|
114
|
+
specification_version: 3
|
115
|
+
summary: A plugin for YARD for parsing contextified classes.
|
116
|
+
test_files:
|
117
|
+
- spec/spec_helper.rb
|
118
|
+
- spec/contextify_handler_spec.rb
|
119
|
+
- spec/helpers/examples.rb
|