circleci-parallel 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile +4 -0
- data/README.md +9 -1
- data/lib/circleci/parallel/configuration.rb +4 -0
- data/lib/circleci/parallel/environment.rb +10 -3
- data/lib/circleci/parallel/task/mock_master.rb +30 -0
- data/lib/circleci/parallel/task/mock_slave.rb +16 -0
- data/lib/circleci/parallel/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b025b1e5a1648148df644b1070c33d2844af168
|
4
|
+
data.tar.gz: ab393445cfc80555f2f95cd88407868222a750be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd88017b0b1f553fd96969023b733f2f9c3262f470eac801d898b5cce5d0c8b764abef3be045e20d4747e4112eb6fca9d62b47c28549bc383c5c8dd42a62ca5c
|
7
|
+
data.tar.gz: 1c8022cc15999fa26de1a2804dceba4cea460b22d6c515e2f2f36f2bf2040a8b1f25c4dd27085e7002a7adde9d84a0400ac5e9c49c9e07706c7dfc3d050eb034
|
data/CHANGELOG.md
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
[![Gem Version](http://img.shields.io/gem/v/circleci-parallel.svg?style=flat)](http://badge.fury.io/rb/circleci-parallel)
|
2
|
+
[![Dependency Status](http://img.shields.io/gemnasium/increments/circleci-parallel.svg?style=flat)](https://gemnasium.com/increments/circleci-parallel)
|
3
|
+
[![CircleCI](https://circleci.com/gh/increments/circleci-parallel.svg?style=shield)](https://circleci.com/gh/increments/circleci-parallel)
|
4
|
+
[![Coverage Status](https://img.shields.io/codeclimate/coverage/github/increments/circleci-parallel.svg)](https://codeclimate.com/github/increments/circleci-parallel/coverage)
|
5
|
+
[![Code Climate](https://img.shields.io/codeclimate/github/increments/circleci-parallel.svg?style=flat)](https://codeclimate.com/github/increments/circleci-parallel)
|
6
|
+
|
1
7
|
# CircleCI::Parallel
|
2
8
|
|
3
9
|
**CircleCI::Parallel** provides simple APIs for joining [CircleCI parallel nodes](https://circleci.com/docs/parallelism/)
|
@@ -17,7 +23,7 @@ And then execute:
|
|
17
23
|
$ bundle install
|
18
24
|
```
|
19
25
|
|
20
|
-
##
|
26
|
+
## Usage
|
21
27
|
|
22
28
|
Before using CircleCI::Parallel:
|
23
29
|
|
@@ -81,6 +87,8 @@ CircleCI::Parallel.join
|
|
81
87
|
p merged_data
|
82
88
|
```
|
83
89
|
|
90
|
+
See [API docs](http://www.rubydoc.info/gems/circleci-parallel) for more details.
|
91
|
+
|
84
92
|
## License
|
85
93
|
|
86
94
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -6,11 +6,15 @@ module CircleCI
|
|
6
6
|
# @return [Boolean] whether progress messages should be outputted to STDOUT (default: false)
|
7
7
|
attr_accessor :silent
|
8
8
|
|
9
|
+
# @return [Boolean] whether mock mode is enabled (default: false)
|
10
|
+
attr_accessor :mock_mode
|
11
|
+
|
9
12
|
# @api private
|
10
13
|
attr_reader :before_join_hook, :after_join_hook, :after_download_hook
|
11
14
|
|
12
15
|
def initialize
|
13
16
|
@silent = false
|
17
|
+
@mock_mode = false
|
14
18
|
@before_join_hook = @after_join_hook = @after_download_hook = Hook.new
|
15
19
|
end
|
16
20
|
|
@@ -4,6 +4,8 @@ require 'circleci/parallel/configuration'
|
|
4
4
|
require 'circleci/parallel/node'
|
5
5
|
require 'circleci/parallel/task/master'
|
6
6
|
require 'circleci/parallel/task/slave'
|
7
|
+
require 'circleci/parallel/task/mock_master'
|
8
|
+
require 'circleci/parallel/task/mock_slave'
|
7
9
|
|
8
10
|
module CircleCI
|
9
11
|
module Parallel
|
@@ -51,9 +53,14 @@ module CircleCI
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def task
|
54
|
-
@task ||=
|
55
|
-
|
56
|
-
|
56
|
+
@task ||= task_class.new(current_node, configuration)
|
57
|
+
end
|
58
|
+
|
59
|
+
def task_class
|
60
|
+
if configuration.mock_mode
|
61
|
+
current_node.master? ? Task::MockMaster : Task::MockSlave
|
62
|
+
else
|
63
|
+
current_node.master? ? Task::Master : Task::Slave
|
57
64
|
end
|
58
65
|
end
|
59
66
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'circleci/parallel/task/base'
|
2
|
+
|
3
|
+
module CircleCI
|
4
|
+
module Parallel
|
5
|
+
module Task
|
6
|
+
# @api private
|
7
|
+
class MockMaster < Master
|
8
|
+
private
|
9
|
+
|
10
|
+
def downloaders
|
11
|
+
@downloaders ||= node.other_nodes.map { |other_node| MockDownloader.new(other_node) }
|
12
|
+
end
|
13
|
+
|
14
|
+
class MockDownloader < Downloader
|
15
|
+
def ready_for_download?
|
16
|
+
true
|
17
|
+
end
|
18
|
+
|
19
|
+
def scp
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
def mark_as_downloaded
|
24
|
+
File.write(DOWNLOAD_MARKER_FILE, '')
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: circleci-parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuji Nakayama
|
@@ -36,6 +36,7 @@ files:
|
|
36
36
|
- ".rspec"
|
37
37
|
- ".rubocop.yml"
|
38
38
|
- ".yardopts"
|
39
|
+
- CHANGELOG.md
|
39
40
|
- Gemfile
|
40
41
|
- LICENSE.txt
|
41
42
|
- README.md
|
@@ -52,6 +53,8 @@ files:
|
|
52
53
|
- lib/circleci/parallel/node.rb
|
53
54
|
- lib/circleci/parallel/task/base.rb
|
54
55
|
- lib/circleci/parallel/task/master.rb
|
56
|
+
- lib/circleci/parallel/task/mock_master.rb
|
57
|
+
- lib/circleci/parallel/task/mock_slave.rb
|
55
58
|
- lib/circleci/parallel/task/slave.rb
|
56
59
|
- lib/circleci/parallel/version.rb
|
57
60
|
homepage: https://github.com/increments/circleci-parallel
|