yard-activerecord 0.0.16 → 0.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ce1db786348b51e85e357b31487d36444c7698e2
4
- data.tar.gz: d5307399e1e1dfbf9bc97585d17a29f841e7dbdf
2
+ SHA256:
3
+ metadata.gz: 5922364f8b340eeb98fa3972a296c1b5d30947357821ebf207202593fdc56680
4
+ data.tar.gz: 9af8148276017c2e99c64ef58313d8f6d07f0f1d74b81d6c77ce54c85a53f7bd
5
5
  SHA512:
6
- metadata.gz: e7de3184c5c426c862c96d7036a01f97fbaa0ff8c96c6dfd297af72122d5b321518e3f5b5368e45557f8ba2cbdefc9d77a52788d1900e9b8ff2f6d111fc9bb42
7
- data.tar.gz: c534cc07d496d8833d9ad9997d55e9e6226e1c38cc91c128110176102fbcba76c1aa70f9344a391adc4b5ab5bc30a086e9bcfba49aaf7d343551e9a018754dd7
6
+ metadata.gz: 6cb4639713dff2aed78a79a1c1bc1accb3293565c9f1e02a2f5b2d18b4d9fd4c326defaf9db88db6fd2f4e8b77b0e302daf7058456903a05978e9f7b29e4b86b
7
+ data.tar.gz: c6158c7462a870852791d68ebaea32b6d40fc10e52f3756b3f287fa5f49f75ebd49be517984a419191a91fe137ef7f70d8d75bee44668cc2b9bafaf89ee500dd
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2013-2016 Theodor Tonum
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
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. It only handles
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
- * [https://github.com/ogeidix/yard-rails-plugin](https://github.com/ogeidix/yard-rails-plugin)
98
-
77
+ - [https://github.com/ogeidix/yard-rails-plugin](https://github.com/ogeidix/yard-rails-plugin)
@@ -1,5 +1,4 @@
1
1
  require 'yard'
2
- require 'active_support/inflector'
3
2
 
4
3
  module YARD::Handlers::Ruby::ActiveRecord::Associations
5
4
  class Base < YARD::Handlers::Ruby::MethodHandler
@@ -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
- unless prefix_name.length == 0
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
- globals.klass = ActiveSupport::Inflector.singularize call_params.first.camelize
11
- if P(globals.klass).class == YARD::CodeObjects::Proxy
12
- # Try module with the first part
13
- globals.klass = globals.klass.underscore.split('_',2).map(&:camelize).join('::')
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
@@ -1,6 +1,3 @@
1
- require 'active_support/inflector'
2
- require 'active_support/core_ext/array'
3
-
4
1
  module YARD::Handlers::Ruby::ActiveRecord::Validate
5
2
 
6
3
  # Links with a value of nil will be link to
@@ -1,5 +1,5 @@
1
1
  module YARD
2
2
  module ActiveRecord
3
- VERSION = "0.0.16"
3
+ VERSION = "0.0.17"
4
4
  end
5
5
  end
@@ -1,4 +1,7 @@
1
1
  require 'yard'
2
+ require 'active_support'
3
+ require 'active_support/inflector'
4
+ require 'active_support/core_ext/array'
2
5
 
3
6
  module YARD::Handlers::Ruby::ActiveRecord
4
7
  end
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.16
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: 2016-01-11 00:00:00.000000000 Z
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 License
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
- rubyforge_project:
97
- rubygems_version: 2.2.2
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
@@ -1,6 +0,0 @@
1
- *.gem
2
- .bundle
3
- Gemfile.lock
4
- pkg/*
5
-
6
- .DS_Store
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.1.5
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- # Specify your gem's dependencies in yard-activerecord.gemspec
4
- gemspec
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require 'bundler/gem_tasks'
data/test.rb DELETED
@@ -1,4 +0,0 @@
1
- require 'bundler/setup'
2
- require 'yard-activerecord'
3
-
4
- YARD::Handlers::Ruby::ActiveRecord::Fields::CreateTable.new
@@ -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