yard-activerecord 0.0.15 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +2 -2
- data/README.md +3 -24
- data/lib/yard-activerecord/associations/base.rb +0 -1
- data/lib/yard-activerecord/delegations/delegate_handler.rb +1 -1
- data/lib/yard-activerecord/fields/create_table_handler.rb +10 -7
- data/lib/yard-activerecord/fields/field_handler.rb +2 -0
- data/lib/yard-activerecord/scopes/scope_handler.rb +4 -6
- data/lib/yard-activerecord/validations/validates_handler.rb +0 -3
- data/lib/yard-activerecord/version.rb +1 -1
- data/lib/yard-activerecord.rb +3 -0
- metadata +21 -15
- data/.gitignore +0 -6
- data/.ruby-version +0 -1
- data/Gemfile +0 -4
- data/Rakefile +0 -1
- data/test.rb +0 -4
- data/yard-activerecord.gemspec +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 5922364f8b340eeb98fa3972a296c1b5d30947357821ebf207202593fdc56680
|
4
|
+
data.tar.gz: 9af8148276017c2e99c64ef58313d8f6d07f0f1d74b81d6c77ce54c85a53f7bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6cb4639713dff2aed78a79a1c1bc1accb3293565c9f1e02a2f5b2d18b4d9fd4c326defaf9db88db6fd2f4e8b77b0e302daf7058456903a05978e9f7b29e4b86b
|
7
|
+
data.tar.gz: c6158c7462a870852791d68ebaea32b6d40fc10e52f3756b3f287fa5f49f75ebd49be517984a419191a91fe137ef7f70d8d75bee44668cc2b9bafaf89ee500dd
|
data/LICENSE
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
Copyright (C)
|
1
|
+
Copyright (C) Theodor Tonum
|
2
2
|
|
3
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
4
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
16
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
17
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
18
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
19
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -9,7 +9,6 @@ applications with ActiveRecord. The extension handles attributes,
|
|
9
9
|
associations, delegates and scopes. A must for any Rails app using YARD as
|
10
10
|
documentation plugin.
|
11
11
|
|
12
|
-
|
13
12
|
## Installation
|
14
13
|
|
15
14
|
Run the following command in order to load YARD plugins:
|
@@ -41,25 +40,6 @@ handling of `attr_accessible` at a later point.
|
|
41
40
|
Please note that any reference-fields that ends with `_id` will not be handled
|
42
41
|
as an attribute. Please see Associations.
|
43
42
|
|
44
|
-
There is an issue with namespaced classes. Currently this plugin will try and
|
45
|
-
fetch a class with a namespace if it does not find one at the first try.
|
46
|
-
|
47
|
-
Example:
|
48
|
-
|
49
|
-
Table name Class name
|
50
|
-
sales_people SalesPeople # does not exist
|
51
|
-
sales_people Sales::People # does exist
|
52
|
-
|
53
|
-
A problem then emerges if you have namespaces with two names.
|
54
|
-
|
55
|
-
Example:
|
56
|
-
|
57
|
-
Table name Class name
|
58
|
-
sales_force_people SalesForcePeople # does not exist
|
59
|
-
sales_force_people Sales::ForcePeople # does not exist
|
60
|
-
|
61
|
-
The documentation will then be skipped for this table/class.
|
62
|
-
|
63
43
|
## Associations
|
64
44
|
|
65
45
|
The plugin handles `has_one`, `belongs_to`, `has_many` and
|
@@ -77,9 +57,9 @@ methods simply as aliases for the associated object.
|
|
77
57
|
The plugin will add class methods for any scopes you have defined in your
|
78
58
|
models.
|
79
59
|
|
80
|
-
## Validations
|
60
|
+
## Validations
|
81
61
|
|
82
|
-
The plugin will add information about validations onto each field.
|
62
|
+
The plugin will add information about validations onto each field. It only handles
|
83
63
|
the new style validations in the form of:
|
84
64
|
|
85
65
|
validates :foo, :presence=>true, :length=>{ is: 6 }
|
@@ -94,5 +74,4 @@ are not supported.
|
|
94
74
|
|
95
75
|
Check out:
|
96
76
|
|
97
|
-
|
98
|
-
|
77
|
+
- [https://github.com/ogeidix/yard-rails-plugin](https://github.com/ogeidix/yard-rails-plugin)
|
@@ -22,7 +22,7 @@ module YARD::Handlers::Ruby::ActiveRecord::Delegations
|
|
22
22
|
method_name.gsub!(/[\:\'\"]/,'')
|
23
23
|
original_method_name = method_name.dup
|
24
24
|
|
25
|
-
|
25
|
+
if prefix_name&.length&.> 0
|
26
26
|
prefix_name = class_name.downcase if prefix_name == 'true'
|
27
27
|
method_name.prepend("#{prefix_name}_")
|
28
28
|
end
|
@@ -1,19 +1,22 @@
|
|
1
1
|
require 'yard'
|
2
|
-
require 'active_support/inflector'
|
3
2
|
|
4
3
|
module YARD::Handlers::Ruby::ActiveRecord::Fields
|
5
4
|
class CreateTableHandler < YARD::Handlers::Ruby::MethodHandler
|
6
5
|
handles method_call(:create_table)
|
7
|
-
|
8
6
|
def process
|
9
7
|
return unless globals.ar_schema
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
table_name = call_params.first
|
9
|
+
class_name_regex = table_name.
|
10
|
+
singularize.
|
11
|
+
split('_').
|
12
|
+
map(&:camelize).
|
13
|
+
join('(::|_)?')
|
14
|
+
regex = Regexp.new("#{class_name_regex}$")
|
15
|
+
globals.klass = YARD::Registry.all(:class).find do |co|
|
16
|
+
regex.match(co.path)
|
14
17
|
end
|
15
18
|
parse_block(statement.last.last)
|
16
19
|
globals.klass = nil
|
17
20
|
end
|
18
21
|
end
|
19
|
-
end
|
22
|
+
end
|
@@ -1,10 +1,8 @@
|
|
1
|
-
require 'active_support/inflector'
|
2
|
-
|
3
1
|
module YARD::Handlers::Ruby::ActiveRecord::Scopes
|
4
2
|
class ScopeHandler < YARD::Handlers::Ruby::MethodHandler
|
5
3
|
handles method_call(:scope)
|
6
4
|
namespace_only
|
7
|
-
|
5
|
+
|
8
6
|
def process
|
9
7
|
object = register YARD::CodeObjects::MethodObject.new(namespace, method_name, :class)
|
10
8
|
object.docstring = return_description
|
@@ -12,18 +10,18 @@ module YARD::Handlers::Ruby::ActiveRecord::Scopes
|
|
12
10
|
object.docstring.add_tag get_tag(:see,"ActiveRecord::Scoping", nil,
|
13
11
|
'http://api.rubyonrails.org/classes/ActiveRecord/Scoping/Named/ClassMethods.html')
|
14
12
|
end
|
15
|
-
|
13
|
+
|
16
14
|
private
|
17
15
|
def method_name
|
18
16
|
call_params[0]
|
19
17
|
end
|
20
|
-
|
18
|
+
|
21
19
|
def return_description
|
22
20
|
"A relation of #{ActiveSupport::Inflector.pluralize namespace.to_s} " +
|
23
21
|
"that are #{method_name.split('_').join(' ')}. " +
|
24
22
|
"<strong>Active Record Scope</strong>"
|
25
23
|
end
|
26
|
-
|
24
|
+
|
27
25
|
def class_name
|
28
26
|
"ActiveRecord::Relation<#{namespace}>"
|
29
27
|
end
|
data/lib/yard-activerecord.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yard-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Theodor Tonum
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.8.3
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activesupport
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -48,12 +62,8 @@ executables: []
|
|
48
62
|
extensions: []
|
49
63
|
extra_rdoc_files: []
|
50
64
|
files:
|
51
|
-
- ".gitignore"
|
52
|
-
- ".ruby-version"
|
53
|
-
- Gemfile
|
54
65
|
- LICENSE
|
55
66
|
- README.md
|
56
|
-
- Rakefile
|
57
67
|
- lib/yard-activerecord.rb
|
58
68
|
- lib/yard-activerecord/associations/base.rb
|
59
69
|
- lib/yard-activerecord/associations/belongs_to_handler.rb
|
@@ -72,13 +82,11 @@ files:
|
|
72
82
|
- templates/default/tags/html/validations.erb
|
73
83
|
- templates/default/tags/setup.rb
|
74
84
|
- templates/default/tags/text/validations.erb
|
75
|
-
- test.rb
|
76
|
-
- yard-activerecord.gemspec
|
77
85
|
homepage: https://github.com/theodorton/yard-activerecord
|
78
86
|
licenses:
|
79
|
-
- MIT
|
87
|
+
- MIT
|
80
88
|
metadata: {}
|
81
|
-
post_install_message:
|
89
|
+
post_install_message:
|
82
90
|
rdoc_options: []
|
83
91
|
require_paths:
|
84
92
|
- lib
|
@@ -93,10 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
101
|
- !ruby/object:Gem::Version
|
94
102
|
version: '0'
|
95
103
|
requirements: []
|
96
|
-
|
97
|
-
|
98
|
-
signing_key:
|
104
|
+
rubygems_version: 3.4.10
|
105
|
+
signing_key:
|
99
106
|
specification_version: 4
|
100
107
|
summary: ActiveRecord Handlers for YARD
|
101
108
|
test_files: []
|
102
|
-
has_rdoc:
|
data/.gitignore
DELETED
data/.ruby-version
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.1.5
|
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
data/test.rb
DELETED
data/yard-activerecord.gemspec
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
$:.push File.expand_path("../lib", __FILE__)
|
3
|
-
|
4
|
-
require "yard-activerecord/version"
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "yard-activerecord"
|
8
|
-
s.version = YARD::ActiveRecord::VERSION
|
9
|
-
s.authors = ["Theodor Tonum"]
|
10
|
-
s.email = ["theodor@tonum.no"]
|
11
|
-
s.homepage = "https://github.com/theodorton/yard-activerecord"
|
12
|
-
s.summary = %q{ActiveRecord Handlers for YARD}
|
13
|
-
s.description = %q{
|
14
|
-
YARD-Activerecord is a YARD extension that handles and interprets methods
|
15
|
-
used when developing applications with ActiveRecord. The extension handles
|
16
|
-
attributes, associations, delegates and scopes. A must for any Rails app
|
17
|
-
using YARD as documentation plugin. }
|
18
|
-
s.licenses = ["MIT License"]
|
19
|
-
|
20
|
-
s.add_dependency 'yard', '>= 0.8.3'
|
21
|
-
|
22
|
-
s.add_development_dependency 'rspec'
|
23
|
-
|
24
|
-
s.files = `git ls-files`.split("\n")
|
25
|
-
s.require_path = "lib"
|
26
|
-
end
|