Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/juzershakir/scheduled_tweets

A tweet scheduler
https://github.com/juzershakir/scheduled_tweets

bootstrap herokuapp rails ruby tweets twitter twitter-api

Last synced: about 1 month ago
JSON representation

A tweet scheduler

Awesome Lists containing this project

README

        

# Scheduled Tweets

_A tweet scheduler_



![](https://visitor-badge-reloaded.herokuapp.com/badge?page_id=juzershakir.scheduled_tweets&color=000000&lcolor=000000&style=for-the-badge&logo=Github)

wakatime

## ❗ Objectives

This web-app accomplishes the following:

- [x] Able to Sign Up, Sign In and send an email to reset the password.
- [x] Able to connect with Multiple Twitter Accounts
- [x] Able to list all twitter accounts that the user has linked.
- [x] Able to schedule a tweet.
- [x] Enable backgrounds Job with Sidekiq & Redis to publish the tweet to the Twitter.
- [x] Show all the tweets that were created.
- [x] Able to edit and delete the tweets that are not yet published.
- [x] Able to see the tweet on twitter if the tweet has been published.

---

## 💎 Required Gems

**This project was built on Ruby version _3.1.2_.**

Following gems were installed in these versions to execute the functionality:

| **Gem Names** | **Gem** | **Version** | **Use** |
| :--------------: | :--------------------------------: | :------------: | :-------------------------------------------------------: |
| Rails | _'rails'_ | \***\*\_\*\*** | _Use for executing and rendering web-app_ |
| Postgresql | _'pg'_ | \***\*\_\*\*** | _Use postgres as the database for Active Record_ |
| BCrypt | _'bcrypt'_ | **3.1.16** | _Secure hash algorithm for safely storing passwords_ |
| omniauth-twitter | _'omniauth-twitter'_ | **1.4.0** | _Twitter API_ |
| CSRF Protection | _'omniauth-rails_csrf_protection'_ | **1.0.1** | _Omniauth CSRF Protection_ |
| Twitter | _'twitter'_ | **7.0.0** | _Authenticating web-app & user for publishing tweets_ |
| Sidekiq | _'sidekiq'_ | **6.5.1** | _Background Job to connect with Twitter to publish tweet_ |

---

## ⚙️ Setting up a PostgreSQL user

If you don't have a user set on postgres, here's how to set new user:

```bash
sudo -u postgres createuser -s [username]
```

To set a password for this user, log in to the PostgreSQL command line client:

```bash
sudo -u postgres psql
```

Enter the following command to set the password:

```bash
\password your_password
```

Enter and confirm the password. Then exit the PostgreSQL client:

```bash
\q
```

---

## 📋 Execution

Run the following commands to execute locally:

The following will install required version of ruby (make sure [rvm is installed](https://rvm.io/rvm/install).)

```bash
rvm install 3.1.2
```

```bash
rvm use 3.1.2
```

```bash
git clone [email protected]:JuzerShakir/scheduled_tweets.git
```

```bash
cd scheduled_tweets
```

```bash
gem install rails -v 6.1.6.1
```

```bash
bundle install
```

#### 💡 Imp Note:

To successfully create development and test database, you will need to update `config.database.yml` file with correct postgresql username and password.
To edit the it without exposing your credentials, give the following command:

```bash
EDITOR="code --wait" rails credentials:edit
```

_`code` for Visual Studio Code_
_`subl` for sublime_

This will open `credential.yml` file and enter credential as follows in it:

```
database:
username: your_username
password: your_password
```

Hit `ctrl + s` to save and then close the `credential.yml` file from the editor. This will save the credentials. To check if it did save, run the following inside rails console:

```
Rails.application.credentials.dig(:database, :username)
```

```bash
rails db:create
```

```bash
rails s
```

To see this web-app up and running without executing above commands locally,
I have deployed it on [Heroku](https://__name__.herokuapp.com/).

---