Module: Diffend
- Defined in:
- lib/diffend.rb,
lib/diffend/track.rb,
lib/diffend/errors.rb,
lib/diffend/voting.rb,
lib/diffend/request.rb,
lib/diffend/commands.rb,
lib/diffend/config/fetcher.rb,
lib/diffend/request_object.rb,
lib/diffend/config/validator.rb,
lib/diffend/config/file_finder.rb,
lib/diffend/handle_errors/report.rb,
lib/diffend/voting/versions/local.rb,
lib/diffend/handle_errors/messages.rb,
lib/diffend/voting/versions/remote.rb,
lib/diffend/build_bundler_definition.rb,
lib/diffend/handle_errors/display_to_stdout.rb,
lib/diffend/handle_errors/build_exception_payload.rb
Overview
Diffend main namespace
Defined Under Namespace
Modules: BuildBundlerDefinition, Commands, Config, Errors, HandleErrors, Request, Voting Classes: RequestObject, Track
Constant Summary collapse
- VERSION =
Current plugin version
'0.2.28'- HOMEPAGE =
Diffend homepage
'https://diffend.io'
Class Method Summary collapse
- .build_outdated_version_message(version) ⇒ String
-
.command ⇒ String
Command that was run with bundle.
-
.enabled? ⇒ Boolean
Checks if plugin is enabled.
-
.execute ⇒ Object
Execute diffend plugin.
-
.fetch_config ⇒ OpenStruct?
Fetch diffend config file.
-
.installed_version ⇒ String
Installed plugin version.
-
.register ⇒ Object
Registers the plugin and add before install all hook.
- .verify_version ⇒ Object
Class Method Details
.build_outdated_version_message(version) ⇒ String
117 118 119 120 121 122 |
# File 'lib/diffend.rb', line 117 def (version) " \\nYou are running an outdated version (\#{version}) of the plugin, which will lead to issues.\n \\nPlease upgrade to the latest one (\#{VERSION}) by executing \"rm -rf .bundle/plugin\".\\n\n MSG\nend\n" |
.command ⇒ String
Command that was run with bundle
127 128 129 |
# File 'lib/diffend.rb', line 127 def command ARGV.first || Bundler.feature_flag.default_cli_command.to_s end |
.enabled? ⇒ Boolean
Checks if plugin is enabled
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/diffend.rb', line 103 def enabled? Bundler .default_gemfile .read .split("\n") .reject(&:empty?) .map(&:strip) .select { |line| line.start_with?('plugin') } .any? { |line| line.include?('diffend') } end |
.execute ⇒ Object
Execute diffend plugin
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/diffend.rb', line 45 def execute return unless enabled? verify_version config = fetch_config Diffend::Voting.call( command, config, Diffend::BuildBundlerDefinition.call( command, Bundler.default_gemfile, Bundler.default_lockfile ) ) rescue Diffend::Errors::HandledException return if ENV['DIFFEND_IGNORE_ERRORS'] == 'true' exit 255 rescue StandardError => e Diffend::HandleErrors::Report.call( exception: e, config: config, message: :unhandled_exception, report: true, raise_exception: false ) return if ENV['DIFFEND_IGNORE_ERRORS'] == 'true' exit 255 end |
.fetch_config ⇒ OpenStruct?
Fetch diffend config file
136 137 138 139 140 |
# File 'lib/diffend.rb', line 136 def fetch_config Config::Fetcher.call( File.('..', Bundler.bin_path) ) end |
.installed_version ⇒ String
Returns installed plugin version.
90 91 92 93 94 95 96 97 98 |
# File 'lib/diffend.rb', line 90 def installed_version Bundler::Plugin .index .plugin_path('diffend') .basename .to_s .split('-') .last end |
.register ⇒ Object
Registers the plugin and add before install all hook
38 39 40 41 42 |
# File 'lib/diffend.rb', line 38 def register Bundler::Plugin.add_hook('before-install-all') do |_| execute end end |
.verify_version ⇒ Object
79 80 81 82 83 84 85 86 87 |
# File 'lib/diffend.rb', line 79 def verify_version return if ENV['DIFFEND_DEVELOPMENT'] == 'true' return if installed_version == VERSION (installed_version) .tap(&Bundler.ui.method(:error)) exit 2 end |