From 8e484eaa4946829f7def08e406f01fe2e4ea77d1 Mon Sep 17 00:00:00 2001 From: Angela Rojas Date: Mon, 13 Apr 2020 10:27:10 -0500 Subject: [PATCH] Resolves #3 --- .env.example | 11 +- .github/workflows/ruby.yml | 32 ++++++ .mergify.yml | 13 +++ .travis.yml | 12 -- CODE_OF_CONDUCT.md | 73 ++++++++++++ CONTRIBUTING.md | 3 + Gemfile | 26 ++--- Gemfile.lock | 221 +++++++++++++++++++++++++++++++++++++ LICENSE | 2 +- README.md | 63 +++++------ 10 files changed, 390 insertions(+), 66 deletions(-) create mode 100644 .github/workflows/ruby.yml create mode 100644 .mergify.yml delete mode 100644 .travis.yml create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 Gemfile.lock diff --git a/.env.example b/.env.example index 005eff8..20e9106 100644 --- a/.env.example +++ b/.env.example @@ -1,8 +1,3 @@ -# Twilio API credentials -# (find here https://www.twilio.com/console) -export TWILIO_ACCOUNT_SID= -export TWILIO_AUTH_TOKEN= - -# Verification Service SID -# (create one here https://www.twilio.com/console/verify/services) -export VERIFICATION_SID= +TWILIO_ACCOUNT_SID=YOUR-TWILIO-ACCOUNT-SID +TWILIO_AUTH_TOKEN=YOUR-TWILIO-AUTH-TOKEN +VERIFICATION_SID=YOUR-VERIFICATION-SID diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..b83ed96 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,32 @@ +name: Ruby + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Setup System + run: | + sudo apt-get install libsqlite3-dev + - name: Set up Ruby 2.6 + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x + - name: Build and test with minitests + run: | + gem install bundler + bundle install --jobs 4 --retry 3 + - name: Test + run: bundle exec rails test + env: + TWILIO_ACCOUNT_SID: YOUR-TWILIO-ACCOUNT-SID + TWILIO_AUTH_TOKEN: YOUR-TWILIO-AUTH-TOKEN + VERIFICATION_SID: YOUR-VERIFICATION-SID diff --git a/.mergify.yml b/.mergify.yml new file mode 100644 index 0000000..0433495 --- /dev/null +++ b/.mergify.yml @@ -0,0 +1,13 @@ +pull_request_rules: + - name: automatic merge for Dependabot pull requests + conditions: + - author=dependabot-preview[bot] + - status-success=build (macos-latest, 10) + - status-success=build (macos-latest, 12) + - status-success=build (windows-latest, 10) + - status-success=build (windows-latest, 12) + - status-success=build (ubuntu-latest, 10) + - status-success=build (ubuntu-latest, 12) + actions: + merge: + method: squash diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9663b35..0000000 --- a/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: ruby -rvm: - - 2.3 - - 2.4 - - 2.5 - - 2.6 - -before_install: - - bundle install - -script: -- rails test diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..2f0727e --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,73 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at open-source@twilio.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ad3257e --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,3 @@ +# Contributing to Twilio + +All third party contributors acknowledge that any contributions they provide will be made under the same open source license that the open source project is provided under. diff --git a/Gemfile b/Gemfile index a31105b..adb86c2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,34 +1,32 @@ source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } -ruby '>= 2.3' - gem 'twilio-ruby', '~> 5.23.0' -gem 'dotenv-rails', '~> 2.7.2' +gem 'dotenv-rails', '~> 2.7.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '~> 5.2.3' +gem 'rails', '~> 6.0' # Use sqlite3 as the database for Active Record gem 'sqlite3' # Use Puma as the app server -gem 'puma', '~> 3.11' +gem 'puma', '~> 4.3' # Use SCSS for stylesheets -gem 'sass-rails', '~> 5.0' +gem 'sass-rails', '~> 6.0' # Use Uglifier as compressor for JavaScript assets -gem 'uglifier', '>= 1.3.0' +gem 'uglifier', '>= 4.2.0' # See https://github.com/rails/execjs#readme for more supported runtimes gem 'mini_racer' # Use CoffeeScript for .coffee assets and views -gem 'coffee-rails', '~> 4.2' +gem 'coffee-rails', '~> 5.0' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder -gem 'jbuilder', '~> 2.5' +gem 'jbuilder', '~> 2.10' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use ActiveModel has_secure_password -gem 'bcrypt', '~> 3.1.7' +gem 'bcrypt', '~> 3.1.13' # Use ActiveStorage variant # gem 'mini_magick', '~> 4.8' @@ -37,7 +35,7 @@ gem 'bcrypt', '~> 3.1.7' # gem 'capistrano-rails', group: :development # Reduces boot times through caching; required in config/boot.rb -gem 'bootsnap', '>= 1.1.0', require: false +gem 'bootsnap', '>= 1.4.6', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console @@ -46,11 +44,11 @@ end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. - gem 'web-console', '>= 3.3.0' - gem 'listen', '>= 3.0.5', '< 3.2' + gem 'web-console', '>= 4.0.1' + gem 'listen', '~> 3.2.1' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' - gem 'spring-watcher-listen', '~> 2.0.0' + gem 'spring-watcher-listen', '~> 2.0.1' end group :test do diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..356beca --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,221 @@ +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.2.2) + actionpack (= 6.0.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + mail (>= 2.7.1) + actionmailer (6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.2) + actionpack (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + nokogiri (>= 1.8.5) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.2) + activesupport (= 6.0.2.2) + globalid (>= 0.3.6) + activemodel (6.0.2.2) + activesupport (= 6.0.2.2) + activerecord (6.0.2.2) + activemodel (= 6.0.2.2) + activesupport (= 6.0.2.2) + activestorage (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + marcel (~> 0.3.1) + activesupport (6.0.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2) + bcrypt (3.1.13) + bindex (0.8.1) + bootsnap (1.4.6) + msgpack (~> 1.0) + builder (3.2.4) + byebug (11.1.1) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.6) + crass (1.0.6) + dotenv (2.7.5) + dotenv-rails (2.7.5) + dotenv (= 2.7.5) + railties (>= 3.2, < 6.1) + erubi (1.9.0) + execjs (2.7.0) + faraday (0.17.3) + multipart-post (>= 1.2, < 3) + ffi (1.12.2) + globalid (0.4.2) + activesupport (>= 4.2.0) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + jbuilder (2.10.0) + activesupport (>= 5.0.0) + jwt (2.2.1) + libv8 (7.3.492.27.1) + listen (3.2.1) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) + loofah (2.5.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mimemagic (0.3.4) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + mini_racer (0.2.9) + libv8 (>= 6.9.411) + minitest (5.14.0) + minitest-stub_any_instance (1.0.2) + msgpack (1.3.3) + multipart-post (2.1.1) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + puma (4.3.3) + nio4r (~> 2.0) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.2.2) + actioncable (= 6.0.2.2) + actionmailbox (= 6.0.2.2) + actionmailer (= 6.0.2.2) + actionpack (= 6.0.2.2) + actiontext (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + activemodel (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + bundler (>= 1.3.0) + railties (= 6.0.2.2) + sprockets-rails (>= 2.0.0) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rake (13.0.1) + rb-fsevent (0.10.3) + rb-inotify (0.10.1) + ffi (~> 1.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.2.1) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + spring (2.1.0) + spring-watcher-listen (2.0.1) + listen (>= 2.7, < 4.0) + spring (>= 1.2, < 3.0) + sprockets (4.0.0) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + thor (1.0.1) + thread_safe (0.3.6) + tilt (2.0.10) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + twilio-ruby (5.23.1) + faraday (~> 0.9) + jwt (>= 1.5, <= 2.5) + nokogiri (>= 1.6, < 2.0) + tzinfo (1.2.7) + thread_safe (~> 0.1) + uglifier (4.2.0) + execjs (>= 0.3.0, < 3) + web-console (4.0.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + websocket-driver (0.7.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) + zeitwerk (2.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + bcrypt (~> 3.1.13) + bootsnap (>= 1.4.6) + byebug + coffee-rails (~> 5.0) + dotenv-rails (~> 2.7.5) + jbuilder (~> 2.10) + listen (~> 3.2.1) + mini_racer + minitest-stub_any_instance + puma (~> 4.3) + rails (~> 6.0) + sass-rails (~> 6.0) + spring + spring-watcher-listen (~> 2.0.1) + sqlite3 + turbolinks (~> 5) + twilio-ruby (~> 5.23.0) + tzinfo-data + uglifier (>= 4.2.0) + web-console (>= 4.0.1) + +BUNDLED WITH + 1.17.3 diff --git a/LICENSE b/LICENSE index 80d2a42..915af98 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Twilio +Copyright (c) 2020 Twilio Labs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index c0e0efd..f7cca3b 100644 --- a/README.md +++ b/README.md @@ -4,46 +4,46 @@ This application example demonstrates how to do simple phone verification with Ruby on Rails Framework, and Twilio Verify. -[![Build Status](https://travis-ci.org/TwilioDevEd/verify-v2-quickstart-rails.svg?branch=master)](https://travis-ci.org/TwilioDevEd/verify-v2-quickstart-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 1. Clone the project and cd into it. -```bash -git clone ... -cd verify-v2-quickstart-rails/ -``` + ```bash + git clone ... + cd verify-v2-quickstart-rails/ + ``` -2. Copy `.env.example` to `.env` to setup you environment. -```bash -cp .env.example .env -``` +1. Copy `.env.example` to `.env` to setup you environment. + ```bash + cp .env.example .env + ``` -3. Edit `.env` to add your Twilio access keys. -``` -TWILIO_ACCOUNT_SID=ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -TWILIO_AUTH_TOKEN=7axxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -TWILIO_VERIFICATION_SID=VAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX -``` +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 + ``` -4. Install gem dependencies -```bash -bundle install -``` +1. Install gem dependencies + ```bash + bundle install + ``` -5. Run migrations to create the database. -```bash -rails db:migrate -``` +1. Run migrations to create the database. + ```bash + rails db:migrate + ``` -6. Run the application. -```bach -rails server -``` +1. Run the application. + ```bach + rails server + ``` -7. Check it out at [http://localhost:3000](http://localhost:3000) +1. Check it out at [http://localhost:3000](http://localhost:3000) That's it! @@ -52,12 +52,13 @@ That's it! 1. Run minitests -```bash -rails test -``` + ```bash + rails test + ``` ## Meta * 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.