Skip to content

Commit

Permalink
Merge pull request #5 from adrian-gheorghe/develop
Browse files Browse the repository at this point in the history
Readme Improvements
  • Loading branch information
adrian-gheorghe authored Jul 14, 2019
2 parents ad7fa85 + 7759e81 commit a8b658f
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 65 deletions.
128 changes: 65 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

mediafaker is a small utility written in go that creates a fake version of a source directory passed to it. mediafaker is dedicated to the developers that need to work on local environments without the need to copy static resources from production environments.

The path can be local or over SSH provided correct credentials are passed to the utility.
The faked path can be local or over SSH provided correct credentials are passed to the utility. mediafaker can also fake a directory tree generated by moni (https://github.com/adrian-gheorghe/moni)

# Manual
```bash
Expand Down Expand Up @@ -35,18 +35,18 @@ Use "mediafaker [command] --help" for more information about a command.
wget -O https://raw.githubusercontent.com/adrian-gheorghe/mediafaker/master/install.sh | bash
```
```bash
sh -c "$(curl -fsSL https://raw.githubusercontent.com/adrian-gheorghe/mediafaker/master/install.sh)"
bash -c "$(curl -fsSL https://raw.githubusercontent.com/adrian-gheorghe/mediafaker/master/install.sh)"
```
## Download
Download latest from the releases page: https://github.com/adrian-gheorghe/mediafaker/releases.
# Usage
mediafaker can be used in 2 ways, to either fake a local path or a remote url / ssh path.
mediafaker can be used in 2 ways, to either fake a local path or a remote url json tree / ssh path.
## Local
The simplest way is when the path you want to fake is on the same host as the destination path. Then you can run mediafaker local
The simplest use case is when the path you want to fake is on the same host as the destination path. Then you can run mediafaker local
```sh
mediafaker local \
Expand All @@ -57,6 +57,66 @@ mediafaker local \
## Remote
When the source and destination paths are on different hosts mediafaker uses https://github.com/adrian-gheorghe/moni in order to generate a json representation of the directory you want to fake.
### URL
You can use moni https://github.com/adrian-gheorghe/moni or any other tool to generate a json output of the following form. mediafaker can use this to generate a fake version of the tree in your desired source.
```bash
mediafaker url \
--source="http://example.org/path/to/moni.output.json" \
--destination="/home/project/public/fake/destination"
```
This flow can easily be automated to give you access to a fresh abstracted version of the tree on demand.
You can get moni to run on your server periodically and create a new version of the output.json file as often as you like.
You can run mediafaker locally or on your dev/stage environments in order to have an up to date faked version of the public assets in production.
### SSH
mediafaker has a ssh client built in. When calling the ssh command, mediafaker attempts to:
- connect to your remote host using the credentials provided
- download moni from github
- run moni to generate a new output.json file
- downloads the compressed output file
- removes moni and the output tree from your remote host
- fakes the output tree locally
```bash
mediafaker ssh \
--source "/var/www/html/public" \
--destination "/home/project/public/fake/destination" \
--ssh-host "22.22.22.22" \
--ssh-user "user" \
--ssh-key "/home/.ssh/id_rsa_private_key_to_use"
```
## Image Pixelation
One of the main features of mediafaker is that it will read image files and create a pixelated version of the original image keeping the same dimensions and main colors. This saves time and precious disk space while also allowing you to have a drop in replacement for your images
mediafaker will proceed to create an exact replica of the source directory, by creating mock files. The mock files created try to follow the originals as much as possible.
#### Magento Luma Sample Data 1
![MediaFaker 1](demo/mediafaker2.jpg)
#### Magento Luma Sample Data 2
![MediaFaker 1](demo/mediafaker3.jpg)
#### Magento Luma Original
![MediaFaker 1](demo/mediafaker1.jpg)
## Documents
- Xlsx support added using the https://github.com/tealeg/xlsx package
- Pdf support added using the https://github.com/johnfercher/maroto package
- Docx, Pptx, CSV to be added
- Audio and Video file support to be added soon (mp3, wav, mp4, avi)
- Json and CSV file support to be added soon
## Features not yet implemented
- directory/file permissions
- fake from mediatype
- fake file and directory names
- directory depth parameter
- file age ignore parameter
## Moni Sample Directory Tree Json
```json
[
{
Expand Down Expand Up @@ -132,62 +192,4 @@ When the source and destination paths are on different hosts mediafaker uses htt
"Children": null
}
]
```
### URL
You can use moni https://github.com/adrian-gheorghe/moni or any other tool to generate a json output of the following form. mediafaker can use this to generate a fake version of the tree in your desired source.
```bash
mediafaker url \
--source="http://example.org/path/to/moni.output.json" \
--destination="/home/project/public/fake/destination"
```
This flow can easily be automated to give you access to a fresh abstracted version of the tree on demand.
You can get moni to run on your server periodically and create a new version of the output.json file as often as you like.
You can run mediafaker locally or on your dev/stage environments in order to have an up to date faked version of the public assets in production.
### SSH
mediafaker has a ssh client built in. When calling the ssh command, mediafaker attempts to:
- connect to your remote host using the credentials provided
- download moni from github
- run moni to generate a new output.json file
- downloads the compressed output file
- removes moni and the output tree from your remote host
- fakes the output tree locally
```bash
mediafaker ssh \
--source "/var/www/html/public" \
--destination "/home/project/public/fake/destination" \
--ssh-host "22.22.22.22" \
--ssh-user "user" \
--ssh-key "/home/.ssh/id_rsa_private_key_to_use"
```
## Image Pixelation
One of the main features of mediafaker is that it will read image files and create a pixelated version of the original image keeping the same dimensions and main colors. This saves time and precious disk space while also allowing you to have a drop in replacement for your images
mediafaker will proceed to create an exact replica of the source directory, by creating mock files. The mock files created try to follow the originals as much as possible.
#### Magento Luma Sample Data 1
![MediaFaker 1](demo/mediafaker2.jpg)
#### Magento Luma Sample Data 2
![MediaFaker 1](demo/mediafaker3.jpg)
#### Magento Luma Original
![MediaFaker 1](demo/mediafaker1.jpg)
## Documents
- Xlsx support added using the https://github.com/tealeg/xlsx package
- Pdf support added using the https://github.com/johnfercher/maroto package
- Docx, Pptx, CSV to be added
- Audio and Video file support to be added soon (mp3, wav, mp4, avi)
- Json and CSV file support to be added soon
## Features not yet implemented
- directory/file permissions
- fake from mediatype
- fake file and directory names
- directory depth parameter
- file age ignore parameter
```
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.1.3
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/spf13/cobra"
)

var AppVersion = "0.1.2"
var AppVersion = "0.1.3"

var RootCmd = &cobra.Command{
Use: "mediafaker",
Expand Down

0 comments on commit a8b658f

Please sign in to comment.