march 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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
@@ -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.
@@ -0,0 +1,3 @@
1
+ = March
2
+
3
+ This project rocks and uses MIT-LICENSE.
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+
8
+ Bundler::GemHelper.install_tasks
9
+
@@ -0,0 +1,14 @@
1
+ #
2
+ # March.run({
3
+ #
4
+ # }) do |result|
5
+ #
6
+ # end
7
+ #
8
+ require "march/runner"
9
+ module March
10
+ def self.run *args, &block
11
+ runner = ::March::Runner.new
12
+ runner.run(*args, &block)
13
+ end
14
+ end
@@ -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
@@ -0,0 +1,3 @@
1
+ module March
2
+ VERSION = "0.0.2"
3
+ 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
- hash: 29
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
- description: good site
23
- email: happy@doc5.com
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
- files: []
31
-
32
- has_rdoc: true
33
- homepage: http://iblog.doc5.com
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
- require_paths:
40
- - .
41
- required_ruby_version: !ruby/object:Gem::Requirement
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
- hash: 57
47
- segments:
48
- - 1
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
- hash: 3
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: 1.4.2
45
+ rubygems_version: 2.2.1
65
46
  signing_key:
66
- specification_version: 3
67
- summary: loyal website.
47
+ specification_version: 4
48
+ summary: Summary of March.
68
49
  test_files: []
69
-