<commit_before># Amber::CMD

[![Build Status](https://travis-ci.org/Amber-Crystal/amber_cmd.svg?branch=master)](https://travis-ci.org/Amber-Crystal/amber_cmd)

This section provides an introduction into Amber command-line interface. 

Amber provides a CLI client that makes interfacing with your file system and applications much smoother. The Amber console provides a framework for creating shell scripts. The Console uses a dispatcher-type setup to load a shell or task, and provide its parameters.


## Installation

You can build the `amber` tool from source:

```shellsession
$ git clone <EMAIL>:amber-crystal/amber_cmd.git
$ cd amber_cmd/
$ shards install
$ make
```

You should now be able to run `amber` in the command line.


Optionally, you can use homebrew to install.

```shellsession
#make this work
```

## Commands

```shell
$ amber --help
amber [OPTIONS] SUBCOMMAND

Amber::CMD

The `amber new` command creates a new Rails application with a default
directory structure and configuration at the path you specify.

You can specify extra command-line arguments to be used every time
`amber new` runs in the .amber.yml configuration file in your project 
root directory

Note that the arguments specified in the .amber.yml file does not affect the
defaults values shown above in this help message.

Usage:
amber new [app_name] -d [pg | mysql | sqlite] -t [slang | ecr] --deps 

Commands:
  amber c console                 # Starts a amber console   
  amber g generate [SUBCOMMAND]   # Generate hanami classes
  amber n new                     # Generate a new amber project
  amber m migrate [SUBCOMMAND]    # Performs database migrations tasks
  amber w watch                   # Starts amber server and rebuilds on file changes
  amber r routes                  # Prints the routes (In Development)
  amber b build [OPTION]          # Compiles and builds your project. Options: [release] (In Development)
  
Options:
  -t, --template [name]           # Preconfigure for selected template engine. Options: slang | ecr 
  -d, --database [name]           # Preconfigure for selected database. Options: pg | mysql | sqlite
  -h, --help                      # Describe available commands and usages
  -v, --version                   # Prints Amber version
  --deps                          # Installs project dependencies
  
Example:
  amber new ~/Code/Projects/weblog
  This generates a skeletal Amber installation in ~/Code/Projects/weblog.
```

## Usage

```sh
amber new [your_app] -d [pg | mysql | sqlite] -t [slang | ecr] --deps 
cd [your_app]
```
options: `-d` defaults to pg. `-t` defaults to slang. `--deps` will run `crystal deps` for you.

This will generate a traditional web application:
 - **/config** - Application and HTTP::Handler config's goes here.  The database.yml and routes.cr are here.
 - **/lib** - shards are installed here.
 - **/public** - Default location for html/css/js files.  The static handler points to this directory.
 - **/spec** - all the crystal specs go here.
 - **/src** - all the source code goes here.

## Scaffolding
Generate scaffolding for a resource:
```sh
amber generate scaffold Post name:string body:text draft:bool
```

This will generate scaffolding for a Post:
 - src/controllers/post_controller.cr
 - src/models/post.cr
 - src/views/post/*
 - db/migrations/[datetimestamp]_create_post.sql
 - spec/controllers/post_controller_spec.cr
 - spec/models/post_spec.cr
 - appends route to config/routes.cr
 - appends navigation to src/layouts/_nav.slang

## Running App Locally
To test the generated App locally:

1. Create a new Postgres or Mysql database called `[your_app]_development`
2. Configure your database in one of the following ways.
  * Add it in `config/database.yml`
  * Run `export DATABASE_URL=postgres://[username]:[password]@localhost:5432/[your_app]_development` 
    which overrides the `config/database.yml`.
3. Migrate the database: `amber migrate up`. You should see output like 
    `Migrating db, current version: 0, target: [datetimestamp]OK   [datetimestamp]_create_shop.sql`
4. Run the specs: `crystal spec`
5. Start your app: `amber watch`
6. Then visit `http://0.0.0.0:3000/`

Note: The `amber watch` command uses [Sentry](https://github.com/samueleaton/sentry) to watch for any changes in your source files, recompiling automatically.

If you don't want to use Sentry, you can compile and run manually:

1. Build the app `crystal build --release src/[your_app].cr`
2. Run with `./[your_app]`
3. Visit `http://0.0.0.0:3000/`


## Development

See opened issues.

## Contributing

1. Fork it ( https://github.com/amber-crystal/amber_cmd/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request

## Contributors
- [elorest](https://github.com/elorest) <NAME> - Creator, Maintainer
- [eliasjpr](https://github.com/eliasjpr) <NAME> - Maintainer
- [fridgerator](https://github.com/fridgerator) <NAME> - Maintainer
- [phoffer](https://github.com/phoffer) <NAME> - Maintainer
- [bew](https://github.com/fridgerator) <NAME> - Member
- [TechMagister](https://github.com/TechMagister) <NAME> - Initial Creator of some borrowed code.
- [drujensen](https://github.com/drujensen) <NAME> - contributor
<commit_msg>Correct text<commit_after># Amber::CMD

[![Build Status](https://travis-ci.org/Amber-Crystal/amber_cmd.svg?branch=master)](https://travis-ci.org/Amber-Crystal/amber_cmd)

This section provides an introduction into Amber command-line interface. 

Amber provides a CLI client that makes interfacing with your file system and applications much smoother. The Amber console provides a framework for creating, generating, saffolding and running your Amber project.


## Installation

You can build the `amber` tool from source:

```shellsession
$ git clone <EMAIL>:amber-crystal/amber_cmd.git
$ cd amber_cmd/
$ shards install
$ make
```

You should now be able to run `amber` in the command line.


Optionally, you can use homebrew to install.

```shellsession
#make this work
```

## Commands

```shell
$ amber --help
amber [OPTIONS] SUBCOMMAND

Amber::CMD

The `amber new` command creates a new Amber application with a default
directory structure and configuration at the path you specify.

You can specify extra command-line arguments to be used every time
`amber new` runs in the .amber.yml configuration file in your project 
root directory

Note that the arguments specified in the .amber.yml file does not affect the
defaults values shown above in this help message.

Usage:
amber new [app_name] -d [pg | mysql | sqlite] -t [slang | ecr] --deps 

Commands:
  amber c console                 # Starts a amber console   
  amber g generate [SUBCOMMAND]   # Generate hanami classes
  amber n new                     # Generate a new amber project
  amber m migrate [SUBCOMMAND]    # Performs database migrations tasks
  amber w watch                   # Starts amber server and rebuilds on file changes
  amber r routes                  # Prints the routes (In Development)
  amber b build [OPTION]          # Compiles and builds your project. Options: [release] (In Development)
  
Options:
  -t, --template [name]           # Preconfigure for selected template engine. Options: slang | ecr 
  -d, --database [name]           # Preconfigure for selected database. Options: pg | mysql | sqlite
  -h, --help                      # Describe available commands and usages
  -v, --version                   # Prints Amber version
  --deps                          # Installs project dependencies
  
Example:
  amber new ~/Code/Projects/weblog
  This generates a skeletal Amber installation in ~/Code/Projects/weblog.
```

## Usage

```sh
amber new [your_app] -d [pg | mysql | sqlite] -t [slang | ecr] --deps 
cd [your_app]
```
options: `-d` defaults to pg. `-t` defaults to slang. `--deps` will run `crystal deps` for you.

This will generate a traditional web application:
 - **/config** - Application and HTTP::Handler config's goes here.  The database.yml and routes.cr are here.
 - **/lib** - shards are installed here.
 - **/public** - Default location for html/css/js files.  The static handler points to this directory.
 - **/spec** - all the crystal specs go here.
 - **/src** - all the source code goes here.

## Scaffolding
Generate scaffolding for a resource:
```sh
amber generate scaffold Post name:string body:text draft:bool
```

This will generate scaffolding for a Post:
 - src/controllers/post_controller.cr
 - src/models/post.cr
 - src/views/post/*
 - db/migrations/[datetimestamp]_create_post.sql
 - spec/controllers/post_controller_spec.cr
 - spec/models/post_spec.cr
 - appends route to config/routes.cr
 - appends navigation to src/layouts/_nav.slang

## Running App Locally
To test the generated App locally:

1. Create a new Postgres or Mysql database called `[your_app]_development`
2. Configure your database in one of the following ways.
  * Add it in `config/database.yml`
  * Run `export DATABASE_URL=postgres://[username]:[password]@localhost:5432/[your_app]_development` 
    which overrides the `config/database.yml`.
3. Migrate the database: `amber migrate up`. You should see output like 
    `Migrating db, current version: 0, target: [datetimestamp]OK   [datetimestamp]_create_shop.sql`
4. Run the specs: `crystal spec`
5. Start your app: `amber watch`
6. Then visit `http://0.0.0.0:3000/`

Note: The `amber watch` command uses [Sentry](https://github.com/samueleaton/sentry) to watch for any changes in your source files, recompiling automatically.

If you don't want to use Sentry, you can compile and run manually:

1. Build the app `crystal build --release src/[your_app].cr`
2. Run with `./[your_app]`
3. Visit `http://0.0.0.0:3000/`


## Development

See opened issues.

## Contributing

1. Fork it ( https://github.com/amber-crystal/amber_cmd/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request

## Contributors
- [elorest](https://github.com/elorest) <NAME> - Creator, Maintainer
- [eliasjpr](https://github.com/eliasjpr) <NAME> - Maintainer
- [fridgerator](https://github.com/fridgerator) <NAME> - Maintainer
- [phoffer](https://github.com/phoffer) <NAME> - Maintainer
- [bew](https://github.com/fridgerator) <NAME> - Member
- [TechMagister](https://github.com/TechMagister) <NAME> - Initial Creator of some borrowed code.
- [drujensen](https://github.com/drujensen) <NAME> - contributor

{'fraction_non_alphanumeric': 0.10600075244544771, 'fraction_numerical': 0.006583897667419112, 'mean_word_length': 3.4620226605119595, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 22, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5227419', 'n_tokens_mistral': 3324, 'n_tokens_neox': 3161, 'n_words': 1204}