knapsack 0.5.0 → 1.0.0

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.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +16 -16
  3. data/CHANGELOG.md +6 -0
  4. data/README.md +162 -61
  5. data/TODO.md +1 -1
  6. data/bin/print_header.sh +5 -0
  7. data/knapsack.gemspec +4 -2
  8. data/{knapsack_report.json → knapsack_rspec_report.json} +0 -0
  9. data/lib/knapsack.rb +5 -2
  10. data/lib/knapsack/adapters/base_adapter.rb +17 -1
  11. data/lib/knapsack/adapters/cucumber_adapter.rb +40 -0
  12. data/lib/knapsack/adapters/rspec_adapter.rb +5 -2
  13. data/lib/knapsack/allocator.rb +10 -11
  14. data/lib/knapsack/allocator_builder.rb +33 -0
  15. data/lib/knapsack/config/env.rb +30 -0
  16. data/lib/knapsack/config/tracker.rb +19 -0
  17. data/lib/knapsack/distributors/base_distributor.rb +18 -28
  18. data/lib/knapsack/distributors/leftover_distributor.rb +14 -14
  19. data/lib/knapsack/distributors/report_distributor.rb +33 -33
  20. data/lib/knapsack/presenter.rb +4 -4
  21. data/lib/knapsack/report.rb +13 -11
  22. data/lib/knapsack/tracker.rb +20 -15
  23. data/lib/knapsack/version.rb +1 -1
  24. data/lib/tasks/knapsack_cucumber.rake +19 -0
  25. data/lib/tasks/knapsack_rspec.rake +19 -0
  26. data/spec/knapsack/adapters/cucumber_adapter_spec.rb +69 -0
  27. data/spec/knapsack/adapters/rspec_adapter_spec.rb +26 -18
  28. data/spec/knapsack/allocator_builder_spec.rb +88 -0
  29. data/spec/knapsack/allocator_spec.rb +26 -27
  30. data/spec/knapsack/{config_spec.rb → config/env_spec.rb} +9 -32
  31. data/spec/knapsack/config/tracker_spec.rb +24 -0
  32. data/spec/knapsack/distributors/base_distributor_spec.rb +26 -39
  33. data/spec/knapsack/distributors/leftover_distributor_spec.rb +49 -31
  34. data/spec/knapsack/distributors/report_distributor_spec.rb +35 -41
  35. data/spec/knapsack/presenter_spec.rb +5 -5
  36. data/spec/knapsack/report_spec.rb +5 -9
  37. data/spec/knapsack/task_loader_spec.rb +4 -2
  38. data/spec/knapsack/tracker_spec.rb +14 -14
  39. data/spec/support/mocks/cucumber.rb +12 -0
  40. data/spec/support/shared_examples/adapter.rb +0 -4
  41. data/spec_examples/leftover/1_spec.rb +1 -1
  42. data/spec_examples/leftover/a_spec.rb +1 -1
  43. data/spec_examples/spec_helper.rb +1 -1
  44. metadata +54 -11
  45. data/lib/knapsack/config.rb +0 -40
  46. data/lib/tasks/knapsack.rake +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa40f580898155eb65fe8e84fc8345a476a0a0ab
4
- data.tar.gz: 62ff398b48201c72d6074a9e174955c317b52718
3
+ metadata.gz: 16c44dfa2ed757dfcf1a0eb1cb207f01ec283160
4
+ data.tar.gz: f78966c7d310b9e46c1c4294ff308cde1598287e
5
5
  SHA512:
6
- metadata.gz: f2c797ee5e47d102f93bb618dbe2fe2bf1fdd9c5efefcb5c42e886f19382efdbef2292b1d7c0ace2fbb4716e060f3bf26e652e39acb7532f72873c3be33856e2
7
- data.tar.gz: 42450a7369f6e9989b31975d54aa49c7f4b1341a1dff1d9fec37c66c9eef33acdc148870b3bc48f5708edeeb27fce107b0b38176070917dcee99a33404fce3d5
6
+ metadata.gz: 94294aa56a3788c45f09560a599a1dc8b0c6993a4c5b79155830d0c25b2d1cda2c4d6fc361f4bae8f5f40e1aa49cbad3926d4ef787f9e24c2f34fbcd9516213f
7
+ data.tar.gz: d7061de09db8a6bd54d1e823aff71893016e48a8f1e4299282d6d8826d40e0e050558b1bd03c85de200ce482c62c91af0df3ad7e1e3487b9c2a1158b0ec0d682
@@ -13,32 +13,32 @@ addons:
13
13
  before_install:
14
14
  - "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
15
15
  script:
16
- - echo "Run specs for Knapsack gem"
16
+ - bin/print_header.sh "Run specs for Knapsack gem"
17
17
  - bundle exec rspec spec
18
18
 
19
- - echo "Generate knapsack report"
19
+ - bin/print_header.sh "Generate knapsack report"
20
20
  - KNAPSACK_GENERATE_REPORT=true bundle exec rspec --default-path spec_examples --tag focus
21
21
 
22
- - echo "Run specs with enabled time offset warning"
22
+ - bin/print_header.sh "Run specs with enabled time offset warning"
23
23
  - bundle exec rspec --default-path spec_examples
24
24
 
25
- - echo "Run rake task for the first CI node"
26
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_SPEC_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
27
- - echo "Run rake task for the second CI node"
28
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_SPEC_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
25
+ - bin/print_header.sh "Run rake task for the first CI node"
26
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=0 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
27
+ - bin/print_header.sh "Run rake task for the second CI node"
28
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=1 KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
29
29
 
30
- - echo "Check passing arguments to rspec. Run only specs with custom_focus tag"
31
- - KNAPSACK_SPEC_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake "knapsack:rspec[--tag custom_focus]"
30
+ - bin/print_header.sh "Check passing arguments to rspec. Run only specs with custom_focus tag"
31
+ - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake "knapsack:rspec[--tag custom_focus]"
32
32
 
33
- - echo "Run specs with custom knapsack logger"
34
- - CUSTOM_LOGGER=true KNAPSACK_SPEC_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
33
+ - bin/print_header.sh "Run specs with custom knapsack logger"
34
+ - CUSTOM_LOGGER=true KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
35
35
 
36
- - echo "Run specs for custom knapsack report path"
37
- - cp knapsack_report.json custom_knapsack_report.json
38
- - KNAPSACK_REPORT_PATH="custom_knapsack_report.json" KNAPSACK_SPEC_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
36
+ - bin/print_header.sh "Run specs for custom knapsack report path"
37
+ - cp knapsack_rspec_report.json knapsack_custom_report.json
38
+ - KNAPSACK_REPORT_PATH="knapsack_custom_report.json" KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
39
39
 
40
- - echo "Run specs when spec file was removed and still exists in knapsack report json"
40
+ - bin/print_header.sh "Run specs when spec file was removed and still exists in knapsack report json"
41
41
  - rm spec_examples/fast/1_spec.rb
42
- - KNAPSACK_SPEC_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
42
+ - KNAPSACK_TEST_FILE_PATTERN="spec_examples/**/*_spec.rb" bundle exec rake knapsack:rspec
43
43
  notifications:
44
44
  email: false
@@ -2,6 +2,12 @@
2
2
 
3
3
  * TODO
4
4
 
5
+ ### 1.0.0
6
+
7
+ * Add cucumber support.
8
+ * Rename environment variable KNAPSACK_SPEC_PATTERN to KNAPSACK_TEST_FILE_PATTERN.
9
+ * Default name of knapsack report json file is based on adapter name so for RSpec the default report name is `knapsack_rspec_report.json` and for Cucumber the report name is `knapsack_cucumber_report.json`.
10
+
5
11
  ### 0.5.0
6
12
 
7
13
  * Allow passing arguments to rspec via knapsack:rspec task.
data/README.md CHANGED
@@ -14,12 +14,12 @@
14
14
 
15
15
  **Knapsack splits tests across CI nodes and makes sure that tests will run comparable time on each node.**
16
16
 
17
- Parallel specs across CI server nodes based on each spec file's time execution. Knapsack generates a spec time execution report and uses it for future test runs.
17
+ Parallel tests across CI server nodes based on each test file's time execution. Knapsack generates a test time execution report and uses it for future test runs.
18
18
 
19
19
  Presentations about gem:
20
20
 
21
- * [2014 X Kraków Ruby User Group](http://slides.com/arturt/parallel-tests-in-comparable-time)
22
- * [2014 VII Lunar Logic Dev Meeting](http://slides.com/arturt/knapsack)
21
+ * [X 2014 Kraków Ruby User Group](http://slides.com/arturt/parallel-tests-in-comparable-time)
22
+ * [VII 2014 Lunar Logic Dev Meeting](http://slides.com/arturt/knapsack)
23
23
 
24
24
  **[Sign up](http://knapsack.launchrock.com) to get info about launch Knapsack Pro with more features and free access for beta users.**
25
25
 
@@ -31,11 +31,17 @@ Presentations about gem:
31
31
 
32
32
  ![With Knapsack gem](docs/images/with_knapsack.png)
33
33
 
34
+ ## Update gem
35
+
36
+ Please check [changelog](CHANGELOG.md) before update gem. Knapsack follows [semantic versioning](http://semver.org).
37
+
34
38
  ## Installation
35
39
 
36
40
  Add this line to your application's Gemfile:
37
41
 
38
- gem 'knapsack'
42
+ ```ruby
43
+ gem 'knapsack'
44
+ ```
39
45
 
40
46
  And then execute:
41
47
 
@@ -43,55 +49,97 @@ And then execute:
43
49
 
44
50
  ## Usage
45
51
 
52
+ ### Step for RSpec
53
+
46
54
  Add at the beginning of your `spec_helper.rb`:
47
55
 
48
- require 'knapsack'
56
+ ```ruby
57
+ require 'knapsack'
58
+
59
+ # CUSTOM_CONFIG_GOES_HERE
60
+
61
+ Knapsack::Adapters::RspecAdapter.bind
62
+ ```
63
+
64
+ ### Step for Cucumber
65
+
66
+ Create file `features/support/knapsack.rb` and add there:
67
+
68
+ ```ruby
69
+ require 'knapsack'
49
70
 
50
- # default configuration, you can change it or omit completely
51
- Knapsack.tracker.config({
52
- enable_time_offset_warning: true,
53
- time_offset_in_seconds: 30
54
- })
71
+ # CUSTOM_CONFIG_GOES_HERE
55
72
 
56
- # default configuration for report, you can change it or omit completely
57
- Knapsack.report.config({
58
- report_path: 'knapsack_report.json'
59
- })
73
+ Knapsack::Adapters::CucumberAdapter.bind
74
+ ```
60
75
 
61
- # you can use your own logger or omit completely
62
- require 'logger'
63
- Knapsack.logger = Logger.new(STDOUT)
64
- Knapsack.logger.level = Logger::INFO
76
+ ### Custom configuration
65
77
 
66
- # bind adapter, required
67
- Knapsack::Adapters::RspecAdapter.bind
78
+ You can change default Knapsack configuration for RSpec or Cucumber tests. Here are examples what you can do. Put below configuration instead of `CUSTOM_CONFIG_GOES_HERE`.
79
+
80
+ ```ruby
81
+ Knapsack.tracker.config({
82
+ enable_time_offset_warning: true,
83
+ time_offset_in_seconds: 30
84
+ })
85
+
86
+ Knapsack.report.config({
87
+ test_file_pattern: 'spec/**/*_spec.rb', # default value based on adapter
88
+ report_path: 'knapsack_custom_report.json'
89
+ })
90
+
91
+ # you can use your own logger
92
+ require 'logger'
93
+ Knapsack.logger = Logger.new(STDOUT)
94
+ Knapsack.logger.level = Logger::INFO
95
+ ```
96
+
97
+ ### Common step
68
98
 
69
99
  Add in your `Rakefile` this lines:
70
100
 
71
- require 'knapsack'
72
- Knapsack.load_tasks
101
+ ```ruby
102
+ require 'knapsack'
103
+ Knapsack.load_tasks
104
+ ```
73
105
 
74
- Generate time execution report for your spec files. Run below command on one of your CI nodes.
106
+ Generate time execution report for your test files. Run below command on one of your CI nodes.
75
107
 
108
+ # Step for RSpec
76
109
  $ KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec
77
110
 
78
- Commit generated report `knapsack_report.json` into your repository.
111
+ # Step for Cucumber
112
+ $ KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features
79
113
 
80
- This report should be updated only after you add a lot of new slow tests or you change existing ones which causes a big time execution difference between CI nodes. Either way, you will get time offset warning at the end of the rspec results which reminds you when it’s a good time to regenerate the knapsack report.
114
+ Commit generated report `knapsack_rspec_report.json` or `knapsack_cucumber_report.json` into your repository.
115
+
116
+ This report should be updated only after you add a lot of new slow tests or you change existing ones which causes a big time execution difference between CI nodes. Either way, you will get time offset warning at the end of the rspec/cucumber results which reminds you when it’s a good time to regenerate the knapsack report.
81
117
 
82
118
  ## Setup your CI server
83
119
 
84
120
  On your CI server run this command for the first CI node. Update `CI_NODE_INDEX` for the next one.
85
121
 
122
+ # Step for RSpec
86
123
  $ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
87
124
 
88
- You can add `KNAPSACK_SPEC_PATTERN` if your specs are not in `spec` directory. For instance:
125
+ # Step for Cucumber
126
+ $ CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:cucumber
127
+
128
+ You can add `KNAPSACK_TEST_FILE_PATTERN` if your tests are not in default directory. For instance:
129
+
130
+ # Step for RSpec
131
+ $ KNAPSACK_TEST_FILE_PATTERN="directory_with_specs/**/*_spec.rb" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
89
132
 
90
- $ KNAPSACK_SPEC_PATTERN="directory_with_specs/**/*_spec.rb" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
133
+ # Step for Cucumber
134
+ $ KNAPSACK_TEST_FILE_PATTERN="directory_with_features/**/*.feature" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:cucumber
91
135
 
92
136
  You can set `KNAPSACK_REPORT_PATH` if your knapsack report was saved in non default location. Example:
93
137
 
94
- $ KNAPSACK_REPORT_PATH="custom_knapsack_report.json" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
138
+ # Step for RSpec
139
+ $ KNAPSACK_REPORT_PATH="knapsack_custom_report.json" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:rspec
140
+
141
+ # Step for Cucumber
142
+ $ KNAPSACK_REPORT_PATH="knapsack_custom_report.json" CI_NODE_TOTAL=2 CI_NODE_INDEX=0 bundle exec rake knapsack:cucumber
95
143
 
96
144
  ### Info about ENV variables
97
145
 
@@ -109,7 +157,13 @@ To do this with Knapsack you simply add your rspec arguments as parameters to th
109
157
 
110
158
  $ bundle exec rake "knapsack:rspec[--tag focus]"
111
159
 
112
- Remember that using tags to limit which specs get run will affect the time each file takes to run. One solution to this is to generate a new `knapsack_report.json` for the commonly run scenarios.
160
+ Remember that using tags to limit which specs get run will affect the time each file takes to run. One solution to this is to generate a new `knapsack_rspec_report.json` for the commonly run scenarios.
161
+
162
+ ### Passing arguments to cucumber
163
+
164
+ Add arguments to knapsack cucumber task like this:
165
+
166
+ $ bundle exec rake "knapsack:cucumber[--name feature]"
113
167
 
114
168
  ### Info for CircleCI users
115
169
 
@@ -119,54 +173,87 @@ Here is an example for test configuration in your `circleci.yml` file.
119
173
 
120
174
  #### Step 1
121
175
 
122
- For the first time run all specs on a single CI node with enabled report generator.
176
+ For the first time run all tests on a single CI node with enabled report generator.
123
177
 
124
- test:
125
- override:
126
- - KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec
178
+ ```yaml
179
+ test:
180
+ override:
181
+ # Step for RSpec
182
+ - KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec
127
183
 
128
- After tests pass on your CircleCI machine your should copy knapsack json report which is rendered at the end of rspec results. Save it into your repository as `knapsack_report.json` file and commit.
184
+ # Step for Cucumber
185
+ - KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features
186
+ ```
187
+
188
+ After tests pass on your CircleCI machine your should copy knapsack json report which is rendered at the end of rspec/cucumber results. Save it into your repository as `knapsack_rspec_report.json` or `knapsack_cucumber_report.json` file and commit.
129
189
 
130
190
  #### Step 2
131
191
 
132
192
  Now you should update test command and enable parallel. Please remember to add additional containers for your project in CircleCI settings.
133
193
 
134
- test:
135
- override:
136
- - bundle exec rake knapsack:rspec:
137
- parallel: true
194
+ ```yaml
195
+ test:
196
+ override:
197
+ # Step for RSpec
198
+ - bundle exec rake knapsack:rspec:
199
+ parallel: true
200
+
201
+ # Step for Cucumber
202
+ - bundle exec rake knapsack:cucumber:
203
+ parallel: true
204
+ ```
138
205
 
139
- Now everything should works. You will get warning at the end of rspec results if time execution will take too much.
206
+ Now everything should works. You will get warning at the end of rspec/cucumber results if time execution will take too much.
140
207
 
141
208
  ### Info for Travis users
142
209
 
143
210
  #### Step 1
144
211
 
145
- For the first time run all specs at once with enabled report generator. Edit `.travis.yml`
212
+ For the first time run all tests at once with enabled report generator. Edit `.travis.yml`
213
+
214
+ ```yaml
215
+ # Step for RSpec
216
+ script: "KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec"
146
217
 
147
- script: "KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec"
218
+ # Step for Cucumber
219
+ script: "KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features"
220
+ ```
148
221
 
149
- After tests pass your should copy knapsack json report which is rendered at the end of rspec results. Save it into your repository as `knapsack_report.json` file and commit.
222
+ After tests pass your should copy knapsack json report which is rendered at the end of rspec/cucumber results. Save it into your repository as `knapsack_rspec_report.json` or `knapsack_cucumber_report.json` file and commit.
150
223
 
151
224
  #### Step 2
152
225
 
153
226
  You can parallel your builds across virtual machines with [travis matrix feature](http://docs.travis-ci.com/user/speeding-up-the-build/#Parallelizing-your-builds-across-virtual-machines). Edit `.travis.yml`
154
227
 
155
- script: "bundle exec rake knapsack:rspec"
156
- env:
157
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0
158
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1
228
+ ```yaml
229
+ # Step for RSpec
230
+ script: "bundle exec rake knapsack:rspec"
231
+
232
+ # Step for Cucumber
233
+ script: "bundle exec rake knapsack:cucumber"
234
+
235
+ env:
236
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=0
237
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=1
238
+ ```
159
239
 
160
240
  If you want to have some global ENVs and matrix of ENVs then do it like this:
161
241
 
162
- script: "bundle exec rake knapsack:rspec"
163
- env:
164
- global:
165
- - RAILS_ENV=test
166
- - MY_GLOBAL_VAR=123
167
- matrix:
168
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=0
169
- - CI_NODE_TOTAL=2 CI_NODE_INDEX=1
242
+ ```yaml
243
+ # Step for RSpec
244
+ script: "bundle exec rake knapsack:rspec"
245
+
246
+ # Step for Cucumber
247
+ script: "bundle exec rake knapsack:cucumber"
248
+
249
+ env:
250
+ global:
251
+ - RAILS_ENV=test
252
+ - MY_GLOBAL_VAR=123
253
+ matrix:
254
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=0
255
+ - CI_NODE_TOTAL=2 CI_NODE_INDEX=1
256
+ ```
170
257
 
171
258
  Such configuration will generate matrix with 2 following ENV rows:
172
259
 
@@ -179,25 +266,35 @@ More info about global and matrix ENV configuration in [travis docs](http://docs
179
266
 
180
267
  #### Step 1
181
268
 
182
- For the first time run all specs at once with enabled report generator. Set up your build command:
269
+ For the first time run all tests at once with enabled report generator. Set up your build command:
183
270
 
271
+ # Step for RSpec
184
272
  KNAPSACK_GENERATE_REPORT=true bundle exec rspec spec
185
273
 
186
- After tests pass your should copy knapsack json report which is rendered at the end of rspec results. Save it into your repository as `knapsack_report.json` file and commit.
274
+ # Step for Cucumber
275
+ KNAPSACK_GENERATE_REPORT=true bundle exec cucumber features
276
+
277
+ After tests pass your should copy knapsack json report which is rendered at the end of rspec/cucumber results. Save it into your repository as `knapsack_rspec_report.json` or `knapsack_cucumber_report.json` file and commit.
187
278
 
188
279
  #### Step 2
189
280
 
190
- Knapsack supports semaphoreapp ENVs `SEMAPHORE_THREAD_COUNT` and `SEMAPHORE_CURRENT_THREAD`. The only thing you need to do is set up knapsack rspec command for as many threads as you need. Here is an example:
281
+ Knapsack supports semaphoreapp ENVs `SEMAPHORE_THREAD_COUNT` and `SEMAPHORE_CURRENT_THREAD`. The only thing you need to do is set up knapsack rspec/cucumber command for as many threads as you need. Here is an example:
191
282
 
192
- # thread 1
283
+ # Thread 1
284
+ ## Step for RSpec
193
285
  bundle exec rake knapsack:rspec
286
+ ## Step for Cucumber
287
+ bundle exec rake knapsack:cucumber
194
288
 
195
- # thread 2
289
+ # Thread 2
290
+ ## Step for RSpec
196
291
  bundle exec rake knapsack:rspec
292
+ ## Step for Cucumber
293
+ bundle exec rake knapsack:cucumber
197
294
 
198
295
  Tests will be split across threads.
199
296
 
200
- ## Tests
297
+ ## Gem tests
201
298
 
202
299
  ### Spec
203
300
 
@@ -213,7 +310,7 @@ To generate a new knapsack report for specs with `focus` tag (only specs in `spe
213
310
 
214
311
  $ KNAPSACK_GENERATE_REPORT=true bundle exec rspec --default-path spec_examples --tag focus
215
312
 
216
- **Warning:** Current `knapsack_report.json` file was generated for `spec_examples` except `spec_examples/leftover` directory. Just for testing reason to see how leftover specs will be distribute in a dumb way across CI nodes.
313
+ **Warning:** Current `knapsack_rspec_report.json` file was generated for `spec_examples` except `spec_examples/leftover` directory. Just for testing reason to see how leftover specs will be distribute in a dumb way across CI nodes.
217
314
 
218
315
  To see specs distributed for the first CI node type:
219
316
 
@@ -223,6 +320,10 @@ Specs in `spec_examples/leftover` take more than 3 seconds. This should cause a
223
320
 
224
321
  $ bundle exec rspec --default-path spec_examples
225
322
 
323
+ ### Cucumber examples
324
+
325
+ Here is [a fork of Loomio](https://github.com/ArturT/loomio) Rails application with a lot of cucumber features and some rspec examples. Knapsack was added there - [see code changes](https://github.com/ArturT/loomio/compare/loomio:master...add-knapsack-gem). Tests were splitted across a few machines on Travis CI - [see builds](https://travis-ci.org/ArturT/loomio/builds).
326
+
226
327
  ## Contributing
227
328
 
228
329
  1. Fork it ( https://github.com/ArturT/knapsack/fork )
data/TODO.md CHANGED
@@ -1,4 +1,4 @@
1
1
  # TODO
2
2
 
3
- * Add other adapters and rake tasks than RSpec.
3
+ * Add other adapters and rake tasks than RSpec and Cucumber.
4
4
  * Add support for ENV CI node total and CI node index other than CircleCI.
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ echo ==========================================================================================================================
4
+ echo $1
5
+ echo ==========================================================================================================================
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Knapsack::VERSION
9
9
  spec.authors = ["ArturT"]
10
10
  spec.email = ["arturtrzop@gmail.com"]
11
- spec.summary = %q{Parallel specs across CI server nodes based on each spec file's time execution.}
12
- spec.description = %q{Parallel specs across CI server nodes based on each spec file's time execution. It generates a spec time execution report and uses it for future test runs.}
11
+ spec.summary = %q{Knapsack splits tests across CI nodes and makes sure that tests will run comparable time on each node.}
12
+ spec.description = %q{Parallel tests across CI server nodes based on each test file's time execution. It generates a test time execution report and uses it for future test runs.}
13
13
  spec.homepage = "https://github.com/ArturT/knapsack"
14
14
  spec.license = "MIT"
15
15
 
@@ -21,6 +21,8 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency 'bundler', '~> 1.6'
22
22
  spec.add_development_dependency 'rake', '~> 0'
23
23
  spec.add_development_dependency 'rspec', '~> 3.0', '>= 2.0.0'
24
+ spec.add_development_dependency 'cucumber', '>= 1.3'
24
25
  spec.add_development_dependency 'timecop', '~> 0'
25
26
  spec.add_development_dependency 'codeclimate-test-reporter', '~> 0'
27
+ spec.add_development_dependency 'pry', '~> 0'
26
28
  end