yard-mongoid 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d87056112075d7dbdd92fb12adeef56d88794bc2
4
+ data.tar.gz: 57b081ecc357b9acafc0de8e6c2ebc3e78fefb1e
5
+ SHA512:
6
+ metadata.gz: d12700f677cbe7e4d78d8450df5ff87a816231ee58a9d3aa552f9df00de252a1d572db78b26884661ee9ada767abb52018e116145040c83a050948b7ee84127b
7
+ data.tar.gz: 14efe78f104eccf5247bd9a4761a3c2e3caf98eeb9ba3440066ee3cd6b38ec839dc9441d9c54b0593f100fb077591a02f3f4f5114a2cb6aa825a21b52045907d
data/.gitignore CHANGED
@@ -2,3 +2,5 @@ pkg/*
2
2
  *.gem
3
3
  .bundle
4
4
  Gemfile.lock
5
+ .ruby-version
6
+ .idea
data/Gemfile CHANGED
@@ -2,12 +2,3 @@ source 'http://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in yard-mongoid.gemspec
4
4
  gemspec
5
-
6
- group :development do
7
- gem 'rake'
8
- gem 'mongoid', '~> 3.0'
9
- gem 'yard-activerecord' # Needed for some code examples
10
- gem 'yard-activerecord2' # Needed for some code examples
11
- gem 'yard-rails' # Needed for some code examples
12
- gem 'yard-delegate' # Needed for some code examples
13
- end
@@ -0,0 +1,58 @@
1
+ # YARD::Mongoid
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/yard-mongoid.svg)][gem]
4
+ [![Build Status](https://secure.travis-ci.org/alsemyonov/yard-mongoid.svg?branch=master)][travis]
5
+ [![Dependency Status](https://gemnasium.com/alsemyonov/yard-mongoid.svg)][gemnasium]
6
+ [![Code Climate](https://codeclimate.com/github/alsemyonov/yard-mongoid/badges/gpa.svg)][codeclimate]
7
+ [![Test Coverage](https://codeclimate.com/github/alsemyonov/yard-mongoid/badges/coverage.svg)][coverage]
8
+
9
+ A [YARD](https://rubygems.org/gems/yard) plugin for documenting [Mongoid](https://rubygems.org/gems/mongoid) models.
10
+
11
+ ## Installation
12
+
13
+ Add this line to your application's Gemfile:
14
+
15
+ ```ruby
16
+ gem 'yard-mongoid'
17
+ ```
18
+
19
+ And then execute:
20
+
21
+ $ bundle
22
+
23
+ Or install it yourself as:
24
+
25
+ $ gem install yard-mongoid
26
+
27
+ ## Usage
28
+
29
+ Add following line to `.yardopts`:
30
+
31
+ ```
32
+ --plugin mongoid
33
+ ```
34
+
35
+ or use it as argument to `yard doc` command like `yard doc --plugin mongoid`.
36
+
37
+ ## Development
38
+
39
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
+
41
+ To install this gem onto your local machine, run `bin/rake install`. To release a new version, update the version number in `version.rb`, and then run `bin/rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
+
43
+ ## Contributing
44
+
45
+ Bug reports and pull requests are welcome on GitHub at https://github.com/alsemyonov/yard-mongoid. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
46
+
47
+
48
+ ## License
49
+
50
+ © [Alex Semyonov](https://al.semyonov.us/) <[alex@semyonov.us](mailto:alex@semyonov.us?subject=yard-mongoid)>, 2016
51
+
52
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
53
+
54
+ [gem]: https://rubygems.org/gems/yard-mongoid
55
+ [travis]: https://travis-ci.org/alsemyonov/yard-mongoid
56
+ [gemnasium]: https://gemnasium.com/alsemyonov/yard-mongoid
57
+ [codeclimate]: https://codeclimate.com/github/alsemyonov/yard-mongoid
58
+ [coverage]: https://codeclimate.com/github/alsemyonov/yard-mongoid/coverage
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'bundler/setup'
4
+ require 'yard-mongoid'
5
+
6
+ require 'pry'
7
+ Pry.start
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require 'pathname'
11
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile',
12
+ Pathname.new(__FILE__).realpath)
13
+
14
+ require 'rubygems'
15
+ require 'bundler/setup'
16
+
17
+ load Gem.bin_path('rake', 'rake')
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
@@ -1,7 +1,8 @@
1
1
  module YARD::Handlers::Ruby
2
2
  module Mongoid
3
3
  module Extensions
4
- protected
4
+ protected
5
+
5
6
  def effected_namespace
6
7
  if statement.type == :command_call
7
8
  context = statement.jump(:var_ref)
@@ -8,7 +8,7 @@ module YARD::Handlers::Ruby
8
8
  include Extensions
9
9
  include YARD::Handlers::Ruby::Mongoid::Helpers
10
10
 
11
- MONGOID_FIELDS = 'Fields'
11
+ MONGOID_FIELDS = 'Fields'.freeze
12
12
 
13
13
  namespace_only
14
14
 
@@ -22,11 +22,11 @@ module YARD::Handlers::Ruby
22
22
 
23
23
  add_field_getter(effected_namespace, name, class_name, default_value)
24
24
  add_field_setter(effected_namespace, name, class_name)
25
- #register_field_presence(effected_namespace, name, scope)
26
- #register_field_change(effected_namespace, name, scope)
27
- #register_field_changed(effected_namespace, name, scope)
28
- #register_field_was(effected_namespace, name, scope)
29
- #register_field_reset(effected_namespace, name, scope)
25
+ # register_field_presence(effected_namespace, name, scope)
26
+ # register_field_change(effected_namespace, name, scope)
27
+ # register_field_changed(effected_namespace, name, scope)
28
+ # register_field_was(effected_namespace, name, scope)
29
+ # register_field_reset(effected_namespace, name, scope)
30
30
  end
31
31
  end
32
32
 
@@ -38,7 +38,7 @@ module YARD::Handlers::Ruby
38
38
  if statement.parameters.size > 2
39
39
  statement.parameters[1].source.split(/,\s*/).each do |key_and_value|
