Skip to content
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

Docs for Arc and Working Rake Task #1532

Merged
merged 8 commits into from
Jan 17, 2018
Merged

Conversation

nicholalexander
Copy link
Contributor

Trying to also make progress against #620.

Two things here:

  1. when I ran rake yard the yardoc generation didn't generate any files. Maybe this was because I wasn't running it correctly? I was able to generate some of the documentation by modifying the rake task as here. However, we may want to add a .yardopts file so that running yardoc from the root works without requiring a rake task? This might also be required to get the docs on rubydoc - entirely not sure. I also added --no-private flag as per the comments in Document ALL the things #620.

  2. Made a first pass at adding in some docs for the Arc class where I feel sufficiently able to explain what's going on. I also moved a comment into the notes so that it is featured in the generated docs.

Completely not sure if this is helpful or not but thought I'd start on it and welcome any and all direction change!

best,
n

@nicholalexander nicholalexander changed the title WIP: Docs for Arc and Working Rake Task Docs for Arc and Working Rake Task Dec 18, 2017
# arc 200, 200, 100, 100, Shoes::PI, 0
# @note Angle is the gradient angle used across all art elements. Angle1/2 are the angles of
# the arc itself!
# @author Jason Clark
Copy link
Member

Choose a reason for hiding this comment

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

Don't know that I deserve specific credit here--I probably just shuffled the class around from it's original location :)

# @example A simple arc which describes the bottom half of a circle and uses the centered style.
# arc 200, 200, 100, 100, 0, Shoes::PI, center: true
# @example An arc which describes the top half of a circle.
# arc 200, 200, 100, 100, Shoes::PI, 0
Copy link
Member

Choose a reason for hiding this comment

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

Love the examples, very helpful!

# @param angle1 [Float] The first angle of the arc to the center point, in Radians,
# starting from the 3 o'clock position.
# @param angle2 [Float] The second angle of the arc to the center point, in Radians.
# @param [Hash] Style hash
Copy link
Member

Choose a reason for hiding this comment

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

I believe yard also supports describing the @option values that are supported in a hash (http://www.rubydoc.info/gems/yard/file/docs/Tags.md#option). Those seem worthwhile to consider listing out too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, will fill out the options for the style hash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, a couple of problems on this one. Firstly the params aren't showing up in the yard doc because it wants them to be next to an initialize method.

Additionally, the options hash needs to be named in order for it to pick up and match against it.

class Blurgh
    # @param thing [Integer] a thing!
    # @param thing_hash [Hash] a thing hash which we want to have.
    # @option thing_hash [String] :blurgh the name of blurgh
    def initialize(thing, thing_hash)
    end
  end

I will have to dig deeper into yard to see if I can figure this out...

Copy link
Member

Choose a reason for hiding this comment

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

Ah, didn't know that about it. I wouldn't worry on it for too long--if you can't find an easy way, we can table the options hashes until later (or never) and just roll forward with this now.

tasks/yard.rb Outdated
t.options = ['-mmarkdown']
t.files = ['shoes-core/**/*.rb', 'README.md', 'LICENSE', 'CONTRIBUTING.md',
'CODE_OF_CONDUCT.MD']
t.options = ['-mmarkdown', '--no-private']
Copy link
Member

Choose a reason for hiding this comment

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

So these are a good start, but I found generating locally that this gives me a bit better result:

  YARD::Rake::YardocTask.new do |t|
    t.files = [
      'shoes-core/lib/**/*.rb',
      '-',
      'README.md',
      'shoes-core/README.md',
      'LICENSE',
      'CONTRIBUTING.md',
      'CODE_OF_CONDUCT.MD'
    ]
    t.options = [
      '-mmarkdown',
      '--no-private'
    ]

It does a couple things:

  • Only generates for the shoes-core/lib folder, since we were picking up specs
  • Works correctly with the markdown files by putting them after a -

How does that look to you @nicholalexander?

@jasonrclark
Copy link
Member

Sorry for dropping off for so long! Had some business travel, followed by holidays, but I'm back in the Shoes action in earnest now. Getting yard working again is really helpful--it was on my short list to look at soon, and this is a great first step.

Few comments, nothing major, and this should be 🆒 to go after those.

@nicholalexander
Copy link
Contributor Author

No worries at all, I was away for the holidays as well. Will make suggested changes!
Happy new year!
n

@nicholalexander
Copy link
Contributor Author

@jasonrclark - I took your suggested configuration and moved it into a yardopts file, that way you can either run rake yard or you can just run yard. I think this is helpful for just jumping into yard as well as having the docs generated on rubydoc.info. What do you think about that?

@nicholalexander nicholalexander changed the title Docs for Arc and Working Rake Task WIP: Docs for Arc and Working Rake Task Jan 12, 2018
@jasonrclark
Copy link
Member

@nicholalexander .yardopts seems perfect!

Is the only thing outstanding seeing what can be done about the hash options? Excited to get this landed so I can join in writing some docs as I go. 📚

also move info about radians in to class documentation.
@nicholalexander nicholalexander changed the title WIP: Docs for Arc and Working Rake Task Docs for Arc and Working Rake Task Jan 16, 2018
@nicholalexander
Copy link
Contributor Author

Hey @jasonrclark - sorry for the delay, I was away for the long weekend. This should be good to go as it is now. I removed the params from the docs because those also weren't showing up. As it currently stands, yard is configured and working and the class has some initial documentation which generates correctly. If we want to solve the params and options problem, that could be done in another PR.

Thanks!

@jasonrclark
Copy link
Member

No apologies necessary--we're all volunteers here. Thanks for the tidy up, and here comes the merge 🚄 !

@jasonrclark jasonrclark merged commit d7bd9b1 into shoes:master Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants