alt-foreman 0.0.3 → 0.0.4

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: 3aba06eba575dc16a9e0a2d32ebc1618a9b23454
4
- data.tar.gz: 31c2b252c0fd543f4a0da478f866d501c2adea45
3
+ metadata.gz: 0e3cd6bc4558b5932e5c57842c2e481c4d25a77d
4
+ data.tar.gz: d0919972a0e83463264dc500a004c784bd27ea3b
5
5
  SHA512:
6
- metadata.gz: 141bbdabb9e25603d104c64609ed3fdab5b8c7ca838e4347abb913ef91a94492b048e1349ed7b3f6c124b2e66682896d51283f99d52a056bd2fee85efb93fe4b
7
- data.tar.gz: 7b412d3cf36ded62ff4cadd648a048be888cbc2d69941ad8eeecbe4f5bca86a1f7f04b9572835786315013aea96ed29f19f9cbc08b134d55a28318122fd09f20
6
+ metadata.gz: 5f3e27a0a006fc0894fc225e406ef2507b3c8713c132305cd8e9ce2460ec59d54aec5c0daaf1a72ba331b1eb6e238a929ebd17d51b1661c8cbba5d5fcca86acf
7
+ data.tar.gz: 3d97a0e3e47d762d3a2f500b0693197f4a1df2c5d8d76d6f5b0f69131dec0e4d24c3b3184b5d46817188260c8692319935704da77dc117f030c30bd4ffa9c257
@@ -15,7 +15,7 @@ if is_help or is_fail
15
15
  end
16
16
  puts "alt-foreman #{Alt::Foreman::VERSION}"
17
17
  puts "Crude alternative to foreman for local development"
18
- puts "Usage: alt-foreman [/path/to/Procfile]"
18
+ puts "Usage: alt-foreman [/path/to/Procfile] [<entry>=<threadcount>]"
19
19
  exit(is_help ? 0 : 1)
20
20
  end
21
21
 
@@ -27,14 +27,27 @@ if File.exist?('Gemfile')
27
27
  ENV["BUNDLE_GEMFILE"]= File.expand_path("Gemfile")
28
28
  end
29
29
 
30
- processes = IO.readlines(pf).map do |line|
30
+
31
+ thread_count = {}
32
+ thread_count.default = 1
33
+ ARGV.each do |arg|
34
+ if arg =~ /(.*?)=(\d+)/
35
+ thread_count[$1] = $2.to_i
36
+ end
37
+ end
38
+
39
+ processes = []
40
+
41
+ IO.foreach(pf) do |line|
31
42
  line = line.chomp.gsub(/#.*$/, '')
32
43
  if line =~ /:\s+/
33
- Alt::Foreman::Process.new(*line.split(/:\s+/,2))
34
- else
35
- nil
44
+ name, command = *line.split(/:\s+/, 2)
45
+
46
+ thread_count[name].times do |n|
47
+ processes << Alt::Foreman::Process.new(name+( n.nonzero? ? "-#{n+1}" : ""), command)
48
+ end
36
49
  end
37
- end.compact
50
+ end
38
51
 
39
52
 
40
53
  kill_children = lambda do
@@ -55,9 +68,10 @@ threads = processes.map do |process|
55
68
  loop do
56
69
  process.run
57
70
  unless $kill
58
- process.log("Process #{$?.pid} `#{process.cmd}' died (#{$?.to_i})", :red)
71
+ process.log("Process #{ $?.pid } `#{ process.cmd }' died (#{ $?.to_i })", :red)
59
72
  sleep 2
60
- process.log("`#{process.cmd}' re-spawning", :red)
73
+ process.log("`#{ process.cmd }' re-spawning", :red)
74
+ Thread.pass
61
75
  end
62
76
  end
63
77
  end
@@ -24,6 +24,7 @@ module Alt
24
24
  @pid = io.pid
25
25
  while line = io.gets
26
26
  log(line)
27
+ Thread.pass
27
28
  end
28
29
  end
29
30
  end
@@ -1,5 +1,5 @@
1
1
  module Alt
2
2
  module Foreman
3
- VERSION = "0.0.3"
3
+ VERSION = "0.0.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,28 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alt-foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
- - |
8
- Geoff Youngs
7
+ - 'Geoff Youngs
8
+
9
+ '
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2013-03-08 00:00:00.000000000 Z
13
+ date: 2016-01-21 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: term-ansicolor
16
17
  requirement: !ruby/object:Gem::Requirement
17
18
  requirements:
18
- - - '>='
19
+ - - ">="
19
20
  - !ruby/object:Gem::Version
20
21
  version: '0'
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
- - - '>='
26
+ - - ">="
26
27
  - !ruby/object:Gem::Version
27
28
  version: '0'
28
29
  description: Lightweight procfile runner
@@ -33,7 +34,7 @@ executables:
33
34
  extensions: []
34
35
  extra_rdoc_files: []
35
36
  files:
36
- - .gitignore
37
+ - ".gitignore"
37
38
  - Gemfile
38
39
  - Rakefile
39
40
  - alt-foreman.gemspec
@@ -50,17 +51,17 @@ require_paths:
50
51
  - lib
51
52
  required_ruby_version: !ruby/object:Gem::Requirement
52
53
  requirements:
53
- - - '>='
54
+ - - ">="
54
55
  - !ruby/object:Gem::Version
55
56
  version: '0'
56
57
  required_rubygems_version: !ruby/object:Gem::Requirement
57
58
  requirements:
58
- - - '>='
59
+ - - ">="
59
60
  - !ruby/object:Gem::Version
60
61
  version: '0'
61
62
  requirements: []
62
63
  rubyforge_project:
63
- rubygems_version: 2.0.0.rc.2
64
+ rubygems_version: 2.5.1
64
65
  signing_key:
65
66
  specification_version: 4
66
67
  summary: rubbish dev version of foreman