command_proposal 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1095c2b3d7207326a44dd3474916e7d3ce51008c95fd2005e30fa7a2b535d729
4
- data.tar.gz: e96c62233dbab18e5cc6c8cb33d53bb1fbe8f9b6bd8012b660cb0cfe834dd764
3
+ metadata.gz: a04686b93a2ae3d6583de7e04ea894d5a57076dec286cbb9897ccb1ae2740a10
4
+ data.tar.gz: 1fae20a33afea09026f2c4ea195370a9fcc58a0b62a27dae1da930dd6260e755
5
5
  SHA512:
6
- metadata.gz: 7c862c39b1e7349cbd286c457d858ad8fb101f0ed723afaaf9e3ababa8187cec993a0e53339d898e0a7b2a38488c510bf443b02f78b58c6108354862979d0f55
7
- data.tar.gz: 8b552be1f3e06b6d2292a4ea30dab48cdb71c99b32a3493d5ef636b283add4d736d8b8917c1c6c43630bbd5a5e039d5fa93b9c45175565ecc3e0327927c5f8aa
6
+ metadata.gz: ba73213cb6457ff53adc8990eed6b2787d9fe92577b63da6538d195ed41969d77e9591c77176da00698526c63a65ae95e25f9bf6b1424a3f8601fa439b0cd6a5
7
+ data.tar.gz: 1a5c1661b379c469f6bbf47d544b66be9d91fc417adc067dcc7126db4c17279b75017a6f2245f083b5b250b2de3e93a05e54d0068aff1e86607d56f4c934fdd0
@@ -19,10 +19,12 @@ module CommandProposal
19
19
  end
20
20
  }
21
21
  args << { host: host, port: nil } if host.present?
22
+ # args << {host: nil}
22
23
 
23
24
  begin
24
- command_proposal_engine.url_for(args.compact)
25
+ engine.url_for(args.compact)
25
26
  rescue NoMethodError => e
27
+ puts "\e[33m[LOGIT]#{e.inspect}\e[0m"
26
28
  raise "Error generating route! Please make sure `config.action_mailer.default_url_options` are set."
27
29
  end
28
30
  end
@@ -40,24 +42,31 @@ module CommandProposal
40
42
  end
41
43
 
42
44
  def string_path(*args)
43
- [command_proposal_engine.command_proposal_tasks_url + args.shift, args.to_param.presence].compact.join("?")
45
+ [engine.command_proposal_tasks_url + args.shift, args.to_param.presence].compact.join("?")
46
+ end
47
+
48
+ def engine
49
+ @engine ||= begin
50
+ name = `rails routes | grep command_proposal_engine`[/\w*command_proposal_engine/]
51
+ send(name)
52
+ end
44
53
  end
45
54
 
46
55
  # Runner controller doesn't map to a model, so needs special handling
47
56
  def runner_path(task, iteration=nil)
48
57
  if iteration.present?
49
- command_proposal_engine.command_proposal_task_runner_path(task, iteration)
58
+ engine.command_proposal_task_runner_path(task, iteration)
50
59
  else
51
- command_proposal_engine.command_proposal_task_runner_index_path(task)
60
+ engine.command_proposal_task_runner_index_path(task)
52
61
  end
53
62
  end
54
63
 
55
64
  # Runner controller doesn't map to a model, so needs special handling
56
65
  def runner_url(task, iteration=nil)
57
66
  if iteration.present?
58
- command_proposal_engine.command_proposal_task_runner_url(task, iteration)
67
+ engine.command_proposal_task_runner_url(task, iteration)
59
68
  else
60
- command_proposal_engine.command_proposal_task_runner_index_url(task)
69
+ engine.command_proposal_task_runner_index_url(task)
61
70
  end
62
71
  end
63
72
  end
@@ -86,7 +86,11 @@ module CommandProposal
86
86
  check_can_command?
87
87
  return unless @iteration.task.console?
88
88
 
89
- @task.first_iteration.update(status: :success, completed_at: Time.current)
89
+ if ::CommandProposal.sessions.key?("task:#{@task.id}")
90
+ @task.first_iteration.update(status: :success, completed_at: Time.current)
91
+ else
92
+ @task.first_iteration.update(status: :terminated, completed_at: Time.current)
93
+ end
90
94
  ::CommandProposal.sessions.delete("task:#{@task.id}")
91
95
  end
92
96
 
@@ -4,5 +4,5 @@
4
4
  # gem push command_proposal-__.gem
5
5
 
6
6
  module CommandProposal
7
- VERSION = '1.0.5'
7
+ VERSION = '1.0.6'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: command_proposal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rocco Nicholls
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-31 00:00:00.000000000 Z
11
+ date: 2021-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails