diffend 0.2.25 → 0.2.26

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6f2f5188a60431f6125d9b82e75f6edb661bf9c805ff13f685b962555c2cdb2
4
- data.tar.gz: 3b4161909c2c494a37b3e8e3f9839f2fb86dd7c5712ca200cfb40e3c77e6bba6
3
+ metadata.gz: f22ef308037176744a8795a6371eb3340f01d597b706c66e45b8355dbf2d41a9
4
+ data.tar.gz: 1e5734925c51663f20e804ecef8d329f7b24a05dfce891b33366f1e867edbf78
5
5
  SHA512:
6
- metadata.gz: a305d14cb1c2fe8166de8a830a465ed0647b690aec10ec917cf31348944a6f8f3867b75053f2817ab04153a27bc141064bc2ecc46dc73a77f68850011592c11c
7
- data.tar.gz: f279c3f69cfcd07706a4c4652741d7ebc9423d222724d2c0093fa363f3be25970216d5adcaf156825db1edde6a8d6fb3d990f31a8d7480b656ff23e2a23490bc
6
+ metadata.gz: 8930d5dfc0e3c8438515069ab5c472ae93aaf934c6d16c595c70b9167384347d7c0358c4c50fc49d18b1a4024ed959be4fff00485731c9e622b8c8e89f7c1a98
7
+ data.tar.gz: e9741f2fe2db83a7650dd2272b9f79cfa7e5bc4b3c2989cae0d8390215459a386a545f23eb0163e350e6e32a7dca7963c9a9bfcdb65496dfa062051a2c023aad
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -34,6 +34,8 @@ jobs:
34
34
  run: |
35
35
  gem install bundler --no-document
36
36
  - name: Bundle install
37
+ env:
38
+ DIFFEND_DEVELOPMENT: true
37
39
  run: |
38
40
  bundle config path vendor/bundle
39
41
  bundle install --jobs 4 --retry 3
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## [Unreleased][master]
4
4
 
5
+ ## [0.2.26] (2020-09-10)
6
+ - introduce DIFFEND_DEVELOPMENT environment variable ([#36](https://github.com/diffend-io/diffend-ruby/pull/36))
7
+ - adjust message for allow verdict ([#37](https://github.com/diffend-io/diffend-ruby/pull/37))
8
+ - do not run the plugin when it is not enabled ([#38](https://github.com/diffend-io/diffend-ruby/pull/38))
9
+
5
10
  ## [0.2.25] (2020-09-09)
6
11
  - add support for a warn verdict ([#34](https://github.com/diffend-io/diffend-ruby/pull/34))
7
12
 
@@ -50,7 +55,8 @@
50
55
 
51
56
  - initial release
52
57
 
53
- [master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.25...HEAD
58
+ [master]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.26...HEAD
59
+ [0.2.26]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.25...v0.2.26
54
60
  [0.2.25]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.24...v0.2.25
55
61
  [0.2.24]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.23...v0.2.24
56
62
  [0.2.23]: https://github.com/diffend-io/diffend-ruby/compare/v0.2.22...v0.2.23
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- diffend (0.2.25)
4
+ diffend (0.2.26)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -27,7 +27,7 @@
27
27
  # Diffend main namespace
28
28
  module Diffend
29
29
  # Current plugin version
30
- VERSION = '0.2.25'
30
+ VERSION = '0.2.26'
31
31
  # Diffend homepage
32
32
  HOMEPAGE = 'https://diffend.io'
33
33
 
@@ -41,7 +41,9 @@ module Diffend
41
41
 
42
42
  # Execute diffend plugin
43
43
  def execute
44
- detect_installed_version
44
+ return unless enabled?
45
+
46
+ verify_version
45
47
 
46
48
  config = fetch_config
47
49
 
@@ -63,7 +65,8 @@ module Diffend
63
65
  )
64
66
  end
65
67
 
66
- def detect_installed_version
68
+ def verify_version
69
+ return if ENV['DIFFEND_DEVELOPMENT'] == 'true'
67
70
  return if installed_version == VERSION
68
71
 
69
72
  build_outdated_version_message(installed_version)
@@ -72,16 +75,6 @@ module Diffend
72
75
  exit 1
73
76
  end
74
77
 
75
- # @param version [Hash] installed version
76
- #
77
- # @return [String]
78
- def build_outdated_version_message(version)
79
- <<~MSG
80
- \nYou are running an outdated version (#{version}) of the plugin, which will lead to issues.
81
- \nPlease upgrade to the latest one (#{VERSION}) by executing "rm -rf .bundle/plugin".\n
82
- MSG
83
- end
84
-
85
78
  # @return [String] installed plugin version
86
79
  def installed_version
87
80
  Bundler::Plugin
@@ -93,6 +86,30 @@ module Diffend
93
86
  .last
94
87
  end
95
88
 
89
+ # Checks if plugin is enabled
90
+ #
91
+ # @return [Boolean] true if enabled, false otherwise
92
+ def enabled?
93
+ Bundler
94
+ .default_gemfile
95
+ .read
96
+ .split("\n")
97
+ .reject(&:empty?)
98
+ .map(&:strip)
99
+ .select { |line| line.start_with?('plugin') }
100
+ .any? { |line| line.include?('diffend') }
101
+ end
102
+
103
+ # @param version [Hash] installed version
104
+ #
105
+ # @return [String]
106
+ def build_outdated_version_message(version)
107
+ <<~MSG
108
+ \nYou are running an outdated version (#{version}) of the plugin, which will lead to issues.
109
+ \nPlease upgrade to the latest one (#{VERSION}) by executing "rm -rf .bundle/plugin".\n
110
+ MSG
111
+ end
112
+
96
113
  # Command that was run with bundle
97
114
  #
98
115
  # @return [String]
@@ -84,7 +84,7 @@ module Diffend
84
84
  def build_allow_message(command, response)
85
85
  <<~MSG
86
86
  #{build_message_header('an allow', command)}
87
- #{build_message_info(response)}
87
+ #{build_message_info(response)}\n
88
88
  #{response['review_url']}\n
89
89
  MSG
90
90
  end
@@ -96,7 +96,7 @@ module Diffend
96
96
  def build_warn_message(command, response)
97
97
  <<~MSG
98
98
  #{build_message_header('a warn', command)}
99
- #{build_message_info(response)}
99
+ #{build_message_info(response)} Please go to the url below and review the issues.\n
100
100
  #{response['review_url']}\n
101
101
  MSG
102
102
  end
@@ -108,7 +108,7 @@ module Diffend
108
108
  def build_deny_message(command, response)
109
109
  <<~MSG
110
110
  #{build_message_header('a deny', command)}
111
- #{build_message_info(response)}
111
+ #{build_message_info(response)} Please go to the url below and review the issues.\n
112
112
  #{response['review_url']}\n
113
113
  MSG
114
114
  end
@@ -125,7 +125,7 @@ module Diffend
125
125
  #
126
126
  # @return [String]
127
127
  def build_message_info(response)
128
- "\nQuality score: #{response['quality_score']}, allows: #{response['allows_count']}, warnings: #{response['warns_count']}, denies: #{response['denies_count']}. Please go to the url below and review the issues.\n"
128
+ "\nQuality score: #{response['quality_score']}, allows: #{response['allows_count']}, warnings: #{response['warns_count']}, denies: #{response['denies_count']}."
129
129
  end
130
130
  end
131
131
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: diffend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.25
4
+ version: 0.2.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Pajor
@@ -34,7 +34,7 @@ cert_chain:
34
34
  9MmF6uCQa1EjK2p8tYT0MnbHrFkoehxdX4VO9y99GAkhZyJNKPYPtyAUFV27sT2V
35
35
  LfCJRk4ifKIN/FUCwDSn8Cz0m6oH265q0p6wdzI6qrWOjP8tGOMBTA==
36
36
  -----END CERTIFICATE-----
37
- date: 2020-09-09 00:00:00.000000000 Z
37
+ date: 2020-09-10 00:00:00.000000000 Z
38
38
  dependencies:
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: bundler
metadata.gz.sig CHANGED
Binary file