invoker 1.5.4 → 1.5.5

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
  SHA1:
3
- metadata.gz: 174f97bf4ba760cca1391b8c904114e7949c9dbd
4
- data.tar.gz: 3fc440a77808ed5fe86f4b344f015f6c866a52b2
3
+ metadata.gz: 94d07aee24e9bfaca5d95b721d38c8b6396b996f
4
+ data.tar.gz: 0623bb80d7a17b18e6e9f7371c62104a4d22323a
5
5
  SHA512:
6
- metadata.gz: 58a73394506ed9427f8637c46794643a37c1de4517a48786310e36f5f89f2a9f71c8c8ce6d157cc2798af6a9e2d78262d1362cabaf5f6378e827cbaeae20910c
7
- data.tar.gz: ce5a29570d59711eee4683533bfdc6668581ff23908abd53dc6e71279551b7679856838269bb02d4ce190f929ff02a08ce87fb17efd6aa6bb27a2b7cb0585307
6
+ metadata.gz: 6ecb8ff338d9d7824d151e20a30bd7874987a4f03d645cb6787aeb71ca298b673b1e51d62d120a7229fec1fd339f29c9e9a31fa5887745adc3846018cb638444
7
+ data.tar.gz: f8be5f264d28794ef11e1d023892afc4421e65cc0d840ddb7381eb57be981dffa18cff2f0ab0b50a037102579d52f3d771d00269ce169412db9942da3722d7c2
@@ -7,4 +7,6 @@ rvm:
7
7
  - 2.2.0
8
8
  - 2.3.0
9
9
 
10
+ before_install:
11
+ - gem update bundler --no-document
10
12
  script: bundle exec rake spec
@@ -1,6 +1,12 @@
1
1
  ## Changelog since 1.5.4
2
2
 
3
3
 
4
+
5
+ # v1.5.5
6
+ * Fix high cpu usage when process managed by Invoker crashes and Invoker doesn't read from its socket.(https://github.com/code-mancers/invoker/pull/198)
7
+ * Allow users to specify custom ssl certificate and key (https://github.com/code-mancers/invoker/pull/199)
8
+ * Remove rainbow dependency and migrate to colorize
9
+
4
10
  # v1.5.4
5
11
  * Add support for running Invoker build in SELinux environments (https://github.com/code-mancers/invoker/pull/188)
6
12
  * Add an option to print process listing in raw format. This enables us to see complete process list (https://github.com/code-mancers/invoker/pull/193)
@@ -0,0 +1,2 @@
1
+ puts "Starting this process"
2
+ exit(-1)
@@ -1,3 +1,7 @@
1
1
  [rails]
2
2
  directory = ./examples
3
3
  command = ruby hello_sinatra.rb -p $PORT
4
+
5
+ [crash]
6
+ directory = ./examples
7
+ command = ruby crash.rb
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.require_paths = ["lib"]
27
27
  s.summary = %q{Something small for Process management}
28
28
  s.add_dependency("thor", "~> 0.19")
29
- s.add_dependency("rainbow", "~> 2.1.0")
29
+ s.add_dependency("colorize", "~> 0.8.1")
30
30
  s.add_dependency("iniparse", "~> 1.1")
31
31
  s.add_dependency("formatador", "~> 0.2")
32
32
  s.add_dependency("eventmachine", "~> 1.0.4")
@@ -6,8 +6,7 @@ require "formatador"
6
6
  require "ostruct"
7
7
  require "uuid"
8
8
  require "json"
9
- require "rainbow"
10
- require "rainbow/ext/string"
9
+ require "colorize"
11
10
  require "etc"
12
11
 
13
12
  require "invoker/version"
@@ -36,7 +35,7 @@ require "invoker/process_printer"
36
35
  module Invoker
37
36
  class << self
38
37
  attr_accessor :config, :tail_watchers, :commander
39
- attr_accessor :dns_cache, :daemonize, :nocolors
38
+ attr_accessor :dns_cache, :daemonize, :nocolors, :certificate, :private_key
40
39
 
41
40
  alias_method :daemonize?, :daemonize
42
41
  alias_method :nocolors?, :nocolors
@@ -74,7 +73,7 @@ module Invoker
74
73
  return true if File.exist?(Invoker::Power::Config.config_file)
75
74
 
76
75
  if throw_warning
77
- Invoker::Logger.puts("Invoker has detected setup has not been run. Domain feature will not work without running setup command.".color(:red))
76
+ Invoker::Logger.puts("Invoker has detected setup has not been run. Domain feature will not work without running setup command.".colorize(:red))
78
77
  end
79
78
  false
80
79
  end
@@ -41,16 +41,24 @@ module Invoker
41
41
  type: :boolean,
42
42
  banner: "Disable color in output",
43
43
  aliases: [:nc]
44
+ option :certificate,
45
+ type: :string,
46
+ banner: "Path to certificate"
47
+ option :private_key,
48
+ type: :string,
49
+ banner: "Path to private key"
44
50
  def start(file = nil)
45
51
  Invoker.setup_config_location
46
52
  port = options[:port] || 9000
47
53
  Invoker.daemonize = options[:daemon]
48
54
  Invoker.nocolors = options[:nocolors]
55
+ Invoker.certificate = options[:certificate]
56
+ Invoker.private_key = options[:private_key]
49
57
  Invoker.load_invoker_config(file, port)
50
58
  warn_about_notification
51
59
  warn_about_old_configuration
52
60
  pinger = Invoker::CLI::Pinger.new(unix_socket)
53
- abort("Invoker is already running".color(:red)) if pinger.invoker_running?
61
+ abort("Invoker is already running".colorize(:red)) if pinger.invoker_running?
54
62
  Invoker.commander.start_manager
55
63
  end
56
64
 
@@ -150,7 +158,7 @@ module Invoker
150
158
  require "libnotify"
151
159
  rescue LoadError
152
160
  Invoker::Logger.puts "You can install libnotify gem for Invoker notifications "\
153
- "via system tray".color(:red)
161
+ "via system tray".colorize(:red)
154
162
  end
155
163
 
156
164
  def warn_about_terminal_notifier
@@ -158,7 +166,7 @@ module Invoker
158
166
  command_path = `which terminal-notifier`
159
167
  if !command_path || command_path.empty?
160
168
  Invoker::Logger.puts "You can enable OSX notification for processes "\
161
- "by installing terminal-notifier gem".color(:red)
169
+ "by installing terminal-notifier gem".colorize(:red)
162
170
  end
163
171
  end
164
172
  end
@@ -25,7 +25,7 @@ module Invoker
25
25
  # Print the lines received over the network
26
26
  def receive_line(line)
27
27
  tail_watchers = Invoker.tail_watchers[@command_label]
28
- color_line = "#{@command_label.color(color)} : #{line}"
28
+ color_line = "#{@command_label.colorize(color)} : #{line}"
29
29
  plain_line = "#{@command_label} : #{line}"
30
30
  if Invoker.nocolors?
31
31
  Invoker::Logger.puts plain_line
@@ -28,7 +28,7 @@ module Invoker
28
28
  begin
29
29
  socket = Socket.unix(Invoker::IPC::Server::SOCKET_PATH)
30
30
  rescue
31
- abort("Invoker does not seem to be running".color(:red))
31
+ abort("Invoker does not seem to be running".colorize(:red))
32
32
  end
33
33
  message_object = get_message_object(command, message)
34
34
  send_json_message(socket, message_object)
@@ -49,7 +49,7 @@ module Invoker
49
49
  def open_client_socket(abort_if_not_running = true)
50
50
  Socket.unix(Invoker::IPC::Server::SOCKET_PATH) { |socket| yield socket }
51
51
  rescue
52
- abort_if_not_running && abort("Invoker does not seem to be running".color(:red))
52
+ abort_if_not_running && abort("Invoker does not seem to be running".colorize(:red))
53
53
  end
54
54
 
55
55
  def send_json_message(socket, message_object)
@@ -90,7 +90,7 @@ module Invoker
90
90
  end
91
91
 
92
92
  def print_message_and_abort
93
- Invoker::Logger.puts("\n Invalid config file. Invoker requires an ini or a Procfile.".color(:red))
93
+ Invoker::Logger.puts("\n Invalid config file. Invoker requires an ini or a Procfile.".colorize(:red))
94
94
  abort
95
95
  end
96
96
 
@@ -17,7 +17,7 @@ module Invoker
17
17
  class InvokerHttpsProxy < InvokerHttpProxy
18
18
  def post_init
19
19
  super
20
- start_tls
20
+ start_tls(private_key_file: Invoker.private_key, cert_chain_file: Invoker.certificate)
21
21
  end
22
22
  end
23
23
 
@@ -17,7 +17,7 @@ module Invoker
17
17
  osx_setup.install_firewall(Invoker.config.http_port, Invoker.config.https_port)
18
18
  drop_to_normal_user
19
19
  Invoker::Logger.puts "Invoker has updated its configuration for yosemite."\
20
- " Please restart OSX to complete the configuration process.".color(:red)
20
+ " Please restart OSX to complete the configuration process.".colorize(:red)
21
21
  exit(-1)
22
22
  end
23
23
  end
@@ -27,7 +27,7 @@ module Invoker
27
27
  Invoker::Logger.puts "Invoker has detected you are running OSX 10.10 "\
28
28
  " but your invoker configuration does not support it."
29
29
  Invoker::Logger.puts "Invoker can update its configuration automaticaly"\
30
- " but it will require a system reboot.".color(:red)
30
+ " but it will require a system reboot.".colorize(:red)
31
31
  Invoker::CLI::Question.agree("Update Invoker configuration (y/n) :")
32
32
  else
33
33
  true
@@ -26,7 +26,7 @@ module Invoker
26
26
 
27
27
  def initialize(tld)
28
28
  if tld !~ /^[a-z]+$/
29
- Invoker::Logger.puts("Please specify valid tld".color(:red))
29
+ Invoker::Logger.puts("Please specify valid tld".colorize(:red))
30
30
  exit(1)
31
31
  end
32
32
  self.tld = tld
@@ -36,7 +36,7 @@ module Invoker
36
36
  if check_if_setup_can_run?
37
37
  setup_invoker
38
38
  else
39
- Invoker::Logger.puts("The setup has been already run.".color(:red))
39
+ Invoker::Logger.puts("The setup has been already run.".colorize(:red))
40
40
  end
41
41
  self
42
42
  end
@@ -77,7 +77,7 @@ module Invoker
77
77
  begin
78
78
  safe_remove_file(resolver_file)
79
79
  rescue Errno::EACCES
80
- Invoker::Logger.puts("Running uninstall requires root access, please rerun it with sudo".color(:red))
80
+ Invoker::Logger.puts("Running uninstall requires root access, please rerun it with sudo".colorize(:red))
81
81
  raise
82
82
  end
83
83
  end
@@ -19,7 +19,7 @@ module Invoker
19
19
  drop_to_normal_user
20
20
  create_config_file
21
21
  else
22
- Invoker::Logger.puts("Invoker is not configured to serve from subdomains".color(:red))
22
+ Invoker::Logger.puts("Invoker is not configured to serve from subdomains".colorize(:red))
23
23
  end
24
24
  self
25
25
  end
@@ -17,7 +17,7 @@ module Invoker
17
17
  drop_to_normal_user
18
18
  create_config_file
19
19
  else
20
- Invoker::Logger.puts("Invoker is not configured to serve from subdomains".color(:red))
20
+ Invoker::Logger.puts("Invoker is not configured to serve from subdomains".colorize(:red))
21
21
  end
22
22
  self
23
23
  end
@@ -42,7 +42,7 @@ module Invoker
42
42
  def install_resolver(dns_port)
43
43
  open_resolver_for_write { |fl| fl.write(resolve_string(dns_port)) }
44
44
  rescue Errno::EACCES
45
- Invoker::Logger.puts("Running setup requires root access, please rerun it with sudo".color(:red))
45
+ Invoker::Logger.puts("Running setup requires root access, please rerun it with sudo".colorize(:red))
46
46
  raise
47
47
  end
48
48
 
@@ -110,7 +110,7 @@ port #{dns_port}
110
110
  return true unless File.exist?(resolver_file)
111
111
 
112
112
  Invoker::Logger.puts "Invoker has detected an existing Pow installation. We recommend "\
113
- "that you uninstall pow and rerun this setup.".color(:red)
113
+ "that you uninstall pow and rerun this setup.".colorize(:red)
114
114
  Invoker::Logger.puts "If you have already uninstalled Pow, proceed with installation"\
115
115
  " by pressing y/n."
116
116
  replace_resolver_flag = Invoker::CLI::Question.agree("Replace Pow configuration (y/n) : ")
@@ -118,7 +118,7 @@ port #{dns_port}
118
118
  if replace_resolver_flag
119
119
  Invoker::Logger.puts "Invoker has overwritten one or more files created by Pow. "\
120
120
  "If .#{tld} domains still don't resolve locally, try turning off the wi-fi"\
121
- " and turning it on. It'll force OS X to reload network configuration".color(:green)
121
+ " and turning it on. It'll force OS X to reload network configuration".colorize(:green)
122
122
  end
123
123
  replace_resolver_flag
124
124
  end
@@ -30,7 +30,7 @@ module Invoker
30
30
  # @param process_name [String] Command label of process specified in config file.
31
31
  def start_process_by_name(process_name)
32
32
  if process_running?(process_name)
33
- Invoker::Logger.puts "\nProcess '#{process_name}' is already running".color(:red)
33
+ Invoker::Logger.puts "\nProcess '#{process_name}' is already running".colorize(:red)
34
34
  return false
35
35
  end
36
36
 
@@ -49,7 +49,7 @@ module Invoker
49
49
  return false unless worker
50
50
  signal_to_use = remove_message.signal || 'INT'
51
51
 
52
- Invoker::Logger.puts("Removing #{command_label} with signal #{signal_to_use}".color(:red))
52
+ Invoker::Logger.puts("Removing #{command_label} with signal #{signal_to_use}".colorize(:red))
53
53
  kill_or_remove_process(worker.pid, signal_to_use, command_label)
54
54
  end
55
55
 
@@ -128,7 +128,7 @@ module Invoker
128
128
  thread = Thread.new do
129
129
  Process.wait(pid)
130
130
  message = "Process with command #{command_label} exited with status #{$?.exitstatus}"
131
- Invoker::Logger.puts("\n#{message}".color(:red))
131
+ Invoker::Logger.puts("\n#{message}".colorize(:red))
132
132
  Invoker.notify_user(message)
133
133
  Invoker.commander.trigger(command_label, :exit)
134
134
  end
@@ -149,7 +149,7 @@ module Invoker
149
149
  process_kill(pid, signal_to_use)
150
150
  true
151
151
  rescue Errno::ESRCH
152
- Invoker::Logger.puts("Killing process with #{pid} and name #{command_label} failed".color(:red))
152
+ Invoker::Logger.puts("Killing process with #{pid} and name #{command_label} failed".colorize(:red))
153
153
  remove_worker(command_label, false)
154
154
  false
155
155
  end
@@ -19,18 +19,29 @@ module Invoker
19
19
 
20
20
  def process_read(ready_fd)
21
21
  command_worker = Invoker.commander.get_worker_from_fd(ready_fd)
22
- return unless command_worker
23
22
  begin
24
23
  data = read_data(ready_fd)
25
- command_worker.receive_data(data)
24
+ send_data_to_worker(data, command_worker)
26
25
  rescue Invoker::Errors::ProcessTerminated
27
- remove_from_read_monitoring(command_worker.pipe_end, command_worker)
26
+ remove_from_read_monitoring(command_worker, ready_fd)
27
+ end
28
+ end
29
+
30
+ def send_data_to_worker(data, command_worker)
31
+ if command_worker
32
+ command_worker.receive_data(data)
33
+ else
34
+ Invoker::Logger.puts("No reader found for incoming data")
28
35
  end
29
36
  end
30
37
 
31
- def remove_from_read_monitoring(fd, command_worker)
32
- read_array.delete(fd)
33
- command_worker.unbind
38
+ def remove_from_read_monitoring(command_worker, ready_fd)
39
+ if command_worker
40
+ read_array.delete(command_worker.pipe_end)
41
+ command_worker.unbind
42
+ else
43
+ read_array.delete(ready_fd)
44
+ end
34
45
  rescue StandardError => error
35
46
  Invoker::Logger.puts(error.message)
36
47
  Invoker::Logger.puts(error.backtrace)
@@ -43,5 +43,5 @@ module Invoker
43
43
  Version.new(next_splits.join('.'))
44
44
  end
45
45
  end
46
- VERSION = "1.5.4"
46
+ VERSION = "1.5.5"
47
47
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invoker
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.4
4
+ version: 1.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hemant Kumar
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-07-22 00:00:00.000000000 Z
12
+ date: 2017-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -26,19 +26,19 @@ dependencies:
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0.19'
28
28
  - !ruby/object:Gem::Dependency
29
- name: rainbow
29
+ name: colorize
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - "~>"
33
33
  - !ruby/object:Gem::Version
34
- version: 2.1.0
34
+ version: 0.8.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
- version: 2.1.0
41
+ version: 0.8.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: iniparse
44
44
  requirement: !ruby/object:Gem::Requirement
@@ -242,6 +242,7 @@ files:
242
242
  - bin/invoker
243
243
  - contrib/completion/invoker-completion.bash
244
244
  - contrib/completion/invoker-completion.zsh
245
+ - examples/crash.rb
245
246
  - examples/hello_sinatra.rb
246
247
  - examples/sample.ini
247
248
  - invoker.gemspec
@@ -355,36 +356,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
355
356
  version: '0'
356
357
  requirements: []
357
358
  rubyforge_project:
358
- rubygems_version: 2.5.1
359
+ rubygems_version: 2.6.11
359
360
  signing_key:
360
361
  specification_version: 4
361
362
  summary: Something small for Process management
362
- test_files:
363
- - spec/invoker/cli/pinger_spec.rb
364
- - spec/invoker/cli/tail_watcher_spec.rb
365
- - spec/invoker/cli_spec.rb
366
- - spec/invoker/command_worker_spec.rb
367
- - spec/invoker/commander_spec.rb
368
- - spec/invoker/config_spec.rb
369
- - spec/invoker/daemon_spec.rb
370
- - spec/invoker/event/manager_spec.rb
371
- - spec/invoker/invoker_spec.rb
372
- - spec/invoker/ipc/client_handler_spec.rb
373
- - spec/invoker/ipc/dns_check_command_spec.rb
374
- - spec/invoker/ipc/message/list_response_spec.rb
375
- - spec/invoker/ipc/message_spec.rb
376
- - spec/invoker/ipc/unix_client_spec.rb
377
- - spec/invoker/power/balancer_spec.rb
378
- - spec/invoker/power/config_spec.rb
379
- - spec/invoker/power/http_parser_spec.rb
380
- - spec/invoker/power/http_response_spec.rb
381
- - spec/invoker/power/pf_migrate_spec.rb
382
- - spec/invoker/power/port_finder_spec.rb
383
- - spec/invoker/power/setup/linux_setup_spec.rb
384
- - spec/invoker/power/setup/osx_setup_spec.rb
385
- - spec/invoker/power/setup_spec.rb
386
- - spec/invoker/power/url_rewriter_spec.rb
387
- - spec/invoker/power/web_sockets_spec.rb
388
- - spec/invoker/process_manager_spec.rb
389
- - spec/invoker/reactor_spec.rb
390
- - spec/spec_helper.rb
363
+ test_files: []