plug 0.1.18 → 0.1.19

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: 17245adbb4a40eb5803c13b66673dbe8dca1426ed1b9d383ed816462cc8aac16
4
- data.tar.gz: 682146cc143bbcf9069645a84efa0bd504554412c1edef1e8ddc7ce1aee9ea79
3
+ metadata.gz: a3e56677db5277835599245727b8f5a1ddc7b089a9261f788971c6de539279cd
4
+ data.tar.gz: 619eb3d58765d7fe2ae88e0d4cc784ce0df8cea15e2e580ce0228f335da1f175
5
5
  SHA512:
6
- metadata.gz: 2dd54c48452701b88d5c9b27b660c13669e6be9c29ba299a1c529a31f0ddedf4889ec5c3f362bc590184bfe9c1d7a5107672798c8248d0ffd33a1b93108d672d
7
- data.tar.gz: 2ce7133667279a12baa681b562c29b7709343cf35ea41a74dd3dfe709a374bb3ca6d7e691b3a47b39358288c9ea91a5cdf60eae10a05d2694bf26302995e4ff8
6
+ metadata.gz: 3993e47bb2626186d6057b0aed81651a3ae46d7daec51b56dfe9a8cfbe0a46c242edfc95a6080cefe651d641092b3e157746df03c2a6595a72e96b9b32bc0a56
7
+ data.tar.gz: 210f55299e22933f46c48d469fc423ec3b7c85cd8be76d7eddeee93ce96efab89f50f11ed2598d530911eb208057c9c6691114d38beba6ff9425fc6b3fc60386
@@ -54,10 +54,7 @@ module Plug
54
54
  # TODO: Move this to a separate controller e.g. `tasks_controller.rb`
55
55
  def task_execution
56
56
  begin
57
- require 'rake'
58
-
59
- Rails.application.load_tasks
60
- ::Rake::Task[params[:task]].execute
57
+ Plug::TaskExecutionService.new(name: params[:task]).call
61
58
  rescue StandardError => e
62
59
  flash[:alert] = e.message
63
60
  else
@@ -0,0 +1,18 @@
1
+ require 'rake'
2
+
3
+ module Plug
4
+ class TaskExecutionService
5
+ attr_reader :name
6
+
7
+ def initialize(name: nil)
8
+ raise 'Task name is required' if name.nil?
9
+
10
+ @name = name
11
+ end
12
+
13
+ def call
14
+ Rails.application.load_tasks
15
+ Rake::Task[name].execute
16
+ end
17
+ end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Plug
2
- VERSION = '0.1.18'
2
+ VERSION = '0.1.19'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-05-14 00:00:00.000000000 Z
12
+ date: 2020-06-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -237,6 +237,7 @@ files:
237
237
  - app/models/plug/feature.rb
238
238
  - app/models/plug/resources/site_notice.rb
239
239
  - app/models/plug/site_notice.rb
240
+ - app/services/plug/task_execution_service.rb
240
241
  - app/views/layouts/plug/application.html.haml
241
242
  - app/views/plug/features/_form.html.haml
242
243
  - app/views/plug/features/_task.html.haml