teapot 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -21,9 +21,18 @@
21
21
  require 'set'
22
22
  require 'rainbow'
23
23
  require 'shellwords'
24
+ require 'facter'
24
25
 
25
26
  module Teapot
26
27
  module Commands
28
+ def self.processor_count
29
+ # Get the number of virtual/physical processors
30
+ count = Facter.processorcount.to_i rescue 1
31
+
32
+ # Make sure we always return at least 1:
33
+ count < 1 ? 1 : count
34
+ end
35
+
27
36
  class CommandError < StandardError
28
37
  end
29
38
 
@@ -56,15 +65,13 @@ module Teapot
56
65
  class Pool
57
66
  def initialize(options = {})
58
67
  @commands = []
59
- @limit = options[:limit] || 16
68
+ @limit = options[:limit] || Commands.processor_count
60
69
 
61
70
  @running = Set.new
62
71
  end
63
72
 
64
73
  def run(*args)
65
74
  args = args.flatten.collect &:to_s
66
-
67
- puts args.join(' ').color(:blue)
68
75
 
69
76
  @commands << args
70
77
 
@@ -75,6 +82,8 @@ module Teapot
75
82
  while @running.size < @limit and @commands.size > 0
76
83
  command = @commands.shift
77
84
 
85
+ puts command.join(' ').color(:blue)
86
+
78
87
  pid = Process.fork do
79
88
  exec(*command)
80
89
 
@@ -19,5 +19,5 @@
19
19
  # THE SOFTWARE.
20
20
 
21
21
  module Teapot
22
- VERSION = "0.5.0"
22
+ VERSION = "0.5.1"
23
23
  end
data/teapot.gemspec CHANGED
@@ -24,4 +24,5 @@ Gem::Specification.new do |gem|
24
24
  gem.add_dependency "rainbow"
25
25
  gem.add_dependency "rexec"
26
26
  gem.add_dependency "trollop"
27
+ gem.add_dependency "facter"
27
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: teapot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -59,6 +59,22 @@ dependencies:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: facter
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :runtime
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
62
78
  description: ! "\tTeapot is a tool for managing complex cross-platform builds. It
63
79
  provides\n\tadvanced dependency management via the Teapot file and is supported
64
80
  by\n\tthe infusions ecosystem of packages and platform tooling.\n"
@@ -117,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
133
  version: '0'
118
134
  segments:
119
135
  - 0
120
- hash: -1731715330087988580
136
+ hash: -2634400056080350506
121
137
  required_rubygems_version: !ruby/object:Gem::Requirement
122
138
  none: false
123
139
  requirements:
@@ -126,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
142
  version: '0'
127
143
  segments:
128
144
  - 0
129
- hash: -1731715330087988580
145
+ hash: -2634400056080350506
130
146
  requirements: []
131
147
  rubyforge_project:
132
148
  rubygems_version: 1.8.24