redmine_tasks_scheduler 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c00af4b7f7ab258d4427813a2ab061bbf65e2444fa1e6502421226f1775fe23d
4
+ data.tar.gz: b21fa1eceaecdb2579b6d097a5153dace4852a2f0a011316758ea5722966889a
5
+ SHA512:
6
+ metadata.gz: 1dc434430aa865bf79338533a14107dd7f70272f6dba7e72080fbe7d5e6cf5cea61dc9c8a41384362a7ea6e893f833facca09cea7f462130f9d5d5654365ef57
7
+ data.tar.gz: a2c1421a2fda981a29139b961419f032df3aeb2f7ddabf3e4b003d7cbd263ffd9541312ea697c492631de5512be3d3d24c01150e0b3b21908db33b93bbc587f2
@@ -0,0 +1,24 @@
1
+ //= require 'tasks_scheduler'
2
+
3
+ _A = TasksScheduler.Alert;
4
+ _A.refresh = function () {
5
+ $.ajax({
6
+ url: _A.url,
7
+ global: false,
8
+ success: function (result) {
9
+ var alert = $(_A.options.element_selector);
10
+ var pattern = new RegExp('(^|\\s)' + _A.CSS_CLASSES_PREFIX + "\\S+", 'g');
11
+ alert.removeClass(function (index, className) {
12
+ return (className.match(pattern) || []).join(' ');
13
+ });
14
+ alert.addClass(_A.resultToCssClass(result));
15
+ },
16
+ complete: function (result) {
17
+ _A.setNextRefresh();
18
+ }
19
+ });
20
+ };
21
+
22
+ TasksScheduler.Alert.init({
23
+ element_selector: '.tasks-scheduler-alert'
24
+ });
@@ -0,0 +1,16 @@
1
+ @import 'tasks_scheduler';
2
+
3
+ #top-menu .tasks-scheduler-alert {
4
+ background-image: url('../../../images/warning.png');
5
+ background-position: 0% 40%;
6
+ background-repeat: no-repeat;
7
+ padding-left: 20px;
8
+ padding-top: 2px;
9
+ padding-bottom: 3px;
10
+ display: none;
11
+ }
12
+
13
+ #top-menu .alert_daemon_stopped,
14
+ #top-menu .alert_task_failed {
15
+ display: initial;
16
+ }
@@ -0,0 +1,9 @@
1
+ <p>
2
+ <label><%= t('redmine_tasks_scheduler.daemon_autostart_description') %></label>
3
+ <select name="settings[daemon_autostart]">
4
+ <%= options_for_select(
5
+ [[t(:general_text_No), '0'], [t(:general_text_Yes), '1']],
6
+ settings[:daemon_autostart]
7
+ ) %>
8
+ </select>
9
+ </p>
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ Redmine::Plugin.by_path(__FILE__).instance_eval do
4
+ # Source: https://github.com/esquilo-azul/redmine_nonproject_modules
5
+ requires_redmine_plugin(:redmine_nonproject_modules, version_or_higher: '0.2.1')
6
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency 'redmine_tasks_scheduler/patches/tasks_scheduler_controller_patch'
4
+ GroupPermission.add_permission(::TasksSchedulerDaemonController::PERMISSIONS)
5
+ Redmine::MenuManager.map :top_menu do |menu|
6
+ menu.push :tasks_scheduler_alert,
7
+ { controller: 'tasks_scheduler_daemon', action: 'index', id: nil },
8
+ caption: '', last: true, if: proc { ::TasksSchedulerDaemonController::PERMISSIONS }
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ if ::RedmineTasksScheduler::Settings.daemon_autostart &&
4
+ ::RedmineNonprojectModules::DispatcherFinder.dispatcher &&
5
+ !::TasksScheduler::Daemon.running?
6
+ ::TasksScheduler::Daemon.execute('start')
7
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency 'redmine_tasks_scheduler/patches/tasks_scheduler_controller_patch'
4
+ GroupPermission.add_permission(::ScheduledTasksController::PERMISSIONS)
5
+ Redmine::MenuManager.map :admin_menu do |menu|
6
+ menu.push :scheduled_tasks, { controller: 'scheduled_tasks', action: 'status', id: nil },
7
+ caption: :'activerecord.models.scheduled_task.other',
8
+ if: proc { GroupPermission.permission?(::ScheduledTasksController::PERMISSIONS) }
9
+ end
@@ -0,0 +1,4 @@
1
+ pt-BR:
2
+ redmine_tasks_scheduler:
3
+ daemon_autostart_description: Inicializar Daemon automaticamente junto com
4
+ o servidor?
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ RedmineApp::Application.routes.draw do
4
+ mount TasksScheduler::Engine, at: '/'
5
+ end
data/init.rb ADDED
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'redmine'
4
+ require 'active_scaffold'
5
+ ActiveScaffold.delayed_setup = true
6
+
7
+ Redmine::Plugin.register :redmine_tasks_scheduler do
8
+ name 'Redmine Tasks Scheduler'
9
+ author 'eduardobogoni@gmail.com'
10
+ description 'Scheduler for rake tasks on Redmine.'
11
+ version '0.2.2'
12
+ settings default: { 'daemon_autostart' => '1' }, partial: 'settings/redmine_tasks_scheduler'
13
+ end
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'tasks_scheduler'
4
+
5
+ module RedmineTasksScheduler
6
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RedmineTasksScheduler
4
+ module Patches
5
+ module TasksSchedulerControllerPatch
6
+ def self.included(base)
7
+ base.const_set('PERMISSIONS', 'scheduled_tasks')
8
+ base.class_eval do
9
+ unloadable
10
+
11
+ require_permission const_get('PERMISSIONS')
12
+ layout 'admin'
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ [::ScheduledTasksController, ::TasksSchedulerDaemonController].each do |controller_class|
20
+ patch_class = ::RedmineTasksScheduler::Patches::TasksSchedulerControllerPatch
21
+ unless controller_class.included_modules.include?(patch_class)
22
+ controller_class.send(:include, patch_class)
23
+ end
24
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RedmineTasksScheduler
4
+ class Settings
5
+ class << self
6
+ def daemon_autostart
7
+ return false unless settings_table_exist?
8
+
9
+ ::Setting.plugin_redmine_tasks_scheduler[:daemon_autostart] == '1'
10
+ end
11
+
12
+ private
13
+
14
+ def settings_table_exist?
15
+ ::Setting.connection.table_exists? ::Setting.table_name
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RedmineTasksScheduler
4
+ AUTHOR = 'Eduardo Henrique Bogoni'
5
+ HOMEPAGE = 'https://github.com/esquilo-azul/redmine_tasks_scheduler'
6
+ SUMMARY = 'Scheduler for rake tasks on Redmine.'
7
+ VERSION = '0.3.0'
8
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: redmine_tasks_scheduler
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - 0.3.0
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-08-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tasks_scheduler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.5'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.5'
27
+ - !ruby/object:Gem::Dependency
28
+ name: eac_ruby_gem_support
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.1'
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: 0.1.2
37
+ type: :development
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - "~>"
42
+ - !ruby/object:Gem::Version
43
+ version: '0.1'
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 0.1.2
47
+ description:
48
+ email:
49
+ executables: []
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - app/assets/javascripts/redmine_tasks_scheduler.js
54
+ - app/assets/stylesheets/redmine_tasks_scheduler.css
55
+ - app/views/settings/_redmine_tasks_scheduler.html.erb
56
+ - config/initializers/000_dependencies.rb
57
+ - config/initializers/alert.rb
58
+ - config/initializers/daemon_auto_start.rb
59
+ - config/initializers/menu.rb
60
+ - config/locales/pt-BR.yml
61
+ - config/routes.rb
62
+ - init.rb
63
+ - lib/redmine_tasks_scheduler.rb
64
+ - lib/redmine_tasks_scheduler/patches/tasks_scheduler_controller_patch.rb
65
+ - lib/redmine_tasks_scheduler/settings.rb
66
+ - lib/redmine_tasks_scheduler/version.rb
67
+ homepage: https://github.com/esquilo-azul/redmine_tasks_scheduler
68
+ licenses: []
69
+ metadata: {}
70
+ post_install_message:
71
+ rdoc_options: []
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ required_rubygems_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ requirements: []
85
+ rubygems_version: 3.0.6
86
+ signing_key:
87
+ specification_version: 4
88
+ summary: Scheduler for rake tasks on Redmine.
89
+ test_files: []