Skip to content

Commit

Permalink
Add makefile and update readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
rojasTob committed Jun 1, 2020
1 parent 8cf93d4 commit f439ebf
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Ruby

on:
push:
branches: [ master ]
branches: [ master, next ]
pull_request:
branches: [ master ]
branches: [ master, next ]

jobs:
build:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ build-iPhoneSimulator/

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

.tool-versions
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
install:
bundle install

database:
bundle exec rails db:migrate

serve:
bundle exec rails server
109 changes: 77 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,108 @@
<img src="https://static0.twilio.com/marketing/bundles/marketing/img/logos/wordmark-red.svg" alt="Twilio" width="250" />
</a>

This application example demonstrates how to do simple phone verification with Ruby on Rails Framework, and Twilio Verify.
# Twilio Verify Quickstart with Twilio and Rails

![](https://github.com/TwilioDevEd/verify-v2-quickstart-rails/workflows/Ruby/badge.svg)

> We are currently in the process of updating this sample template. If you are encountering any issues with the sample, please open an issue at [github.com/twilio-labs/code-exchange/issues](https://github.com/twilio-labs/code-exchange/issues) and we'll try to help you.
## Local Development
## About

This application example demonstrates how to do simple phone verification with Ruby on Rails Framework, and Twilio Verify.

Learn more about Account Security and when to use the Authy API vs the Verify API in the [Account Security documentation](https://www.twilio.com/docs/verify/authy-vs-verify).

Implementations in other languages:

| .NET | Java | Python | PHP | Node |
| :--- | :--- | :----- | :-- | :--- |
| [Done](https://github.com/TwilioDevEd/verify-v2-quickstart-csharp) | [Done](https://github.com/TwilioDevEd/verify-v2-quickstart-java) | [Done](https://github.com/TwilioDevEd/verify-v2-quickstart-python) | [Done](https://github.com/TwilioDevEd/verify-v2-quickstart-php) | [Done](https://github.com/TwilioDevEd/verify-v2-quickstart-node) |

## Set up

### Requirements

- [Ruby](https://www.ruby-lang.org/) **2.6.x** version.
- [Sqlite3](https://www.sqlite.org/)

### Twilio Account Settings

This application should give you a ready-made starting point for writing your own application.
Before we begin, we need to collect all the config values we need to run the application:

| Config Value | Description |
| :---------- | :---------- |
| TWILIO_ACCOUNT_SID / TWILIO_AUTH_TOKEN | For Twilio API credentials find [here](https://www.twilio.com/console)|
| TWILIO_VERIFICATION_SID | For Verification Service SID [here](https://www.twilio.com/console/verify/services) |

### Local Development

1. Clone the project and cd into it.
```bash
git clone ...
git clone https://github.com/TwilioDevEd/verify-v2-quickstart-rails.git
cd verify-v2-quickstart-rails/
```

1. Copy `.env.example` to `.env` to setup you environment.
1. Install gem dependencies.
```bash
cp .env.example .env
make install
```

1. Edit `.env` to add your Twilio access keys. For Twilio API credentials find [here](https://www.twilio.com/console) and for Verification Service SID [here](https://www.twilio.com/console/verify/services).
```
TWILIO_ACCOUNT_SID=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
TWILIO_AUTH_TOKEN=7axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_VERIFICATION_SID=VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
```

1. Install gem dependencies
1. Copy `.env` file.
```bash
bundle install
cp .env.example .env
```

1. Run migrations to create the database.
```bash
rails db:migrate
```
See [Twilio Account Settings](#twilio-account-settings) to locate the necessary environment variables.

1. Create the database and run migrations.

```bash
make database
```

1. Run the application.
```bach
rails server
```bash
make serve
```

1. Check it out at [http://localhost:3000](http://localhost:3000)

1. Navigate to [http://localhost:3000](http://localhost:3000)

That's it!
## Run the tests
### Tests
1. Run minitests
You can run the tests locally by typing:
```bash
rails test
```
```bash
bundle exec rails test
```
### Cloud deployment
Additionally to trying out this application locally, you can deploy it to a variety of host services. Here is a small selection of them.
Please be aware that some of these might charge you for the usage or might make the source code for this application visible to the public. When in doubt research the respective hosting service first.
| Service | |
| :-------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Heroku](https://www.heroku.com/) | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy) |
## Resources
- The CodeExchange repository can be found [here](https://github.com/twilio-labs/code-exchange/).
## Contributing
This template is open source and welcomes contributions. All contributions are subject to our [Code of Conduct](https://github.com/twilio-labs/.github/blob/master/CODE_OF_CONDUCT.md).
## License
[MIT](http://www.opensource.org/licenses/mit-license.html)
## Disclaimer
## Meta
No warranty expressed or implied. Software is as is.
* No warranty expressed or implied. Software is as is. Diggity.
* The CodeExchange repository can be found [here](https://github.com/twilio-labs/code-exchange/).
* [MIT License](http://www.opensource.org/licenses/mit-license.html)
* Lovingly crafted by Twilio Developer Education.
[twilio]: https://www.twilio.com

0 comments on commit f439ebf

Please sign in to comment.