redmine_plugins_helper 0.9.4 → 0.10.0

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: 8927a0f697c1dc0130779e806f308216b9b6745a6b59d9289690d5b6b3c43f23
4
- data.tar.gz: 67a0982b9e2c9ed86f0ec64f713577d1278bc9e6821587c0309357bb0d08f2ef
3
+ metadata.gz: 747dc2f64ca0a3fdcbec5d50be57450f63a7c725654ee6dabee7e856c39ebac3
4
+ data.tar.gz: c7a1f9c07f653fec428625f5ab0486a313751b8940a322c98a6e14d34bcbafd8
5
5
  SHA512:
6
- metadata.gz: 18ca1a00d2431933e85434139afbff1c9e75eb23e249ea50f4ef136dc3a1526b84850cba4a2ff9baa488e1b79fc5b564b7b2e7db6a7ad3266bef12c7a595b11b
7
- data.tar.gz: 56a3ab367cdd9c5b0a3805b6db7884435ff13c8653732cbc0fd54382ddf4570423e4af4fbedc95ff59deeb26b125ecda9dd02e4794078c023b815d7506ee9820
6
+ metadata.gz: 8dde27c9f58ac5cdf5cc87c231b374f9d68896ea9a85c3fdf370c73ccfbd37b3deaf8e0575622c941b10f3c6d32372c632329b1e0d784d8bdc82ec639edce174
7
+ data.tar.gz: 74ce1473a20c49d9910de3496a6eb07a92c5a9f26f0c4d6da6d4c9ada1fb511040079473898ea519b4a8574b946ace508c0dd49fa02c7d3af74df3a08b8f031a
@@ -0,0 +1,25 @@
1
+ module RedminePluginsHelper
2
+ module Available
3
+ class << self
4
+ def database?
5
+ ::ActiveRecord::Base.connection
6
+ rescue ActiveRecord::NoDatabaseError
7
+ false
8
+ else
9
+ true
10
+ end
11
+
12
+ def model?(model_class)
13
+ table?(model_class.table_name)
14
+ end
15
+
16
+ def table?(table_name)
17
+ database? && ::ActiveRecord::Base.connection.table_exists?(table_name)
18
+ end
19
+
20
+ def settings?
21
+ model?(::Setting)
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,12 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_dependency 'redmine_plugins_helper'
3
+ require_dependency 'redmine_plugins_helper/available'
4
4
 
5
5
  module RedminePluginsHelper
6
6
  class Settings
7
7
  class << self
8
8
  def default(plugin, default)
9
- return unless ::RedminePluginsHelper.settings_table_exist?
9
+ return unless ::RedminePluginsHelper::Available.settings?
10
10
 
11
11
  p = plugin_current_setting_value(plugin)
12
12
  default.each do |k, v|
@@ -3,5 +3,5 @@
3
3
  module RedminePluginsHelper
4
4
  AUTHOR = 'Eduardo Henrique Bogoni'
5
5
  SUMMARY = 'Helper for Redmine plugins'
6
- VERSION = '0.9.4'
6
+ VERSION = '0.10.0'
7
7
  end
@@ -3,9 +3,4 @@
3
3
  require 'sass-rails'
4
4
 
5
5
  module RedminePluginsHelper
6
- class << self
7
- def settings_table_exist?
8
- ActiveRecord::Base.connection.table_exists? ::Setting.table_name
9
- end
10
- end
11
6
  end
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redmine_plugins_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.4
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
- - 0.9.4
7
+ - 0.10.0
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
@@ -112,6 +112,7 @@ files:
112
112
  - config/initializers/backport_pg_10_support_to_rails_4.rb
113
113
  - init.rb
114
114
  - lib/redmine_plugins_helper.rb
115
+ - lib/redmine_plugins_helper/available.rb
115
116
  - lib/redmine_plugins_helper/fix_migrations.rb
116
117
  - lib/redmine_plugins_helper/hooks/add_assets.rb
117
118
  - lib/redmine_plugins_helper/migrate.rb