redmine_plugin_kit 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e70a683a6d00229895f294f80c9e45b3418097776a8cdb1404861647d947be4a
4
- data.tar.gz: 609059f357451defbd6c72a579de206f437fe53b5c582edbd2129999387ffe97
3
+ metadata.gz: 1b950fef55b36b8c083f86f9763d9528a259c42b85da7f238ac94ba9dd85ca40
4
+ data.tar.gz: b425a3447f2b07ded747e329d6b482010e8404a36d9842f3415aa06c5232b959
5
5
  SHA512:
6
- metadata.gz: c4d80378cc8c646323a895d3e440ba2c67d78757d9e4938b84ea2276d90dbc65d548686114c5a370eeccddbae8479f31ba58d1f13bddea84d389aa0198f96c05
7
- data.tar.gz: 1a488d91d4d3b7d12c5c1dc653bd00191d055fb4fc576ff99b86d1fe2634fcc9373b5651f5abdb621a9356bcf29edafb41608ff56bf08ecfe15525d6789e55cf
6
+ metadata.gz: 516210aeab2395b927086b354b913eeca88e7aed1de3f7674aad6d6efb0bcd602897eefd28f108c00d13519f9cb27df51167638937516ec3d9793577ad52d3c9
7
+ data.tar.gz: 4579bbdaed1f2dec0bce766f18bd3344398f303c5417b8944312945a63894a750cad7f4fce3d41bb2ebd5082e06ccc5f3aa4f6ae26ff8e56d042b27cce205f0d
@@ -15,7 +15,7 @@ module RedminePluginKit
15
15
  return if url.blank?
16
16
 
17
17
  parts = url.split '://'
18
- name = if parts.count.positive?
18
+ name = if parts.any?
19
19
  parts.shift
20
20
  parts.join.chomp '/'
21
21
  else
@@ -28,10 +28,9 @@ module RedminePluginKit
28
28
  # required multiple times because of this bug: https://www.redmine.org/issues/33290
29
29
  def redmine_database_ready?(with_table = nil)
30
30
  ActiveRecord::Base.connection
31
- rescue ActiveRecord::NoDatabaseError
32
- false
33
- else
34
31
  with_table.nil? || ActiveRecord::Base.connection.table_exists?(with_table)
32
+ rescue ActiveRecord::NoDatabaseError, ActiveRecord::ConnectionNotEstablished, ActiveRecord::StatementInvalid
33
+ false
35
34
  end
36
35
 
37
36
  def plugin_dir(plugin_id:)
@@ -212,7 +211,7 @@ module RedminePluginKit
212
211
  end
213
212
 
214
213
  target = patch[:target]
215
- target.include patch_module unless target.included_modules.include? patch_module
214
+ target.include patch_module unless target.include? patch_module
216
215
  end
217
216
  end
218
217
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RedminePluginKit
4
- VERSION = '1.0.6'
4
+ VERSION = '1.0.8'
5
5
  end
@@ -79,4 +79,39 @@ namespace :redmine_plugin_kit do
79
79
  puts plugin_settings[setting]
80
80
  end
81
81
  end
82
+
83
+ desc 'Detects templates from the plugin that override Redmine core templates'
84
+ task detect_overwritten_templates: :environment do
85
+ redmine_views_root = Rails.root.join 'app/views'
86
+
87
+ Rails.root.glob('plugins/*').each do |plugin_path|
88
+ plugin_path = plugin_path.to_s
89
+ plugin_views = Dir.glob "#{plugin_path}/app/views/**/*.{erb,slim}"
90
+ overwritten = []
91
+
92
+ plugin_views.each do |plugin_file|
93
+ relative_path = plugin_file.sub %r{^#{Regexp.escape plugin_path}/app/views/}, ''
94
+ base_path = relative_path.sub(/\.(erb|slim)$/, '')
95
+ redmine_template = redmine_views_root.join "#{base_path}.erb"
96
+
97
+ overwritten << "app/views/#{base_path}.erb" if File.exist? redmine_template
98
+ end
99
+
100
+ output_file = File.join plugin_path, '.overwritten_templates'
101
+ previous_content = if File.exist? output_file
102
+ lines = File.read(output_file).lines.map(&:strip)
103
+ lines.sort
104
+ else
105
+ []
106
+ end
107
+ new_content = overwritten.sort
108
+
109
+ if previous_content == new_content
110
+ puts "✔️ No changes for: #{File.basename plugin_path}"
111
+ else
112
+ File.write output_file, "#{new_content.join "\n"}\n"
113
+ puts "✅ Updated: #{output_file}"
114
+ end
115
+ end
116
+ end
82
117
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_plugin_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlphaNodes
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: deface
@@ -61,7 +60,6 @@ licenses:
61
60
  - GPL-2.0
62
61
  metadata:
63
62
  rubygems_mfa_required: 'true'
64
- post_install_message:
65
63
  rdoc_options: []
66
64
  require_paths:
67
65
  - lib
@@ -76,8 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
74
  - !ruby/object:Gem::Version
77
75
  version: '0'
78
76
  requirements: []
79
- rubygems_version: 3.4.19
80
- signing_key:
77
+ rubygems_version: 3.6.9
81
78
  specification_version: 4
82
79
  summary: Redmine plugin kit
83
80
  test_files: []