40
40
  if key_and_value =~ hash_args[:type]
41
- @class_name = $2
41
+ @class_name = Regexp.last_match(2)
42
42
  break
43
43
  end
44
44
  end
@@ -53,7 +53,7 @@ module YARD::Handlers::Ruby
53
53
  if statement.parameters.size > 2
54
54
  statement.parameters[1].source.split(/,\s*/).each do |key_and_value|
55
55
  if key_and_value =~ /(:default\s*=>|default:)\s*(.+)\s*$/
56
- @default_value = $2
56
+ @default_value = Regexp.last_match(2)
57
57
  break
58
58
  end
59
59
  end
@@ -70,7 +70,7 @@ module YARD::Handlers::Ruby
70
70
  end
71
71
 
72
72
  # @yieldparam [YARD::CodeObjects::MethodObject]
73
- def add_field_method(namespace, name, &block)
73
+ def add_field_method(namespace, name)
74
74
  register YARD::CodeObjects::MethodObject.new(namespace, name, :instance) do |mo|
75
75
  mo.group = MONGOID_FIELDS
76
76
  mo.visibility ||= :public
@@ -78,7 +78,7 @@ module YARD::Handlers::Ruby
78
78
  mo.dynamic = true
79
79
  mo.signature = "def #{name}"
80
80
  mo.docstring = '' if mo.docstring.empty?
81
- block.call(mo) if block_given?
81
+ yield(mo) if block_given?
82
82
  end
83
83
  end
84
84
 
@@ -8,7 +8,7 @@ module YARD
8
8
  # @param [Symbol] tag
9
9
  # @param [String] text
10
10
  # @param [String] return_classes
11
- def get_tag(tag, text, return_classes = [], name=nil)
11
+ def get_tag(tag, text, return_classes = [], name = nil)
12
12
  YARD::Tags::Tag.new(tag, text, [return_classes].flatten, name)
13
13
  end
14
14
  end
@@ -15,7 +15,7 @@ module YARD::Handlers::Ruby::Mongoid
15
15
  object.group = group_name
16
16
  object.docstring = return_description
17
17
  object.docstring.add_tag get_tag(:return, '', class_name)
18
- object.docstring.add_tag get_tag(:see, "http://mongoid.org/en/mongoid/docs/relations.html##{statement.method_name(true).to_s}")
18
+ object.docstring.add_tag get_tag(:see, "http://mongoid.org/en/mongoid/docs/relations.html##{statement.method_name(true)}")
19
19
  object.dynamic = true
20
20
  register object
21
21
  end
@@ -25,6 +25,7 @@ module YARD::Handlers::Ruby::Mongoid
25
25
  end
26
26
 
27
27
  private
28
+
28
29
  def method_name
29
30
  call_params[0]
30
31
  end
@@ -36,7 +37,7 @@ module YARD::Handlers::Ruby::Mongoid
36
37
  while i < param_size - 1
37
38
  # May want to evaluate doing it this way
38
39
  statement.parameters[i].jump(:hash).source =~ /(:class_name\s*=>|class_name:)\s*["']([^"']+)["']/
39
- return $2 if $2
40
+ return Regexp.last_match(2) if Regexp.last_match(2)
40
41
  i += 1
41
42
  end
42
43
  end
@@ -9,6 +9,7 @@ module YARD::Handlers::Ruby::Mongoid::Relations
9
9
  end
10
10
 
11
11
  private
12
+
12
13
  def return_description
13
14
  ''
14
15
  end
@@ -9,6 +9,7 @@ module YARD::Handlers::Ruby::Mongoid::Relations
9
9
  end
10
10
 
11
11
  private
12
+
12
13
  def return_description
13
14
  ''
14
15
  end
@@ -9,6 +9,7 @@ module YARD::Handlers::Ruby::Mongoid::Relations
9
9
  end
10
10
 
11
11
  private
12
+
12
13
  def return_description
13
14
  ''
14
15
  end
@@ -9,6 +9,7 @@ module YARD::Handlers::Ruby::Mongoid::Relations
9
9
  end
10
10
 
11
11
  private
12
+
12
13
  def return_description
13
14
  ''
14
15
  end
@@ -7,6 +7,7 @@ module YARD::Handlers::Ruby::Mongoid::Relations
7
7
  end
8
8
 
9
9
  private
10
+
10
11
  def return_description
11
12
  "An array of associated #{method_name.humanize}"
12
13
  end
@@ -7,6 +7,7 @@ module YARD::Handlers::Ruby::Mongoid::Relations
7
7
  end
8
8
 
9
9
  private
10
+
10
11
  def return_description
11
12
  "An associated {#{method_name.humanize}}"
12
13
  end
@@ -1,5 +1,5 @@
1
- module Yard
1
+ module YARD
2
2
  module Mongoid
3
- VERSION = '0.0.3'
3
+ VERSION = '0.1.0'.freeze
4
4
  end
5
5
  end
@@ -1,23 +1,25 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path('../lib', __FILE__)
2
+ $LOAD_PATH.push File.expand_path('../lib', __FILE__)
3
3
  require 'yard/mongoid/version'
4
4
 
5
5
  Gem::Specification.new do |s|
6
- s.name = 'yard-mongoid'
7
- s.version = Yard::Mongoid::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = ['Alexander Semyonov']
10
- s.email = %w(al@semyonov.us)
11
- s.homepage = 'http://rubygems.org/gems/yard-mongoid'
12
- s.summary = %q{A Yard plugin for parsing Mongoid model syntax.}
13
- s.description = %q{Once yard-mongoid is installed, YARD will automatically load the plugin when ever the `yard doc` utility is ran on a project.}
6
+ s.name = 'yard-mongoid'
7
+ s.version = YARD::Mongoid::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ['Alexander Semyonov']
10
+ s.email = %w(al@semyonov.us)
11
+ s.homepage = 'http://rubygems.org/gems/yard-mongoid'
12
+ s.summary = 'A Yard plugin for parsing Mongoid model syntax.'
13
+ s.description = 'Once yard-mongoid is installed, YARD will automatically load the plugin when ever the `yard doc` utility is ran on a project.'
14
14
 
15
- s.rubyforge_project = 'yard-mongoid'
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ s.files = `git ls-files`.split("\n")
16
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
+ s.bindir = 'exe'
18
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
19
  s.require_paths = %w(lib)
21
20
 
22
- s.add_dependency 'yard', '~> 0.8.4'
21
+ s.add_runtime_dependency 'yard', '>= 0.8.4'
22
+ s.add_development_dependency 'rake'
23
+ s.add_development_dependency 'mongoid', '>= 3.0'
24
+ s.add_development_dependency 'pry'
23
25
  end
metadata CHANGED
@@ -1,32 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yard-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Alexander Semyonov
9
8
  autorequire:
10
- bindir: bin
9
+ bindir: exe
11
10
  cert_chain: []
12
- date: 2013-03-08 00:00:00.000000000 Z
11
+ date: 2016-11-23 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: yard
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: 0.8.4
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: 0.8.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: mongoid
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
30
69
  description: Once yard-mongoid is installed, YARD will automatically load the plugin
31
70
  when ever the `yard doc` utility is ran on a project.
32
71
  email:
@@ -35,10 +74,14 @@ executables: []
35
74
  extensions: []
36
75
  extra_rdoc_files: []
37
76
  files:
38
- - .gitignore
77
+ - ".gitignore"
39
78
  - Gemfile
40
79
  - MIT-LICENSE
80
+ - README.md
41
81
  - Rakefile
82
+ - bin/console
83
+ - bin/rake
84
+ - bin/setup
42
85
  - lib/yard-mongoid.rb
43
86
  - lib/yard/handlers/ruby/mongoid/extensions.rb
44
87
  - lib/yard/handlers/ruby/mongoid/field_handler.rb
@@ -55,27 +98,25 @@ files:
55
98
  - yard-mongoid.gemspec
56
99
  homepage: http://rubygems.org/gems/yard-mongoid
57
100
  licenses: []
101
+ metadata: {}
58
102
  post_install_message:
59
103
  rdoc_options: []
60
104
  require_paths:
61
105
  - lib
62
106
  required_ruby_version: !ruby/object:Gem::Requirement
63
- none: false
64
107
  requirements:
65
- - - ! '>='
108
+ - - ">="
66
109
  - !ruby/object:Gem::Version
67
110
  version: '0'
68
111
  required_rubygems_version: !ruby/object:Gem::Requirement
69
- none: false
70
112
  requirements:
71
- - - ! '>='
113
+ - - ">="
72
114
  - !ruby/object:Gem::Version
73
115
  version: '0'
74
116
  requirements: []
75
- rubyforge_project: yard-mongoid
76
- rubygems_version: 1.8.23
117
+ rubyforge_project:
118
+ rubygems_version: 2.5.2
77
119
  signing_key:
78
- specification_version: 3
120
+ specification_version: 4
79
121
  summary: A Yard plugin for parsing Mongoid model syntax.
80
122
  test_files: []
81
- has_rdoc: