-
-
Notifications
You must be signed in to change notification settings - Fork 54
Refactor puppet modules properties #212
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
ekohl
merged 3 commits into
voxpupuli:master
from
opus-codium:refactor-puppet-modules-properties
Apr 21, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,70 +1,58 @@ | ||
| # This configuration was generated by | ||
| # `rubocop --auto-gen-config` | ||
| # on 2015-10-07 12:25:07 -0700 using RuboCop version 0.34.2. | ||
| # on 2021-04-21 12:35:40 +0200 using RuboCop version 0.50.0. | ||
| # The point is for the user to remove these configuration records | ||
| # one by one as the offenses are removed from the code base. | ||
| # Note that changes in the inspected code, or installation of new | ||
| # versions of RuboCop, may require this file to be generated again. | ||
|
|
||
| # Offense count: 2 | ||
| # Offense count: 1 | ||
| Lint/UselessAssignment: | ||
| Exclude: | ||
| - 'lib/modulesync.rb' | ||
| - 'lib/modulesync/cli.rb' | ||
|
|
||
| # Offense count: 6 | ||
| # Offense count: 11 | ||
| Metrics/AbcSize: | ||
| Max: 64 | ||
| Max: 48 | ||
|
|
||
| # Offense count: 1 | ||
| # Configuration parameters: CountComments. | ||
| Metrics/ClassLength: | ||
| Max: 107 | ||
| Max: 106 | ||
|
|
||
| # Offense count: 4 | ||
| # Offense count: 3 | ||
| Metrics/CyclomaticComplexity: | ||
| Max: 13 | ||
| Max: 12 | ||
|
|
||
| # Offense count: 8 | ||
| # Configuration parameters: CountComments. | ||
| Metrics/MethodLength: | ||
| Max: 79 | ||
| # Offense count: 2 | ||
| # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. | ||
| # URISchemes: http, https | ||
| Metrics/LineLength: | ||
| Max: 132 | ||
|
|
||
| # Offense count: 1 | ||
| # Offense count: 13 | ||
| # Configuration parameters: CountComments. | ||
| Metrics/ModuleLength: | ||
| Max: 140 | ||
| Metrics/MethodLength: | ||
| Max: 43 | ||
|
|
||
| # Offense count: 4 | ||
| # Offense count: 3 | ||
| Metrics/PerceivedComplexity: | ||
| Max: 16 | ||
| Max: 15 | ||
|
|
||
| # Offense count: 9 | ||
| # Configuration parameters: Exclude. | ||
| Style/Documentation: | ||
| Exclude: | ||
| - 'spec/**/*' | ||
| - 'test/**/*' | ||
| - 'lib/modulesync.rb' | ||
| - 'lib/modulesync/cli.rb' | ||
| - 'lib/modulesync/constants.rb' | ||
| - 'lib/modulesync/git.rb' | ||
| - 'lib/modulesync/hook.rb' | ||
| - 'lib/modulesync/renderer.rb' | ||
| - 'lib/modulesync/util.rb' | ||
|
|
||
| # Offense count: 1 | ||
| Style/EachWithObject: | ||
| Exclude: | ||
| - 'lib/modulesync/util.rb' | ||
|
|
||
| # Offense count: 1 | ||
| # Configuration parameters: MinBodyLength. | ||
| Style/GuardClause: | ||
| Exclude: | ||
| - 'lib/modulesync/cli.rb' | ||
|
|
||
| # Offense count: 1 | ||
| # Cop supports --auto-correct. | ||
| # Configuration parameters: AllowAsExpressionSeparator. | ||
| Style/Semicolon: | ||
| Style/EachWithObject: | ||
| Exclude: | ||
| - 'lib/modulesync/util.rb' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| require 'modulesync' | ||
| require 'modulesync/util' | ||
|
|
||
| module ModuleSync | ||
| # Provide methods to retrieve puppet module attributes | ||
| class PuppetModule | ||
| attr_reader :given_name | ||
| attr_reader :options | ||
|
|
||
| def initialize(given_name, options) | ||
| options ||= {} | ||
| @options = Util.symbolize_keys(options) | ||
|
|
||
| @given_name = given_name | ||
|
|
||
| return unless given_name.include?('/') | ||
|
|
||
| @repository_name = given_name.split('/').last | ||
| @repository_namespace = given_name.split('/')[0...-1].join('/') | ||
| end | ||
|
|
||
| def repository_name | ||
| @repository_name ||= given_name | ||
| end | ||
|
|
||
| def repository_namespace | ||
| @repository_namespace ||= @options[:namespace] || ModuleSync.options[:namespace] | ||
| end | ||
|
|
||
| def repository_path | ||
| @repository_path ||= "#{repository_namespace}/#{repository_name}" | ||
| end | ||
|
|
||
| def repository_remote | ||
| @repository_remote ||= @options[:remote] || _repository_remote | ||
| end | ||
|
|
||
| def working_directory | ||
| @working_directory ||= File.join(ModuleSync.options[:project_root], repository_path) | ||
| end | ||
|
|
||
| private | ||
|
|
||
| def _repository_remote | ||
| git_base = ModuleSync.options[:git_base] | ||
| git_base.start_with?('file://') ? "#{git_base}#{repository_path}" : "#{git_base}#{repository_path}.git" | ||
| end | ||
| end | ||
| end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.