|
1 | 1 | require 'redmine' |
2 | 2 | require 'email_configurations_hooks' |
3 | 3 |
|
4 | | -Redmine::Plugin.register :redmine_email_fetcher do |
5 | | - name 'Redmine Email Fetcher plugin' |
6 | | - author 'Luis Maia' |
7 | | - description 'This plugin allow us to configure several IMAP and POP3 email accounts from where emails can be fetch to Redmine' |
8 | | - version '0.0.1' |
9 | | - url 'https://github.com/luismaia/redmine_email_fetcher' |
10 | | - author_url 'https://github.com/luismaia' |
11 | | - |
12 | | - menu :admin_menu, :email_configurations, {controller: 'email_configurations', action: 'index'}, caption: :title_email_configurations |
| 4 | +if RUBY_VERSION < '1.9' |
| 5 | + ruby_version_error = '*** error redmine_email_fetcher: This plugin (redmine_email_fetcher) was not installed, '\ |
| 6 | + 'since it requires a Ruby version equal or higher than 1.9 (and your Ruby version '\ |
| 7 | + "is #{RUBY_VERSION})" |
| 8 | + |
| 9 | + # Rails.logger.error ruby_version_error |
| 10 | + puts ruby_version_error |
| 11 | + |
| 12 | +elsif Rails::VERSION::MAJOR < 3 |
| 13 | + rails_version_error = '*** error redmine_email_fetcher: This plugin (redmine_email_fetcher) was not installed, '\ |
| 14 | + 'since it requires a Rails version equal or higher than 3 (and your Rails version '\ |
| 15 | + "is #{Rails::VERSION::MAJOR})" |
| 16 | + |
| 17 | + # Rails.logger.error rails_version_error |
| 18 | + puts rails_version_error |
| 19 | + |
| 20 | +else |
| 21 | + Redmine::Plugin.register :redmine_email_fetcher do |
| 22 | + name 'Redmine Email Fetcher plugin' |
| 23 | + author 'Luis Maia' |
| 24 | + description 'This plugin allows the configuration of several IMAP and POP3 email accounts'\ |
| 25 | + 'from where emails can be fetch into Redmine' |
| 26 | + version '0.0.2' |
| 27 | + url 'https://github.com/luismaia/redmine_email_fetcher' |
| 28 | + author_url 'https://github.com/luismaia' |
| 29 | + requires_redmine version_or_higher: '2.1.0' |
| 30 | + |
| 31 | + menu :admin_menu, |
| 32 | + :email_configurations, |
| 33 | + { controller: 'email_configurations', action: 'index' }, |
| 34 | + caption: :title_email_configurations |
| 35 | + end |
| 36 | + |
| 37 | + # puts 'This plugin works with the current Ruby, Rails and Redmine versions' |
13 | 38 | end |
0 commit comments