yard_dizby 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.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.rubocop.yml +47 -0
- data/Gemfile +13 -0
- data/Rakefile +17 -0
- data/lib/yard_dizby/config_access_handler.rb +94 -0
- data/lib/yard_dizby/rake_overload.rb +24 -0
- data/lib/yard_dizby/version.rb +8 -0
- data/lib/yard_dizby.rb +4 -0
- data/template/default/layout/html/footer.erb +3 -0
- data/yard_dizby.gemspec +25 -0
- metadata +83 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 38e0d02941eb44a86376a1556587a07f66b1ae9b
|
|
4
|
+
data.tar.gz: ee96e81c3e6371327971b6e2f12903fb00222f72
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 220eae725bebaa08c7d120be04dc0880687fc4d9335380baef8ac7fb3c97c9403d72eed844f25ee001147c873d604503d2f673105a811eadba28e870603f5103
|
|
7
|
+
data.tar.gz: 242ed88b762c79b649d859730831149c5db54faa10e6ae32f8c3b6596348c11446556ec49f445a490a604f08ae2753450b8132e5cacacde2d61f9665c76ba51b
|
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
|
|
3
|
+
Style/Documentation:
|
|
4
|
+
Enabled: false
|
|
5
|
+
|
|
6
|
+
Metrics/MethodLength:
|
|
7
|
+
Max: 12
|
|
8
|
+
|
|
9
|
+
Style/SpecialGlobalVars:
|
|
10
|
+
Enabled: false
|
|
11
|
+
|
|
12
|
+
Style/AutoResourceCleanup:
|
|
13
|
+
Enabled: true
|
|
14
|
+
|
|
15
|
+
Style/CollectionMethods:
|
|
16
|
+
Enabled: true
|
|
17
|
+
|
|
18
|
+
Style/Copyright:
|
|
19
|
+
Enabled: true
|
|
20
|
+
Notice: '^# Copyright \(c\) 2\d{3} .+$'
|
|
21
|
+
|
|
22
|
+
Style/Encoding:
|
|
23
|
+
Enabled: true
|
|
24
|
+
|
|
25
|
+
Style/MethodCalledOnDoEndBlock:
|
|
26
|
+
Enabled: true
|
|
27
|
+
|
|
28
|
+
Style/MultilineArrayBraceLayout:
|
|
29
|
+
Enabled: true
|
|
30
|
+
|
|
31
|
+
Style/MultilineAssignmentLayout:
|
|
32
|
+
Enabled: true
|
|
33
|
+
|
|
34
|
+
Style/OptionHash:
|
|
35
|
+
Enabled: true
|
|
36
|
+
|
|
37
|
+
Style/Send:
|
|
38
|
+
Enabled: true
|
|
39
|
+
|
|
40
|
+
Style/StringMethods:
|
|
41
|
+
Enabled: true
|
|
42
|
+
|
|
43
|
+
Style/SymbolArray:
|
|
44
|
+
Enabled: true
|
|
45
|
+
|
|
46
|
+
Lint/LiteralInInterpolation:
|
|
47
|
+
Enabled: true
|
data/Gemfile
ADDED
data/Rakefile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Copyright (c) 2016 Nathan Currier
|
|
3
|
+
|
|
4
|
+
require 'rubygems'
|
|
5
|
+
require 'bundler'
|
|
6
|
+
|
|
7
|
+
Bundler.setup(:default, :development)
|
|
8
|
+
|
|
9
|
+
require 'bundler/gem_tasks'
|
|
10
|
+
|
|
11
|
+
require 'rubocop/rake_task'
|
|
12
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
|
13
|
+
t.fail_on_error = false
|
|
14
|
+
end
|
|
15
|
+
task('rubocop:auto_correct').clear
|
|
16
|
+
|
|
17
|
+
task default: :rubocop
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Copyright (c) 2016 Nathan Currier
|
|
3
|
+
|
|
4
|
+
module YARD
|
|
5
|
+
module Dizby
|
|
6
|
+
class ConfigAccessHandler < ::YARD::Handlers::Ruby::AttributeHandler
|
|
7
|
+
handles method_call(:config_reader)
|
|
8
|
+
handles method_call(:config_writer)
|
|
9
|
+
handles method_call(:config_accessor)
|
|
10
|
+
namespace_only
|
|
11
|
+
|
|
12
|
+
def access_permissions
|
|
13
|
+
case statement.method_name(true)
|
|
14
|
+
when :config_reader
|
|
15
|
+
[true, false]
|
|
16
|
+
when :config_writer
|
|
17
|
+
[false, true]
|
|
18
|
+
when :config_accessor
|
|
19
|
+
[true, true]
|
|
20
|
+
else
|
|
21
|
+
[false, false]
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def process_impl(method, permission)
|
|
26
|
+
if permission
|
|
27
|
+
obj = MethodObject.new(namespace, method, scope)
|
|
28
|
+
yield obj
|
|
29
|
+
|
|
30
|
+
register(obj)
|
|
31
|
+
obj
|
|
32
|
+
else
|
|
33
|
+
namespace.children.find do |o|
|
|
34
|
+
o.name == method.to_sym && o.scope == scope
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def store_obj(type, name, obj)
|
|
40
|
+
namespace.attributes[scope][name][type] = obj if obj
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def signature(obj, sig, src)
|
|
44
|
+
obj.signature ||= sig
|
|
45
|
+
obj.source ||= "#{sig}\n#{src}"
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def process_reader(attribute, permission)
|
|
49
|
+
final =
|
|
50
|
+
process_impl(attribute, permission) do |obj|
|
|
51
|
+
signature(obj, "def #{attribute}", " @config[:#{attribute}]\nend")
|
|
52
|
+
if obj.docstring.blank?(false)
|
|
53
|
+
obj.docstring =
|
|
54
|
+
"Returns the value of configuration attribute #{attribute}"
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
store_obj :read, attribute, final
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def process_writer(attribute, permission)
|
|
62
|
+
final =
|
|
63
|
+
process_impl("#{attribute}=", permission) do |obj|
|
|
64
|
+
obj.parameters = [['value', nil]]
|
|
65
|
+
signature(obj, "def #{attribute}=(value)",
|
|
66
|
+
" @config[:#{attribute}] = value\nend")
|
|
67
|
+
obj.docstring = <<-eos if obj.docstring.blank?(false)
|
|
68
|
+
Sets the configuration attribute #{attribute}
|
|
69
|
+
@param value the value to set the attribute #{attribute} to.
|
|
70
|
+
eos
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
store_obj :write, attribute, final
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
def process_access(name)
|
|
77
|
+
read, write = access_permissions
|
|
78
|
+
namespace.attributes[scope][name] ||= SymbolHash[read: nil, write: nil]
|
|
79
|
+
|
|
80
|
+
process_reader(name, read)
|
|
81
|
+
process_writer(name, write)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def process
|
|
85
|
+
return if statement.type == :var_ref || statement.type == :vcall
|
|
86
|
+
params = statement.parameters(false).dup
|
|
87
|
+
|
|
88
|
+
validated_attribute_names(params).each do |name|
|
|
89
|
+
process_access(name)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
end
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Copyright (c) 2016 Nathan Currier
|
|
3
|
+
|
|
4
|
+
require 'yard'
|
|
5
|
+
require 'yard/rake/yardoc_task'
|
|
6
|
+
|
|
7
|
+
module YARD
|
|
8
|
+
module Dizby
|
|
9
|
+
def self.template_path
|
|
10
|
+
File.expand_path('../../template', File.dirname(__FILE__))
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
module DizbyYardocTaskExtension
|
|
16
|
+
def initialize(name = :yard)
|
|
17
|
+
super(name) do |task|
|
|
18
|
+
task.options += ['--template-path', YARD::Dizby.template_path]
|
|
19
|
+
yield task if block_given?
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
YARD::Rake::YardocTask.__send__(:prepend, DizbyYardocTaskExtension)
|
data/lib/yard_dizby.rb
ADDED
data/yard_dizby.gemspec
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# Copyright (c) 2016 Nathan Currier
|
|
3
|
+
|
|
4
|
+
require './lib/yard_dizby/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'yard_dizby'
|
|
8
|
+
spec.version = YARD::Dizby::VERSION
|
|
9
|
+
spec.authors = ['Nathan Currier']
|
|
10
|
+
spec.email = ['nathan.currier@gmail.com']
|
|
11
|
+
spec.license = 'BSD-3-clause'
|
|
12
|
+
|
|
13
|
+
spec.description = 'YARD plugin for Dizby'
|
|
14
|
+
spec.summary = 'YARD plugin to ease documenting Dizby'
|
|
15
|
+
spec.homepage = 'https://github.com/rideliner/yard_dizby'
|
|
16
|
+
|
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
|
18
|
+
spec.bindir = 'bin'
|
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
|
21
|
+
spec.require_paths = ['lib']
|
|
22
|
+
|
|
23
|
+
spec.add_dependency 'yard', '> 0.7'
|
|
24
|
+
spec.add_dependency 'bundler', '>= 1.11.2'
|
|
25
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: yard_dizby
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Nathan Currier
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
type: :runtime
|
|
15
|
+
name: yard
|
|
16
|
+
prerelease: false
|
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
|
18
|
+
requirements:
|
|
19
|
+
- - ">"
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: '0.7'
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '0.7'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
type: :runtime
|
|
29
|
+
name: bundler
|
|
30
|
+
prerelease: false
|
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
|
32
|
+
requirements:
|
|
33
|
+
- - ">="
|
|
34
|
+
- !ruby/object:Gem::Version
|
|
35
|
+
version: 1.11.2
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 1.11.2
|
|
41
|
+
description: YARD plugin for Dizby
|
|
42
|
+
email:
|
|
43
|
+
- nathan.currier@gmail.com
|
|
44
|
+
executables: []
|
|
45
|
+
extensions: []
|
|
46
|
+
extra_rdoc_files: []
|
|
47
|
+
files:
|
|
48
|
+
- ".gitignore"
|
|
49
|
+
- ".rubocop.yml"
|
|
50
|
+
- Gemfile
|
|
51
|
+
- Rakefile
|
|
52
|
+
- lib/yard_dizby.rb
|
|
53
|
+
- lib/yard_dizby/config_access_handler.rb
|
|
54
|
+
- lib/yard_dizby/rake_overload.rb
|
|
55
|
+
- lib/yard_dizby/version.rb
|
|
56
|
+
- template/default/layout/html/footer.erb
|
|
57
|
+
- yard_dizby.gemspec
|
|
58
|
+
homepage: https://github.com/rideliner/yard_dizby
|
|
59
|
+
licenses:
|
|
60
|
+
- BSD-3-clause
|
|
61
|
+
metadata: {}
|
|
62
|
+
post_install_message:
|
|
63
|
+
rdoc_options: []
|
|
64
|
+
require_paths:
|
|
65
|
+
- lib
|
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
67
|
+
requirements:
|
|
68
|
+
- - ">="
|
|
69
|
+
- !ruby/object:Gem::Version
|
|
70
|
+
version: '0'
|
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '0'
|
|
76
|
+
requirements: []
|
|
77
|
+
rubyforge_project:
|
|
78
|
+
rubygems_version: 2.4.8
|
|
79
|
+
signing_key:
|
|
80
|
+
specification_version: 4
|
|
81
|
+
summary: YARD plugin to ease documenting Dizby
|
|
82
|
+
test_files: []
|
|
83
|
+
has_rdoc:
|