<commit_before># silverstripe-vagrant
Vagrant setup for SilverStripe CMS. All-in-one vagrant setup with sspak, composer, gulp, sake, apache, mysql in it.


## Project structure

       Project root
       /         \
    config.json    public
               	    \
              	    Silverstripe files



## Installation

clone vagrant to public folder
```bash
cd public && git clone git@github.com:Webmaxsk/silverstripe-vagrant.git vagrant && rm -rf vagrant/.git
```

add config.json to Project root
- you can find sample in public/vagrant/config.json.sample
- set your static IP, theme path (if using gulp), provider (virtualbox or lxc), db

initialize vagrant
```bash
cd public/vagrant && vagrant up 
```

OPTIONAL: if using non-default vagrant provider add provider to the end
```bash
cd public/vagrant && vagrant up --provider="lxc"
```

add .vagrant folder to public/.gitignore
- you should commit vagrant dir, but not local vagrant setup (in public/vagrant/.vagrant)
- you can customize vagrant for each project individually - if it is in repository, every team member is sharing same vagrant setup

OPTIONAL: install quick vagrant execution script

Global script allowing execution of commands in vagrant guest from host 
```bash
cp -f public/vagrant/vrun /usr/local/bin/vrun
```
(you must be in public or public/vagrant folder) 

Example:
```bash
vrun top
```

NOTICE: all examples bellow will use this vrun script. Alternative to this script is:
```bash
cd public/vagrant
vagrant ssh
```
and executing script directly from vagrant shell.


## Post installation setup

You can edit httpd.conf according to your needs.
Restart apache after change:
```bash
vrun sudo service httpd restart
```

Install node modules (for gulp theme)
```bash
vrun mygulp install
```


## Usage
As our paths in vagrant guest are known and do not change in different projects, we can use extended versions of scripts with "my" prefix

### sspak
run any sspak command or use custom actions like save-local or load-2-local

```bash
vrun mysspak save-local test.sspak
```
will save test.sspak package to Project root

```bash
vrun mysspak load-2-local test.sspak
```
will load test.sspak stored in Project root. After execution, test.sspak will be renamed to test.sspak.used

### sake
run any sake command quickly.
```bash
vrun mysake anything
```

### composer
run any composer command quickly
```bash
vrun mycomposer anything
```

### gulp
run any gulp command quickly or install theme dependencies
```bash
vrun mygulp anything
```
```bash
vrun mygulp install
```


## Save vagarant guest for later usage / vagrant backup
After you finish your project, I do recommend to create ready to use vagrant package for later use.
```bash
cd public/vagrant
vagrant package --output ../../test.box
```
will save test.box to Project root. After, you can safely destroy existing vagrant ("vrun vagrant destroy") and archive whole Project. Once you need to run this project again, just unarchive project and change config.json in row "box" with "test.box" and run "vrun vagrant up"
NOTICE: "vrun vagrant anything" is not executed on vagrant guest, but in host (shortcut - you don't need to go to public/vagrant folder).


## ToDo
xdebug, ...<commit_msg>typo fix<commit_after># silverstripe-vagrant
Vagrant setup for SilverStripe CMS. All-in-one vagrant setup with sspak, composer, gulp, sake, apache, mysql in it.


## Project structure

       Project root
       /         \
    config.json    public
               	    \
              	    Silverstripe files



## Installation

clone vagrant to public folder
```bash
cd public && git clone <EMAIL>:Webmaxsk/silverstripe-vagrant.git vagrant && rm -rf vagrant/.git
```

add config.json to Project root
- you can find sample in public/vagrant/config.json.sample
- set your static IP, theme path (if using gulp), provider (virtualbox or lxc), db

initialize vagrant
```bash
cd public/vagrant && vagrant up 
```

OPTIONAL: if using non-default vagrant provider add provider to the end
```bash
cd public/vagrant && vagrant up --provider="lxc"
```

add .vagrant folder to public/.gitignore
- you should commit vagrant dir, but not local vagrant setup (in public/vagrant/.vagrant)
- you can customize vagrant for each project individually - if it is in repository, every team member is sharing same vagrant setup

OPTIONAL: install quick vagrant execution script

Global script allowing execution of commands in vagrant guest from host 
```bash
cp -f public/vagrant/vrun /usr/local/bin/vrun
```
(you must be in public or public/vagrant folder) 

Example:
```bash
vrun top
```

NOTICE: all examples bellow will use this vrun script. Alternative to this script is:
```bash
cd public/vagrant
vagrant ssh
```
and executing script directly from vagrant shell.


## Post installation setup

You can edit httpd.conf according to your needs.
Restart apache after change:
```bash
vrun sudo service httpd restart
```

Install node modules (for gulp theme)
```bash
vrun mygulp install
```


## Usage
As our paths in vagrant guest are known and do not change in different projects, we can use extended versions of scripts with "my" prefix

### sspak
run any sspak command or use custom actions like save-local or load-2-local

```bash
vrun mysspak save-local test.sspak
```
will save test.sspak package to Project root

```bash
vrun mysspak load-2-local test.sspak
```
will load test.sspak stored in Project root. After execution, test.sspak will be renamed to test.sspak.used

### sake
run any sake command quickly.
```bash
vrun mysake anything
```

### composer
run any composer command quickly
```bash
vrun mycomposer anything
```

### gulp
run any gulp command quickly or install theme dependencies
```bash
vrun mygulp anything
```
```bash
vrun mygulp install
```


## Save vagrant guest for later usage / vagrant backup
After you finish your project, I do recommend to create ready to use vagrant package for later use.
```bash
cd public/vagrant
vagrant package --output ../../test.box
```
will save test.box to Project root. After, you can safely destroy existing vagrant ("vrun vagrant destroy") and archive whole Project. Once you need to run this project again, just unarchive project and change config.json in row "box" with "test.box" and run "vrun vagrant up"
NOTICE: "vrun vagrant anything" is not executed on vagrant guest, but in host (shortcut - you don't need to go to public/vagrant folder).


## ToDo
xdebug, ...
{'fraction_non_alphanumeric': 0.0838639540301289, 'fraction_numerical': 0.0006212144742972511, 'mean_word_length': 3.875094625283876, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7497936', 'n_tokens_mistral': 1986, 'n_tokens_neox': 1854, 'n_words': 863}