dox Executable Documentation

From file

Just source

Given the composer json '{ "extra": { "fido-fetch": { "some asset": { "source":"http://example.com/some/file.txt" } } } }'
When I run composer with the plugin
Then there should be a file 'assets/vendor/file.txt' containing 'Got me'
Then the output should contain 'Installing fido/file_txt-3a011e75a5580c7726fd9bd3b6e66dbc (1.0)'
Then the output should contain 'vendor/fido/file_txt-3a011e75a5580c7726fd9bd3b6e66dbc/file.txt -> assets/vendor/file.txt'

With target

Given the composer json '{ "extra": { "fido-fetch": { "some asset": { "source":"http://example.com/some/file.txt", "target":"my/asset.js" } } } }'
When I run composer with the plugin
Then there should be a file 'assets/vendor/my/asset.js' containing 'Got me'
Then the output should contain '-> assets/vendor/my/asset.js'

Other base dir

Given the composer json '{ "extra": { "fido-fetch": { "base-dir": "my/base", "some asset": { "source":"http://example.com/some/file.txt" } } } }'
When I run composer with the plugin
Then there should be a file 'my/base/file.txt' containing 'Got me'
Then the output should contain '-> my/base/file.txt'

Source as key

Given the composer json '{ "extra": { "fido-fetch": { "http://example.com/some/file.txt":{} } } }'
When I run composer with the plugin
Then there should be a file 'assets/vendor/file.txt' containing 'Got me'

Target as value

Given the composer json '{ "extra": { "fido-fetch": { "http://example.com/some/file.txt":"my/target.txt" } } }'
When I run composer with the plugin
Then there should be a file 'assets/vendor/my/target.txt' containing 'Got me'

Specify type

Given the remote file 'http://example.com/some/file.git' containing 'Got git'
Given the composer json '{ "extra": { "fido-fetch": { "some asset": { "source":"http://example.com/some/file.git", "type":"file" } } } }'
When I run composer with the plugin
Then there should be a file 'assets/vendor/file.git' containing 'Got git'

Invalid type

Given the remote file 'http://example.com/some/file.git' containing 'Got git'
Given the composer json '{ "extra": { "fido-fetch": { "some asset": { "source":"http://example.com/some/file.git", "type":"invalid" } } } }'
When I try to run composer with the plugin
Then the exception 'Cannot fetch [some asset]: Unknown type [invalid]' should be thrown

In require

Given the composer json '{ "require": { "fido-fetch:http://example.com/some/file.txt":"*" } }'
When I run composer with the plugin
Then there should be a file 'assets/vendor/file.txt' containing 'Got me'

background

Given the remote file 'http://example.com/some/file.txt' containing 'Got me'