eye 0.9.2 → 0.9.3

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
  SHA1:
3
- metadata.gz: bc90dbe500dcdec39abb07eed2c8a9391cb8e619
4
- data.tar.gz: b0c7fe91dad6d81afa03467fa4af801e9a8cd619
3
+ metadata.gz: 7fb55aab9464c85b0d2f52d9ecb83f2ef8f6cbc7
4
+ data.tar.gz: b36569fbe32ec49ece27216d1fbb340750a6116d
5
5
  SHA512:
6
- metadata.gz: 3211c83195c0fccacbe73705a2f822079f2cdeecfa1ab5b1aa43587574ed2fe7369a60b2ca2a5365a4fdaba97f3d1330bbd4c280e607f35140d84ea954984b81
7
- data.tar.gz: 5e7cab54e3f1ceae0d3edf0f54e73976b24c61258f1e770508a1be20ae7b87c12acd9edef70212bf2e85c6f7efbaa1c617e1aeb627ec07db40b28b688981ad37
6
+ metadata.gz: 1de45573f67e9a8b0b8a7a3d93ef19396d0561bcf780d73cb9eee63de3607958c1c634a6edd48556c95460492b407b05ee536cc5489974073f6618354b629cb2
7
+ data.tar.gz: 51c5d3ebd48ad1b339a493897a00fe354ee4d9b1c884c53ff198ba253d27a3216c909a248166d6c18591f06460becb0029fedc93db13bd0319953beded5ec94f
@@ -27,10 +27,10 @@ Style/MutableConstant:
27
27
  Style/ClassAndModuleChildren:
28
28
  EnforcedStyle: compact
29
29
 
30
- Style/EmptyLinesAroundClassBody:
30
+ Layout/EmptyLinesAroundClassBody:
31
31
  EnforcedStyle: empty_lines
32
32
 
33
- Style/EmptyLinesAroundModuleBody:
33
+ Layout/EmptyLinesAroundModuleBody:
34
34
  EnforcedStyle: empty_lines
35
35
  Exclude:
36
36
  - 'lib/eye.rb'
@@ -40,13 +40,13 @@ Style/RegexpLiteral:
40
40
  Exclude:
41
41
  - 'examples/**/*'
42
42
 
43
- Style/AccessModifierIndentation:
43
+ Layout/AccessModifierIndentation:
44
44
  EnforcedStyle: outdent
45
45
 
46
46
  Lint/EndAlignment:
47
- AlignWith: variable
47
+ EnforcedStyleAlignWith: variable
48
48
 
49
- Style/IndentHash:
49
+ Layout/IndentHash:
50
50
  EnforcedStyle: consistent
51
51
 
52
52
  Style/Lambda:
@@ -57,9 +57,9 @@ Style/BlockDelimiters:
57
57
  Exclude:
58
58
  - 'examples/**/*'
59
59
 
60
- Style/CaseIndentation:
60
+ Layout/CaseIndentation:
61
61
  IndentOneStep: true
62
- IndentWhenRelativeTo: end
62
+ EnforcedStyle: end
63
63
 
64
64
  Style/HashSyntax:
65
65
  Exclude:
@@ -132,7 +132,7 @@ Style/Documentation:
132
132
  Style/DoubleNegation:
133
133
  Enabled: false
134
134
 
135
- Lint/Eval:
135
+ Security/Eval:
136
136
  Enabled: false
137
137
 
138
138
  Lint/Void:
@@ -144,7 +144,7 @@ Lint/Void:
144
144
  Lint/AssignmentInCondition:
145
145
  Enabled: false
146
146
 
147
- Style/AccessorMethodName:
147
+ Naming/AccessorMethodName:
148
148
  Enabled: false
149
149
 
150
150
  Style/SpecialGlobalVars:
@@ -161,3 +161,21 @@ Lint/LiteralInInterpolation:
161
161
  - 'lib/eye/notify/jabber.rb'
162
162
  - 'lib/eye/notify/slack.rb'
163
163
  - 'lib/eye/process/commands.rb'
164
+
165
+ Style/FrozenStringLiteralComment:
166
+ Enabled: false
167
+
168
+ Style/SymbolArray:
169
+ Enabled: false
170
+
171
+ Style/SafeNavigation:
172
+ Enabled: false
173
+
174
+ Security/MarshalLoad:
175
+ Enabled: false
176
+
177
+ Gemspec/OrderedDependencies:
178
+ Enabled: false
179
+
180
+ Style/Dir:
181
+ Enabled: false
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 0.9.3
2
+ -----
3
+ * fix process hangs in status :starting, in some rare cases
4
+ * add handling quotes in load_env
5
+
1
6
  0.9.1
2
7
  -------
3
8
  * fix client protocol compatibility with old server
data/Gemfile CHANGED
@@ -1,5 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
+ gem 'fakeweb', git: 'https://github.com/chrisk/fakeweb.git'
5
+ gem 'json'
4
6
  gem 'rack', '1.6.4'
5
- gem 'json', '1.8.3'
data/README.md CHANGED
@@ -10,10 +10,10 @@ Little demo, shows general commands and how chain works:
10
10
 
11
11
  [![Eye](https://raw.github.com/kostya/stuff/master/eye/eye.png)](https://raw.github.com/kostya/stuff/master/eye/eye.gif)
12
12
 
13
- Recommended installation on the server (system wide):
13
+ Installation:
14
14
 
15
- $ sudo /usr/local/ruby/1.9.3/bin/gem install eye
16
- $ sudo ln -sf /usr/local/ruby/1.9.3/bin/eye /usr/local/bin/eye
15
+ $ gem install sigar -- --with-cppflags="-fgnu89-inline"
16
+ $ gem install eye
17
17
 
18
18
 
19
19
  ### Why?
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'coveralls/rake/task'
5
5
 
6
6
  Coveralls::RakeTask.new
7
7
 
8
- task :default => :split_test
8
+ task default: :split_test
9
9
 
10
10
  desc 'run parallel tests'
11
11
  task :pspec do
@@ -24,7 +24,7 @@ end
24
24
 
25
25
  task :remove_coverage do
26
26
  require 'fileutils'
27
- FileUtils.rm_rf(File.expand_path(File.join(File.dirname(__FILE__), %w{ coverage })))
27
+ FileUtils.rm_rf(File.expand_path(File.join(File.dirname(__FILE__), %w[coverage])))
28
28
  end
29
29
 
30
30
  task :env do
@@ -35,6 +35,6 @@ task :env do
35
35
  end
36
36
 
37
37
  desc 'graph'
38
- task :graph => :env do
38
+ task graph: :env do
39
39
  StateMachine::Machine.draw('Eye::Process')
40
40
  end
@@ -9,7 +9,7 @@ class MyCheck < Eye::Checker::Custom
9
9
  end
10
10
 
11
11
  def good?(value)
12
- !(value =~ /haha/)
12
+ value !~ /haha/
13
13
  end
14
14
 
15
15
  end
@@ -1,5 +1,4 @@
1
1
  class Reactor
2
-
3
2
  include Celluloid
4
3
 
5
4
  def initialize(interval, filename)
@@ -39,7 +39,8 @@ class EchoObj < EM::Connection
39
39
  puts '-- someone connected to the echo server!'
40
40
  end
41
41
 
42
- def receive_object(obj) # {:command => 'ping'}
42
+ # {:command => 'ping'}
43
+ def receive_object(obj)
43
44
  puts "receive #{obj.inspect}"
44
45
  send_object(answer(obj[:command]).chop)
45
46
  end
@@ -1,4 +1,3 @@
1
- #!/usr/bin/env ruby
2
1
  require 'optparse'
3
2
 
4
3
  # This hash will hold all of the options
@@ -5,8 +5,9 @@ class Test < Sinatra::Base
5
5
 
6
6
  get '/hello' do
7
7
  sleep 0.5
8
- "Hello World!"
8
+ 'Hello World!'
9
9
  end
10
+
10
11
  end
11
12
 
12
13
  run Test.new
data/lib/eye.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Eye
2
- VERSION = '0.9.2'
3
- ABOUT = "Eye v#{VERSION} (c) 2012-2016 @kostya"
2
+ VERSION = '0.9.3'
3
+ ABOUT = "Eye v#{VERSION} (c) 2012-2017 @kostya"
4
4
  PROCLINE = "eye monitoring v#{VERSION}"
5
5
 
6
6
  autoload :Process, 'eye/process'
@@ -48,7 +48,7 @@ class Eye::Application
48
48
 
49
49
  def sub_object?(obj)
50
50
  res = @groups.include?(obj)
51
- res = @groups.any? { |gr| gr.sub_object?(obj) } unless res
51
+ res ||= @groups.any? { |gr| gr.sub_object?(obj) }
52
52
  res
53
53
  end
54
54
 
@@ -50,7 +50,6 @@ class Eye::Checker
50
50
 
51
51
  def self.create(pid, options = {}, process = nil)
52
52
  get_class(options[:type]).new(pid, options, process)
53
-
54
53
  rescue Object => ex
55
54
  log_ex(ex)
56
55
  nil
@@ -128,7 +127,6 @@ class Eye::Checker
128
127
 
129
128
  info { "#{last_human_values} => #{result ? 'OK' : 'Fail'}" }
130
129
  result
131
-
132
130
  rescue Object => ex
133
131
  raise(ex) if ex.class == Celluloid::TaskTerminated
134
132
  log_ex(ex)
@@ -221,8 +219,7 @@ class Eye::Checker
221
219
  Eye::Checker.const_set(name, base)
222
220
  end
223
221
 
224
- def self.requires
225
- end
222
+ def self.requires; end
226
223
 
227
224
  class CustomCell < Eye::Checker
228
225
 
@@ -90,7 +90,8 @@ class Eye::ChildProcess
90
90
  self_status_data(opts)
91
91
  end
92
92
 
93
- def prepare_command(command) # override
93
+ # override
94
+ def prepare_command(command)
94
95
  super.gsub('{PARENT_PID}', @parent_pid.to_s)
95
96
  end
96
97
 
@@ -95,8 +95,8 @@ class Eye::Config
95
95
  end
96
96
 
97
97
  def each_process(&block)
98
- applications.each_value do |app_cfg|
99
- (app_cfg[:groups] || {}).each_value do |gr_cfg|
98
+ applications.each do |_, app_cfg|
99
+ (app_cfg[:groups] || {}).each do |_, gr_cfg|
100
100
  (gr_cfg[:processes] || {}).each_value(&block)
101
101
  end
102
102
  end
@@ -111,14 +111,14 @@ class Eye::Config
111
111
  end
112
112
 
113
113
  def delete_group(name)
114
- applications.each do |_app_name, app_cfg|
114
+ applications.each do |_, app_cfg|
115
115
  (app_cfg[:groups] || {}).delete(name)
116
116
  end
117
117
  end
118
118
 
119
119
  def delete_process(name)
120
- applications.each do |_app_name, app_cfg|
121
- (app_cfg[:groups] || {}).each do |_gr_name, gr_cfg|
120
+ applications.each do |_, app_cfg|
121
+ (app_cfg[:groups] || {}).each do |_, gr_cfg|
122
122
  (gr_cfg[:processes] || {}).delete(name)
123
123
  end
124
124
  end
@@ -6,7 +6,7 @@ class Eye::Logger
6
6
 
7
7
  class InnerLogger < Logger
8
8
 
9
- FORMAT = '%d.%m.%Y %H:%M:%S'.freeze
9
+ FORMAT = '%Y.%m.%d %H:%M:%S'.freeze
10
10
 
11
11
  def initialize(*args)
12
12
  super
@@ -47,7 +47,6 @@ class Eye::Notify
47
47
  else
48
48
  create_proc[needed_hash]
49
49
  end
50
-
51
50
  rescue Object => ex
52
51
  log_ex(ex)
53
52
  end
@@ -99,8 +98,7 @@ class Eye::Notify
99
98
  Eye::Dsl::ConfigOpts.add_notify(type)
100
99
  end
101
100
 
102
- def self.requires
103
- end
101
+ def self.requires; end
104
102
 
105
103
  class Custom < Eye::Notify
106
104
 
@@ -48,6 +48,7 @@ module Eye::Process::Children
48
48
  end
49
49
 
50
50
  def remove_children
51
+ # here should .keys (not each_key), as it copy array of keys
51
52
  children.keys.each { |child_pid| clear_child(child_pid) }
52
53
  end
53
54
 
@@ -229,7 +229,7 @@ private
229
229
 
230
230
  sleep_grace(:start_grace)
231
231
 
232
- case load_external_pid_file
232
+ case load_res = load_external_pid_file
233
233
  when :ok
234
234
  res.merge(pid: self.pid)
235
235
  when :no_pid_file
@@ -241,6 +241,11 @@ private
241
241
  error "exit status #{res[:exitstatus]}, process <#{@last_loaded_pid}> (from #{self[:pid_file_ex]}) was not found; " \
242
242
  "ensure that the pid_file is being updated correctly (#{check_logs_str})"
243
243
  { error: :not_really_running }
244
+ else
245
+ # really strange case
246
+ error "exit status #{res[:exitstatus]}, process <#{@last_loaded_pid}> (from #{self[:pid_file_ex]}) #{load_res}; " \
247
+ "this is really strange case, like timestamp of server was updated, may be need to reload eye (#{check_logs_str})"
248
+ { error: load_res }
244
249
  end
245
250
  end
246
251
 
@@ -65,7 +65,7 @@ module Eye::Process::Data
65
65
 
66
66
  def sub_object?(obj)
67
67
  return false if self.class == Eye::ChildProcess
68
- self.children.values.each { |child| return true if child == obj }
68
+ self.children.each { |_, child| return true if child == obj }
69
69
  false
70
70
  end
71
71
 
@@ -92,7 +92,7 @@ module Eye::Process::Scheduler
92
92
  return false if call[:by] != :user && equal_action_call?(@scheduled_call, call)
93
93
 
94
94
  # check any equal call in queue scheduler_calls
95
- !scheduler_calls.any? { |c| equal_action_call?(c, call) }
95
+ scheduler_calls.none? { |c| equal_action_call?(c, call) }
96
96
  end
97
97
 
98
98
  def equal_action_call?(call1, call2)
@@ -1,7 +1,7 @@
1
1
  module Eye::Process::Trigger
2
2
 
3
3
  def add_triggers
4
- (self[:triggers] || {}).each { |_type, cfg| add_trigger(cfg) }
4
+ (self[:triggers] || {}).each_value { |cfg| add_trigger(cfg) }
5
5
  end
6
6
 
7
7
  def remove_triggers
@@ -32,7 +32,7 @@ module Eye::Process::Watchers
32
32
  end
33
33
 
34
34
  def remove_watchers
35
- @watchers.each { |_, h| h[:timer].cancel }
35
+ @watchers.each_value { |h| h[:timer].cancel }
36
36
  @watchers = {}
37
37
  end
38
38
 
@@ -21,7 +21,8 @@ class Eye::SystemResources
21
21
  cache.children(parent_pid)
22
22
  end
23
23
 
24
- def start_time(pid) # unixtime
24
+ # unixtime
25
+ def start_time(pid)
25
26
  if cpu = cache.proc_cpu(pid)
26
27
  cpu.start_time.to_i / 1000
27
28
  end
@@ -119,8 +119,7 @@ class Eye::Trigger
119
119
  Eye::Trigger.const_set(name, base)
120
120
  end
121
121
 
122
- def self.requires
123
- end
122
+ def self.requires; end
124
123
 
125
124
  class Custom < Eye::Trigger
126
125
 
@@ -13,7 +13,7 @@ private
13
13
  Eye::Control.find_nearest_process(name, process.group_name_pure, process.app_name)
14
14
  end
15
15
 
16
- processes = processes.compact.select { |p| p.state_name != :unmonitored }
16
+ processes = processes.compact.reject { |p| p.state_name == :unmonitored }
17
17
  return if processes.empty?
18
18
  processes = Eye::Utils::AliveArray.new(processes)
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eye
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Makarchev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid