wolfpack 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/lib/wolfpack/version.rb +1 -1
  3. data/lib/wolfpack.rb +18 -16
  4. metadata +19 -31
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 91d7bcdedd9e608b7278e6007c23cb2cdf37fcc4
4
+ data.tar.gz: e4f101fbfb56764e6f667dd56dd0b31441f85814
5
+ SHA512:
6
+ metadata.gz: 90cea5961aed8bd69467e934c6a9c77e880444ad451bcad2ba8499b9bed4b58cbad4b9e58f53046cee1e010642b82a41cec9aa4fb18c3ddb47366092c86ef886
7
+ data.tar.gz: 1a178ff4108c8695fb12bac5d5e413ea49dddc17a69eabd08d1454bbbca4f8e5c72416f1f65e6291250021162c076f2b23ecd352ef1a11b97691f716addf3a63
@@ -1,3 +1,3 @@
1
1
  module Wolfpack
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/wolfpack.rb CHANGED
@@ -11,6 +11,9 @@ module Wolfpack
11
11
  @processor_count ||= Parallel.processor_count
12
12
  end
13
13
 
14
+ # Wait 10 seconds before blowing up if stdio isn't reading any data.
15
+ STDIN_READ_TIMEOUT = 10
16
+
14
17
  # Configure a runner instance
15
18
  class Configurator
16
19
  attr_reader :runner
@@ -88,29 +91,28 @@ module Wolfpack
88
91
  # thor doesn't return an integer for its params.
89
92
  processes = options[:processes].to_i if options[:processes]
90
93
 
91
- # Process stdin that's piped in.
92
- args = if $stdin.tty?
93
- options[:args] || []
94
- else
95
- # Read from the pipe
96
- buffer = ""
94
+ # If args are passed in, just use those.
95
+ args = options[:args]
96
+
97
+ # Otherwise read stdin from a pipe and split by lines.
98
+ if args.nil?
99
+ # Process stdin that's piped in.
100
+ if $stdin.tty?
101
+ args = [] # Screw it, lets return an empty array of args.
102
+ else
103
+ # Read from the pipe
104
+ buffer = ""
97
105
 
98
- begin
99
- ::Timeout::timeout(2) do
106
+ Timeout::timeout STDIN_READ_TIMEOUT do
100
107
  until $stdin.eof? do
101
108
  buffer << $stdin.read
102
109
  end
103
110
  end
104
- rescue ::Timeout::Error
105
- puts "Timeout reading from STDIN. Continuing..."
106
- end
107
111
 
108
- buffer.lines
112
+ args = buffer.lines
113
+ end
109
114
  end
110
-
111
- # If args are passed in, read those and split, otherwise read stdin
112
- # from a pipe and split by lines.
113
-
115
+
114
116
  Wolfpack::Runner.new(command, args, options[:config]).run(processes)
115
117
  end
116
118
 
metadata CHANGED
@@ -1,94 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wolfpack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
5
- prerelease:
4
+ version: 0.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brad Gessler
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-07-17 00:00:00.000000000 Z
11
+ date: 2014-03-12 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.3'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: guard-rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: thor
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: parallel
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :runtime
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  description: Run stuff in parallel
@@ -99,8 +88,8 @@ executables:
99
88
  extensions: []
100
89
  extra_rdoc_files: []
101
90
  files:
102
- - .gitignore
103
- - .rspec
91
+ - ".gitignore"
92
+ - ".rspec"
104
93
  - Gemfile
105
94
  - LICENSE.txt
106
95
  - README.md
@@ -116,27 +105,26 @@ files:
116
105
  homepage: https://github.com/polleverywhere/wolfpack
117
106
  licenses:
118
107
  - MIT
108
+ metadata: {}
119
109
  post_install_message:
120
110
  rdoc_options: []
121
111
  require_paths:
122
112
  - lib
123
113
  required_ruby_version: !ruby/object:Gem::Requirement
124
- none: false
125
114
  requirements:
126
- - - ! '>='
115
+ - - ">="
127
116
  - !ruby/object:Gem::Version
128
117
  version: '0'
129
118
  required_rubygems_version: !ruby/object:Gem::Requirement
130
- none: false
131
119
  requirements:
132
- - - ! '>='
120
+ - - ">="
133
121
  - !ruby/object:Gem::Version
134
122
  version: '0'
135
123
  requirements: []
136
124
  rubyforge_project:
137
- rubygems_version: 1.8.23
125
+ rubygems_version: 2.2.0
138
126
  signing_key:
139
- specification_version: 3
127
+ specification_version: 4
140
128
  summary: Run ruby tasks in parallel
141
129
  test_files:
142
130
  - spec/lib/wolfpack.rb