web47command 0.0.1 → 0.0.2

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: b814dd9f0d828dafba8d68fbc7afdd1b201a1d9ecb6dac8b844d93ae07025b3a
4
- data.tar.gz: 21c18f8d721ae3a2e65f60d9dd39a67e61e2e64b41de447a77a2eb7e15d3cf35
3
+ metadata.gz: e041303b05e1d85a36072634de3396c6722b8b4789b7fcc78d9099f876c208f8
4
+ data.tar.gz: 64c78bc05a3a2fcb38c164186558aeab8e4cffad9b880ce0974769eab4fbbc08
5
5
  SHA512:
6
- metadata.gz: 7807c3c193bcb942db4c70da4c0474635813d4c67cba2ebac356a03529f01e963f1d5a4b083e9edbdc25e97107c8765d44072af917c7d9966acbbac8854213c6
7
- data.tar.gz: cebde8c5a6d33d0d514ed31fe7682296d1d922ac619f717ee0c69b7c258193887e31a32f298d4a07c5ee0069774b4a0afb49f9c16d87588233adb62d05ace6e8
6
+ metadata.gz: '08bd97add54ae82aa6b3f9ce6de8a4947275b2065c286eb8d049c6b4e75705d29cd6a713c0b37a6e45d14f4bc3be9ed0ab6ac764c51a5db5270ea28ca5416d10'
7
+ data.tar.gz: 4ed492b6ad8442e267a5430acde97a86ef464d05dbc7b3c9fa38736ab154327188bb745c566a3e146f0a8e1a7c6a39ce9185f56309c9b1e292f9f7eb738a9062
@@ -25,7 +25,7 @@ class CommandJob
25
25
  #
26
26
  # Relationships
27
27
  #
28
- has_many :logs, class_name: 'JobLog', dependent: :destroy
28
+ has_many :logs, class_name: 'CommandJobLog', dependent: :destroy
29
29
  #
30
30
  # Validations
31
31
  #
@@ -225,7 +225,7 @@ class CommandJob
225
225
  end
226
226
  output = 'Success' if output.blank?
227
227
  command = mask_keywords(command, options[:mask_texts])
228
- CommandJobLog.create!(job: self, dir: dir, command: command, message: output)
228
+ logs.create!(dir: dir, command: command, message: output)
229
229
  check_for_text(output, options[:error_texts], true)
230
230
  check_for_text(output, options[:required_texts], false)
231
231
  output
@@ -264,6 +264,6 @@ class CommandJob
264
264
  # Add a job log message
265
265
  #
266
266
  def add_log(message)
267
- JobLog.create!(job: self, message: message)
267
+ logs.create!(message: message)
268
268
  end
269
269
  end
@@ -3,21 +3,31 @@
3
3
  #
4
4
  # Capture command log messages for a given job
5
5
  #
6
- class CommandJobLog < JobLog
6
+ class CommandJobLog
7
+ include StandardModel
7
8
  #
8
9
  # Fields
9
10
  #
11
+ field :message, type: String
10
12
  field :command, type: String
11
13
  field :dir, type: String
12
14
  #
15
+ # Relationships
16
+ #
17
+ belongs_to :job, inverse_of: :logs, class_name: 'CommandJob'
18
+ #
13
19
  # Validations
14
20
  #
15
- validates :command, presence: true
21
+ validates :message, presence: true
16
22
 
17
23
  #
18
24
  # Display message
19
25
  #
20
26
  def display_message
21
- "Dir: #{dir}\nCommand: #{command}\nOutput: #{message}"
27
+ if dir.present?
28
+ "Dir: #{dir}\nCommand: #{command}\nOutput: #{message}"
29
+ else
30
+ message
31
+ end
22
32
  end
23
33
  end
data/lib/web47command.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'web47command/version'
2
- require 'app/models/job_log'
3
2
  require 'app/models/command_job_log'
4
3
  require 'app/models/command_job'
5
4
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47command
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web47command
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schroeder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-10 00:00:00.000000000 Z
11
+ date: 2020-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -314,7 +314,6 @@ files:
314
314
  - lib/app/jobs/cron/trim_jobs.rb
315
315
  - lib/app/models/command_job.rb
316
316
  - lib/app/models/command_job_log.rb
317
- - lib/app/models/job_log.rb
318
317
  - lib/web47command.rb
319
318
  - lib/web47command/version.rb
320
319
  homepage: https://app47.com
@@ -1,27 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- #
4
- # Capture log messages for a given job
5
- #
6
- class JobLog
7
- include StandardModel
8
- #
9
- # Fields
10
- #
11
- field :message, type: String
12
- #
13
- # Relationships
14
- #
15
- belongs_to :job, inverse_of: :logs, class_name: 'CommandJob'
16
- #
17
- # Validations
18
- #
19
- validates :message, presence: true
20
-
21
- #
22
- # Display message
23
- #
24
- def display_message
25
- message
26
- end
27
- end