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

Added Months option and added frequency_modifier def to handle both i… #305

Merged
merged 3 commits into from
Nov 24, 2015
Merged

Conversation

Stromweld
Copy link
Contributor

Added Months option and added frequency_modifier def to handle both integers and strings. Fixes #304

@Stromweld
Copy link
Contributor Author

the rubocop failures for case, where it wants the when statements indented as deep as the case statement, is that how it should be? My RubyMine IDE automagically indents them one level deeper and readability I think that it's nice as you can tell they are a condition of the case statement.

def validate_create_months
return unless @new_resource.months
unless [:monthly].include?(@new_resource.frequency)
fail 'months attribute is only valid for tasks that run weekly or monthly'
Copy link
Contributor

Choose a reason for hiding this comment

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

change message to just monthly

@mwrock
Copy link
Contributor

mwrock commented Nov 24, 2015

For the sake of consistency, we'd want this to comply with the rubocop rules currently used. We don't want to merge a PR unless it is green.

@mwrock
Copy link
Contributor

mwrock commented Nov 24, 2015

Oh and I should also say thank you very much for this! I think it is a good addition.

@Stromweld
Copy link
Contributor Author

Made the rubocop fixes and a couple of your recommendations from comments above. As far as array's go, that would probably be best but not sure if that should be in this scope or a refactor afterwards. I was trying to stay consistent with the rest of the file and formatted it like how validate_create_day is.

I am also fairly new to ruby, chef, and programming in general and have been learning as I go I'm not totally sure what would all need to be done to refactor for kind_of array.

@mwrock
Copy link
Contributor

mwrock commented Nov 24, 2015

Yeah the Array is not a big deal. I think it might make things easier but wouldn't hold off a merge. However, after you split the string on ',' you should strip the individual months. Otherwise if someone specifies:

'JAN, FEB'

FEB will be ' FEB'

@Stromweld
Copy link
Contributor Author

is this last commit what your talking about?

@mwrock
Copy link
Contributor

mwrock commented Nov 24, 2015

yeah

@Stromweld
Copy link
Contributor Author

cool

@mwrock
Copy link
Contributor

mwrock commented Nov 24, 2015

👍 cc @chef-cookbooks/client-windows @chef/client-windows

@adamedx
Copy link
Contributor

adamedx commented Nov 24, 2015

👍

mwrock added a commit that referenced this pull request Nov 24, 2015
Added Months option and added frequency_modifier def to handle both i…
@mwrock mwrock merged commit d78c82e into chef-boneyard:master Nov 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants