Skip to content
This repository was archived by the owner on Jan 29, 2022. It is now read-only.

MVC Rework#83

Merged
dhollinger merged 1 commit intovoxpupuli:masterfrom
dhollinger:mvc_rework
Jan 23, 2019
Merged

MVC Rework#83
dhollinger merged 1 commit intovoxpupuli:masterfrom
dhollinger:mvc_rework

Conversation

@dhollinger
Copy link
Copy Markdown
Member

Rework the application into a Model, View, Controller style framework without changing user-facing functionality.

Benefits:

  • Cleaner, easier to follow code structure
  • More modular for adding functionality with less effort
  • Be able to manage user data (authentication) within the model

Drawbacks:

  • Unused components (Probably won't benefit from views)
  • Larger Directory Structure
  • More complicated packaging process (no gemspec file)

@@ -0,0 +1,21 @@
development:
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

TODO: Remove this from the repository.

@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Dec 31, 2018
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
Gemfile Outdated
@@ -1,3 +1,31 @@
source 'https://rubygems.org'
source 'http://rubygems.org'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

eh :(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you change it back to https?

@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
@voxpupuli voxpupuli deleted a comment Jan 1, 2019
CONTRIBUTORS Outdated
Ewoud Kohl van Wijngaarden [email protected]
Lee Lowder [email protected]
Tim Meusel [email protected]
Will Berman [email protected] No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would like to see a newline here

@@ -0,0 +1,215 @@
GIT
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure, do we want to comit the Gemfile? We have it in the .gitignore for our modules.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

For web applications like Sinatra and Rails it is considered best practice to include the Gemfile.lock. In fact, the only time you're not supposed to include the Gemfile.lock is for Puppet modules and Rubygems.

logger.warn('APP_CONFIG.slack_emoji is deprecated and will be removed in puppet_webhook 3.0.0')
APP_CONFIG.chatops_options[:icon_emoji] = APP_CONFIG.slack_emoji
logger.warn('APP_CONFIG.slack_proxy_url is deprecated and will be removed in puppet_webhook 3.0.0')
APP_CONFIG.chatops_options[:http_options] = if APP_CONFIG.slack_proxy_url
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I was never a real fan of this indentation, but rubocop prefers it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

mhm, thinking about it. Would this work as well?

Suggested change
APP_CONFIG.chatops_options[:http_options] = if APP_CONFIG.slack_proxy_url
APP_CONFIG.chatops_options[:http_options] = APP_CONFIG.slack_proxy_url == ture ? slack_proxy : {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

stupid typos.

allow_uppercase: true
command_prefix: 'umask 0022;'

test: &development No newline at end of file
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

please add the missing newline

def initialize(agent, command, timeouts = nil, options = nil, nodes = [], **args) # rubocop:disable Metrics/ParameterLists
@agent = agent
@command = command
@timeout = timeouts[:timeout] || '120'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can this be an integer? (same for dtimeout

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't remember the reasons for this. It may be that the MCollective client expects a string. I'll look into it. Could be a 2.0.0 work.

@coveralls
Copy link
Copy Markdown

coveralls commented Jan 22, 2019

Coverage Status

Coverage decreased (-2.3%) to 52.189% when pulling 1264129 on dhollinger:mvc_rework into b089f4e on voxpupuli:master.

All API routes have been moved to controllers in
Api::V1::<ControllerName>. These controllers are configured to respond
to their original urls for backwards compatibility. This compatibility
will be removed in 2.0.0.

All r10k helpers have been moved to a new R10kHelpers file in
`app/helpers/r10k_helpers.rb`. All global controller methods are now
private methods within the main ApplicationController, while
controller-specific methods now exist in their controllers. Any
non-public method is now private.

All library-based code is now contained in a `PuppetWebhook` module
within the `lib/` directory in the root of the codedir. Theses include
body parsers, mcollective client, and chatops clients.

New tests have been added for the parsers, controllers, and helpers
@dhollinger dhollinger mentioned this pull request Jan 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants