memosig 0.0.2 → 0.0.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: c880791fc4181394f342e11786014bf822463364
4
- data.tar.gz: b62e09190fcc3e8dd8b17b09d9d64199b2efda5d
3
+ metadata.gz: 61259555af8cb829a3e5e7dad21bb9dc87213cbb
4
+ data.tar.gz: f2de007ee11e004301c5c0b77cbc849a06d491a0
5
5
  SHA512:
6
- metadata.gz: 4d6dbcea19b281cbc93d074a2c5e9c493e207af94adbf2e704e5e1c447ac2155eef302c1bf62edc72b9657af21d740d241ae9b12315a33ab3d4a3cc4f03ea850
7
- data.tar.gz: de76ecef394151e6be0ac1c2f7a8b3920a6f7e76e412b075d9fd77926d7f778ba4250ac5752ed549959938ee47d0e9d4ae5a7b11321b4e7547209d9ba486ee78
6
+ metadata.gz: b577a7c67b658592c1423d0024d6aa7a8c73577ec94933f18107cf5afd7cae33a44d2c4bab4be5d36020589d1d7b13db1a01aedc63e0f586fef69c736a163c51
7
+ data.tar.gz: 35c68d11c0a21b3e24f5a265e7001f9a4aadd7d11f1b4da58a78a8cd28f8abdf823f7b15beb0746edbfb90cfb40ef66fef24834e945e0e9fc8ae16df1c4bd629
data/.gitignore CHANGED
@@ -3,4 +3,5 @@
3
3
  .rvmrc
4
4
  Gemfile.lock
5
5
  coverage
6
+ errors.lst
6
7
  pkg
data/.utilsrc ADDED
@@ -0,0 +1,21 @@
1
+ # vim: set ft=ruby:
2
+
3
+ search do
4
+ prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|yard)\z/
5
+ skip_files /(\A\.|\.sw[pon]\z|\.(log|fnm|jpg|jpeg|png|pdf|svg)\z|tags|errors\.lst|~\z)/i
6
+ end
7
+
8
+ discover do
9
+ prune_dirs /\A(\.svn|\.git|CVS|tmp|tags|coverage|yard)\z/
10
+ skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
11
+ binary false
12
+ end
13
+
14
+ strip_spaces do
15
+ prune_dirs /\A(\..*|CVS)\z/
16
+ skip_files /(\A\.|\.sw[pon]\z|\.log\z|~\z)/
17
+ end
18
+
19
+ probe do
20
+ test_framework :'rspec'
21
+ end
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ GemHadar do
13
13
  'is exceeded.'
14
14
  test_dir 'spec'
15
15
  ignore '.*.sw[pon]', 'pkg', 'Gemfile.lock', 'coverage', '.rvmrc',
16
- '.AppleDouble'
16
+ '.AppleDouble', 'errors.lst'
17
17
  readme 'README.md'
18
18
  title "#{name.camelize}"
19
19
  licenses << 'Apache-2.0'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/lib/memosig/app.rb CHANGED
@@ -19,9 +19,14 @@ class Memosig::App
19
19
 
20
20
  private
21
21
 
22
+ def new_matcher(pattern, config)
23
+ Memosig::Matcher.new(pattern, config)
24
+ end
25
+
22
26
  def check_memory_for(pattern, config, processes)
23
- processes.any? do |process|
24
- Memosig::Matcher.new(pattern, config).match? process
27
+ processes.inject(false) do |matched, process|
28
+ m = new_matcher(pattern, config).match?(process)
29
+ matched || m
25
30
  end and return
26
31
  error "pattern #{pattern.to_s.inspect} didn't match any processes"
27
32
  end
@@ -1,6 +1,6 @@
1
1
  module Memosig
2
2
  # Memosig version
3
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/memosig.gemspec CHANGED
@@ -1,23 +1,23 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: memosig 0.0.2 ruby lib
2
+ # stub: memosig 0.0.3 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "memosig"
6
- s.version = "0.0.2"
6
+ s.version = "0.0.3"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib"]
10
10
  s.authors = ["Florian Frank"]
11
- s.date = "2015-03-13"
11
+ s.date = "2015-10-26"
12
12
  s.description = "This excecutable supervises the memory usage of processes, and sends a configurable signal to them if a configured limit is exceeded."
13
13
  s.email = "flori@ping.de"
14
14
  s.executables = ["memosig"]
15
15
  s.extra_rdoc_files = ["README.md", "lib/memosig.rb", "lib/memosig/app.rb", "lib/memosig/matcher.rb", "lib/memosig/output.rb", "lib/memosig/proc_stat.rb", "lib/memosig/version.rb"]
16
- s.files = [".gitignore", ".rspec", "COPYING", "Gemfile", "README.md", "Rakefile", "VERSION", "bin/memosig", "lib/memosig.rb", "lib/memosig/app.rb", "lib/memosig/matcher.rb", "lib/memosig/output.rb", "lib/memosig/proc_stat.rb", "lib/memosig/version.rb", "memosig.gemspec", "spec/assets/memosig.yml", "spec/memosig/app_spec.rb", "spec/memosig/matcher_spec.rb", "spec/memosig/output_spec.rb", "spec/memosig/proc_stat_spec.rb", "spec/spec_helper.rb"]
16
+ s.files = [".gitignore", ".rspec", ".utilsrc", "COPYING", "Gemfile", "README.md", "Rakefile", "VERSION", "bin/memosig", "lib/memosig.rb", "lib/memosig/app.rb", "lib/memosig/matcher.rb", "lib/memosig/output.rb", "lib/memosig/proc_stat.rb", "lib/memosig/version.rb", "memosig.gemspec", "spec/assets/memosig.yml", "spec/memosig/app_spec.rb", "spec/memosig/matcher_spec.rb", "spec/memosig/output_spec.rb", "spec/memosig/proc_stat_spec.rb", "spec/spec_helper.rb"]
17
17
  s.homepage = "http://flori.github.com/memosig"
18
18
  s.licenses = ["Apache-2.0"]
19
19
  s.rdoc_options = ["--title", "Memosig", "--main", "README.md"]
20
- s.rubygems_version = "2.4.5"
20
+ s.rubygems_version = "2.4.8"
21
21
  s.summary = "Executable that supervises memory use of processes and signals them"
22
22
  s.test_files = ["spec/memosig/app_spec.rb", "spec/memosig/matcher_spec.rb", "spec/memosig/output_spec.rb", "spec/memosig/proc_stat_spec.rb", "spec/spec_helper.rb"]
23
23
 
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.specification_version = 4
26
26
 
27
27
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
- s.add_development_dependency(%q<gem_hadar>, ["~> 1.0.0"])
28
+ s.add_development_dependency(%q<gem_hadar>, ["~> 1.3.1"])
29
29
  s.add_development_dependency(%q<rake>, [">= 0"])
30
30
  s.add_development_dependency(%q<rspec>, [">= 0"])
31
31
  s.add_development_dependency(%q<simplecov>, [">= 0"])
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency(%q<tins>, ["~> 1.0"])
34
34
  s.add_runtime_dependency(%q<complex_config>, [">= 0"])
35
35
  else
36
- s.add_dependency(%q<gem_hadar>, ["~> 1.0.0"])
36
+ s.add_dependency(%q<gem_hadar>, ["~> 1.3.1"])
37
37
  s.add_dependency(%q<rake>, [">= 0"])
38
38
  s.add_dependency(%q<rspec>, [">= 0"])
39
39
  s.add_dependency(%q<simplecov>, [">= 0"])
@@ -42,7 +42,7 @@ Gem::Specification.new do |s|
42
42
  s.add_dependency(%q<complex_config>, [">= 0"])
43
43
  end
44
44
  else
45
- s.add_dependency(%q<gem_hadar>, ["~> 1.0.0"])
45
+ s.add_dependency(%q<gem_hadar>, ["~> 1.3.1"])
46
46
  s.add_dependency(%q<rake>, [">= 0"])
47
47
  s.add_dependency(%q<rspec>, [">= 0"])
48
48
  s.add_dependency(%q<simplecov>, [">= 0"])
@@ -79,6 +79,9 @@ RSpec.describe Memosig::App do
79
79
  expect_any_instance_of(Memosig::Matcher).to receive(:match?).with(
80
80
  current_processes.first
81
81
  ).and_return true
82
+ expect(app).not_to receive(:error).with(
83
+ /pattern "unicorn worker" didn't match any processes/
84
+ )
82
85
  end
83
86
 
84
87
  it 'cannot match' do
@@ -89,5 +92,22 @@ RSpec.describe Memosig::App do
89
92
  /pattern "unicorn worker" didn't match any processes/
90
93
  )
91
94
  end
95
+
96
+ context 'more processes' do
97
+ let :current_processes do
98
+ [
99
+ Memosig::ProcStat.new($$, 666, 'unicorn worker[1]'),
100
+ Memosig::ProcStat.new($$, 666, 'unicorn worker[2]'),
101
+ ]
102
+ end
103
+
104
+ it 'can match and not match' do
105
+ expect(app).to receive(:new_matcher).and_return(double(match?: false))
106
+ expect(app).to receive(:new_matcher).and_return(double(match?: true))
107
+ expect(app).not_to receive(:error).with(
108
+ /pattern "unicorn worker" didn't match any processes/
109
+ )
110
+ end
111
+ end
92
112
  end
93
113
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memosig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: 1.3.1
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0
26
+ version: 1.3.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -125,6 +125,7 @@ extra_rdoc_files:
125
125
  files:
126
126
  - ".gitignore"
127
127
  - ".rspec"
128
+ - ".utilsrc"
128
129
  - COPYING
129
130
  - Gemfile
130
131
  - README.md
@@ -168,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
169
  version: '0'
169
170
  requirements: []
170
171
  rubyforge_project:
171
- rubygems_version: 2.4.5
172
+ rubygems_version: 2.4.8
172
173
  signing_key:
173
174
  specification_version: 4
174
175
  summary: Executable that supervises memory use of processes and signals them