Skip to content

(PDOC-35) Support types and providers #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

iankronquist
Copy link
Contributor

This is not ready yet, but I thought I'd put it up so people can take a look at it. I still need to:

  • Handle generated property methods (mk_resource_method)
  • Handle default values? Is this a requested feature? I see these often mentioned in the docs.
  • Write tests.
  • Squash this nonsense into a reasonable number of commits.

@iankronquist
Copy link
Contributor Author

I wrote three tests for the providers handler. What else should I test? @HAIL9000 Thoughts?
Also I spoke to Charlie about meta programming madness and am looking into adding a custom tag to yard.

@iankronquist iankronquist changed the title Defined types and providers pdoc 35 (Don'y merge yet) Defined types and providers pdoc 35 Aug 10, 2015
@iankronquist
Copy link
Contributor Author

@HAIL9000 this is ready for review. Would you like me to squash it before or after you review it?

@iankronquist iankronquist changed the title (Don'y merge yet) Defined types and providers pdoc 35 Defined types and providers pdoc 35 Aug 11, 2015
@HAIL9000
Copy link
Contributor

@iankronquist Let's wait on squashing in case we need to make more changes. We'll definitely want this broken down into several commits when we squash, so let's wait until it's ready to go so we can organize those in a way that makes sense.

@@ -55,6 +56,9 @@ def check_required_features
# all over the terminal. This should definitely not be in real code, but
# it's very handy for debugging with pry
#class YARD::Logger; def progress(*args); end; end
YARD::Tags::Library.define_directive("puppet.provider.param",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... not sure how I feel about the name for this directive but I can't think of a better option off the top of my head. May be worth reaching out for suggestions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a bit long but I like the namespacing.

@HAIL9000 HAIL9000 changed the title Defined types and providers pdoc 35 (PDOC-35) Support types and providers Aug 20, 2015
@iankronquist iankronquist changed the title (PDOC-35) Support types and providers DON'T MERGE (PDOC-35) Support types and providers Aug 26, 2015
@iankronquist
Copy link
Contributor Author

I talked with Nick. This isn't sufficient.
Here is a sketch of some of what we need:
img_20150826_150036

  • Rename provider to type
  • Type
  • type doc
  • List providers from within type (modify template and type logic)
  • associate a provider with a type (create a provider handler and search registry for existing type)
  • type features
  • type features desc
  • type parameters
  • param namevar (4 ways of determining -- ick)
  • way 4 -> package resource type just calls isnamevar directly.
  • param desc
  • param default
  • param allowed values
  • prop desc
  • prop default
  • prop allowed values
  • Providers
  • prov desc
  • prov commands
  • prov confines
  • prov defaultfor
  • prov features

@iankronquist iankronquist force-pushed the defined-types-and-providers-pdoc-35 branch 2 times, most recently from e918198 to 566b758 Compare August 27, 2015 18:14
@iankronquist iankronquist changed the title DON'T MERGE (PDOC-35) Support types and providers (PDOC-35) Support types and providers Sep 2, 2015
@iankronquist iankronquist force-pushed the defined-types-and-providers-pdoc-35 branch from cbdeb02 to 0a03723 Compare September 2, 2015 19:14
@iankronquist
Copy link
Contributor Author

This needs a hell of a rebase but is ready for review.

@hlindberg
Copy link
Contributor

@nfagerlund ping - are you happy with the changes?

if content != node
# The docstring is either the source stripped of heredoc
# annotations or the raw source.
if @heredoc_helper.is_heredoc? content.source
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a matter of style:
While it is ok to leave out the () around arguments in a method call, I prefer that there are () everywhere except when the methods are designed to be used in a human friendly DSL style. I find that readability increases in long chains of words (esp when there are also underscores). The one above not so bad, but below there is a line that says:

docstring = @heredoc_helper.process_heredoc content.source

I would prefer that to read:

docstring = @heredoc_helper.process_heredoc(content.source)

Using parentheses also reduces the risk that someone later makes mistakes if there is the need to continue the expression.

(I see no need to go through all of the code to change this, but if you rework it for other reasons, this is something to consider).

@iankronquist iankronquist mentioned this pull request Sep 4, 2015
@nfagerlund
Copy link

Sorry for the delay. Yes, I'm happy with what we have! I'm not familiar enough with the code to review it, but the output Ian has shown me is a good first pass at types / providers docs. The foundation is solid enough that we can make further improvements incrementally. I'm 👍 to merge.

@iankronquist iankronquist force-pushed the defined-types-and-providers-pdoc-35 branch from 40c4f34 to 14a3c94 Compare September 9, 2015 21:23
@iankronquist
Copy link
Contributor Author

Thanks @nfagerlund @HAIL9000 @hlindberg for your feedback and suggestions.
This has now been rebased and is ready to go once Travis finishes.
@HAIL9000 Could you take a look at #47, the accompanying docs?

@iankronquist
Copy link
Contributor Author

... and a debugging comment creeps in at the last minute.

class PuppetX::PuppetLabs::Strings::YARD::CodeObjects::DefinedTypeObject < PuppetX::PuppetLabs::Strings::YARD::CodeObjects::PuppetNamespaceObject
# A list of parameters attached to this class.
# @return [Array<Array(String, String)>]
attr_accessor :parameters
attr_accessor :type_info

def to_s
require 'pry'; binding.pry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we have a bunch of remaining debug statements we should take out (I think these are what's causing the test failures in Travis)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jk you already noticed this 👍

Adding a provider page and menu
* Add categories to html search bar
* Require provider handler and object classes
* Fetch provider code objects from registry
* Add function to generate the provider list
* Fetch providers from registry in monkey patches
* Add provider templates
* Add provider code object
* Add provider handler
* Add erb file to populate the provider list
* Don't emit type information for providers in html
* Add tests for provider handler

Refactor heredoc:
* Remove heredoc annotations
* Move heredoc functions into a heredoc helper
* Add heredoc helper class
* Print yard documentation statistics for providers
* Define a directive which takes a type and a name
* Dunno, I just plowed through a bunch of features
* Expect puppet provider in stats output
* Fetch default values for Type params and props
* Detect allowed values
* Add allowed values to test
* htmlify scrubbed text
* Add features to Type html output
* Add infrastructure for types
* Add methods for generating lists, etc.
* Add provider code object
* Add provider handler
* Generate list for puppet provider dropdown
* Add puppet provider template
* Add provider details to puppet type template
* Get description properly for types
@iankronquist iankronquist force-pushed the defined-types-and-providers-pdoc-35 branch from 14a3c94 to aff2733 Compare September 9, 2015 21:36
@iankronquist
Copy link
Contributor Author

@HAIL9000 Travis is green.

end



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ultra picky comment, but do we need so much white space here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed whitespace.

* Float several namevars/ensurables to top of list
* Fix minor code style issues
@iankronquist iankronquist force-pushed the defined-types-and-providers-pdoc-35 branch from aff2733 to 1991475 Compare September 9, 2015 22:27
HAIL9000 added a commit that referenced this pull request Sep 9, 2015
…pdoc-35

(PDOC-35) Support types and providers
@HAIL9000 HAIL9000 merged commit 623011f into puppetlabs:master Sep 9, 2015
@ferventcoder
Copy link
Contributor

👍

danzilio pushed a commit to danzilio/puppetlabs-strings that referenced this pull request Sep 16, 2015
danzilio pushed a commit to danzilio/puppetlabs-strings that referenced this pull request Sep 16, 2015
@chelnak chelnak added the bugfix label Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants