Skip to content
This repository has been archived by the owner on Aug 27, 2024. It is now read-only.

Commit

Permalink
v0.9.2: Set simultaneous file limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Barry authored and Barry committed Nov 29, 2017
1 parent d7b6ecb commit 386b698
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v0.9.2
## 11/29/2017

1. [](#new)
* Set how many files will be generated simultaneously.

# v0.9.1
## 10/23/2017

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ bin/plugin blackhole generate http://localhost/grav
```

- **Output Path** `--output-path` or `-p`
Set the directory to which your static site will be written (relative to Grav root).
Set the directory to which your static site will be written relative to Grav root (default: Grav root).

```bash
--output-path ../build
Expand All @@ -56,6 +56,13 @@ bin/plugin blackhole generate http://localhost/grav
--routes home,about,about/contact
```

- **Simultaneous Limit** `--simultaneous` or `-s`
Set how many files to generate at the same time (default: 10)

```bash
--simultaneous 10
```

- **Force** `--force` or `-f`
Overwrite previously generated files.

Expand Down
2 changes: 1 addition & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Blackhole
version: 0.9.1
version: 0.9.2
description: Static site generator for Grav
icon: circle
author:
Expand Down
31 changes: 20 additions & 11 deletions cli/GenerateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ protected function configure() {
InputOption::VALUE_REQUIRED,
'Define a list of routes to only generate certain pages. Accepts a comma-separated list.'
)
->addOption(
'simultaneous',
's',
InputOption::VALUE_REQUIRED,
'Set how many files to generate at the same time.'
)
->addOption(
'force',
'f',
Expand All @@ -53,17 +59,19 @@ protected function serve() {

// get options
$this->options = [
'input-url' => $this->input->getArgument('input-url'),
'output-url' => $this->input->getOption('output-url'),
'output-path' => $this->input->getOption('output-path'),
'routes' => $this->input->getOption('routes'),
'force' => $this->input->getOption('force')
'input-url' => $this->input->getArgument('input-url'),
'output-url' => $this->input->getOption('output-url'),
'output-path' => $this->input->getOption('output-path'),
'routes' => $this->input->getOption('routes'),
'simultaneous' => $this->input->getOption('simultaneous'),
'force' => $this->input->getOption('force')
];
$input_url = $this->options['input-url'];
$output_url = $this->options['output-url'];
$output_path = $this->options['output-path'];
$routes = $this->options['routes'];
$force = $this->options['force'];
$input_url = $this->options['input-url'];
$output_url = $this->options['output-url'];
$output_path = $this->options['output-path'];
$routes = $this->options['routes'];
$simultaneous = !empty($this->options['simultaneous']) ? $this->options['simultaneous'] : 10;
$force = $this->options['force'];

// curl
function pull($light) {
Expand Down Expand Up @@ -113,6 +121,7 @@ function generate($bh_route, $bh_file_path, $grav_page_data) {
$request->bh_file_path = preg_replace('/\/\/+/', '/', $request->bh_route . '/index.html');
$request->input_url = $input_url;
$request->output_url = $output_url;
$request->simultaneous = $simultaneous;
$request->force = $force;
$rollingCurl->add($request);
}
Expand Down Expand Up @@ -147,7 +156,7 @@ function generate($bh_route, $bh_file_path, $grav_page_data) {
$rollingCurl->clearCompleted();
$rollingCurl->prunePendingRequestQueue();
})
->setSimultaneousLimit(20)
->setSimultaneousLimit($request->simultaneous)
->execute()
;
$this->output->writeln("Done in " . (microtime(true) - $start) . ' seconds');
Expand Down

0 comments on commit 386b698

Please sign in to comment.