march 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +9 -0
- data/lib/march.rb +14 -0
- data/lib/march/runner.rb +44 -0
- data/lib/march/version.rb +3 -0
- metadata +30 -50
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5f7832503ec2a78acd3684ba34a2dc5e7b287f10
|
4
|
+
data.tar.gz: e7af7987d75af856d516f168adefc3a53a2de46e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7ffac9c88a382484e8703c954ad036bf09fd47d027bec6ae6763ae79e93f57d6aff7581eb544f8a7f51ad11e278769b214fc59086d7f954dbb371d9ecc927082
|
7
|
+
data.tar.gz: d3eac8a4247d5c9e187c3c7f3b8c08dcdb38d1d9a8d9ecb5480ccb215c1f65bea937952e26dc0ea7021281d09e69b8268c0bf9a4cc5ad2a051c256d7d9c1baa8
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
data/lib/march.rb
ADDED
data/lib/march/runner.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'thread'
|
2
|
+
module March
|
3
|
+
class Runner
|
4
|
+
def run *args, &block
|
5
|
+
options = args.last.is_a?(::Hash) ? args.pop : {}
|
6
|
+
|
7
|
+
result = {}
|
8
|
+
runners = {}
|
9
|
+
|
10
|
+
options.each do |key, value|
|
11
|
+
case value
|
12
|
+
when ::Proc
|
13
|
+
runners[key] = value
|
14
|
+
else
|
15
|
+
result[key] = value
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
runners_count = runners.size
|
20
|
+
finished_runners_count = 0
|
21
|
+
|
22
|
+
threads = []
|
23
|
+
|
24
|
+
runners.each do |name, proc|
|
25
|
+
threads << Thread.new do
|
26
|
+
result[name] = proc.call
|
27
|
+
|
28
|
+
finished_runners_count += 1
|
29
|
+
if finished_runners_count >= runners_count
|
30
|
+
if block_given?
|
31
|
+
block.call(result)
|
32
|
+
else
|
33
|
+
result
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
threads.each do |thr|
|
40
|
+
thr.join
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
metadata
CHANGED
@@ -1,69 +1,49 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: march
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 1
|
10
|
-
version: 0.0.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- happy
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-01-11 00:00:00 +08:00
|
19
|
-
default_executable:
|
11
|
+
date: 2014-01-16 00:00:00.000000000 Z
|
20
12
|
dependencies: []
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
description: Description of March.
|
14
|
+
email:
|
15
|
+
- happy@ruby1024.com
|
24
16
|
executables: []
|
25
|
-
|
26
17
|
extensions: []
|
27
|
-
|
28
18
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
19
|
+
files:
|
20
|
+
- MIT-LICENSE
|
21
|
+
- README.rdoc
|
22
|
+
- Rakefile
|
23
|
+
- lib/march.rb
|
24
|
+
- lib/march/runner.rb
|
25
|
+
- lib/march/version.rb
|
26
|
+
homepage: http://github.com/xiuxian123/ruby-march
|
34
27
|
licenses: []
|
35
|
-
|
28
|
+
metadata: {}
|
36
29
|
post_install_message:
|
37
30
|
rdoc_options: []
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
none: false
|
43
|
-
requirements:
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
requirements:
|
44
35
|
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
- 8
|
50
|
-
- 7
|
51
|
-
version: 1.8.7
|
52
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
55
40
|
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
61
43
|
requirements: []
|
62
|
-
|
63
44
|
rubyforge_project:
|
64
|
-
rubygems_version:
|
45
|
+
rubygems_version: 2.2.1
|
65
46
|
signing_key:
|
66
|
-
specification_version:
|
67
|
-
summary:
|
47
|
+
specification_version: 4
|
48
|
+
summary: Summary of March.
|
68
49
|
test_files: []
|
69
|
-
|