Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Linters

on: pull_request

jobs:
rubocop:
name: Rubocop
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: ">=3.1.x"
- name: Setup Rubocop
run: |
gem install --no-document rubocop -v '>= 1.0, < 2.0' # https://docs.rubocop.org/en/stable/installation/
[ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ruby/.rubocop.yml
- name: Rubocop Report
run: rubocop --color
19 changes: 19 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Tests

on: pull_request

jobs:
rspec:
name: RSpec
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-ruby@v1
with:
ruby-version: 3.1.x
- name: Setup RSpec
run: |
[ -f Gemfile ] && bundle
gem install --no-document rspec -v '>=3.0, < 4.0'
- name: RSpec Report
run: rspec --force-color --format documentation
52 changes: 52 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
AllCops:
NewCops: enable
Exclude:
- "Guardfile"
- "Rakefile"
- "node_modules/**/*"

DisplayCopNames: true

Layout/LineLength:
Max: 120
Metrics/MethodLength:
Max: 20
Metrics/AbcSize:
Max: 50
Metrics/ClassLength:
Max: 150
Metrics/BlockLength:
AllowedMethods: ['describe']
Max: 30


Style/Documentation:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/EachForSimpleLoop:
Enabled: false
Style/AndOr:
Enabled: false
Style/DefWithParentheses:
Enabled: false
Style/FrozenStringLiteralComment:
EnforcedStyle: never

Layout/HashAlignment:
EnforcedColonStyle: key
Layout/ExtraSpacing:
AllowForAlignment: false
Layout/MultilineMethodCallIndentation:
Enabled: true
EnforcedStyle: indented
Lint/RaiseException:
Enabled: false
Lint/StructNewOverride:
Enabled: false
Style/HashEachMethods:
Enabled: false
Style/HashTransformKeys:
Enabled: false
Style/HashTransformValues:
Enabled: false
2 changes: 2 additions & 0 deletions GemFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source "https://rubygems.org"
gem 'rubocop', '>= 1.0', '< 2.0'
34 changes: 34 additions & 0 deletions GemFile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.3)
parallel (1.22.1)
parser (3.2.1.1)
ast (~> 2.4.1)
rainbow (3.1.1)
regexp_parser (2.7.0)
rexml (3.2.5)
rubocop (1.48.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.2.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.26.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.27.0)
parser (>= 3.2.1.0)
ruby-progressbar (1.13.0)
unicode-display_width (2.4.2)

PLATFORMS
x64-mingw-ucrt

DEPENDENCIES
rubocop (>= 1.0, < 2.0)

BUNDLED WITH
2.3.26
165 changes: 165 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
<!-- TABLE OF CONTENTS -->

# 📗 Table of Contents

- [📖 About the Project](#about-project)
- [🛠 Built With](#built-with)
- [Tech Stack](#tech-stack)
- [Key Features](#key-features)
- [🚀 Live Demo](#live-demo)
- [💻 Getting Started](#getting-started)
- [Prerequisites](#prerequisites)
- [Setup](#setup)
- [Install](#install)
- [Usage](#usage)
- [Run tests](#run-tests)
- [Deployment](#triangular_flag_on_post-deployment)
- [👥 Authors](#authors)
- [🔭 Future Features](#future-features)
- [🤝 Contributing](#contributing)
- [⭐️ Show your support](#support)
- [📝 License](#license)

<!-- PROJECT DESCRIPTION -->

# 📖 OOP School Library <a name="about-project"></a>

**OOP School Library** Aims to create a simple library management system for a school using Ruby programming language. The system should allow librarians to add books to the library, track books that are checked out by students, and manage student accounts.

## 🛠 Built With <a name="built-with"></a>

### Tech Stack <a name="tech-stack"></a>

<details>
<summary>Client</summary>
<ul>
<li><a href="https://www.ruby-lang.org/">Ruby</a></li>
<li><a href="https://ubuntu.com/">Terminal</a></li>
<li><a href="https://code.visualstudio.com/">Visual Studio</a></li>
</ul>
</details>

<!-- Features -->

### Key Features <a name="key-features"></a>

- **Decodes morse code into human readable format**

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- GETTING STARTED -->

## 💻 Getting Started <a name="getting-started"></a>

To get a local copy up and running, follow these steps.

### Prerequisites

In order to run this project you need:

## **Prerequisites:**
- Basic Knowledge of [Ruby](https://www.educative.io/blog/intro-to-ruby-tutorial) Programming Language
- Basic Knowledge of [Git](https://www.freecodecamp.org/news/git-and-github-for-beginners/) Command

- Watch [video](https://www.youtube.com/watch?v=RGOj5yH7evk) to get started in Git


<!--
Example command:

```sh
gem install rails
```
-->

## **INSTALLATION**

To install the application, follow these steps:

- Install Ruby 2.7 or later on your system. You can download it from the official Ruby website: https://www.ruby-lang.org/en/downloads/

- Clone this repository using Git:
```bash
git clone https://github.com/Ridwanullahi-code/OOP-School-Library.git
```
<center>OR</center>

```bash
git clone git@github.com:Ridwanullahi-code/OOP-School-Library.git
```
- Navigate to the project directory:
```bash
cd OOP-School-Library
```
- Install the required gems:
```bash
bundle install
```
## **USAGE**
To run the application, follow these steps:
- Navigate to the project directory:
```bash
cd OOP-School-Library
```
- Run the application:
```bash
ruby main.rb
```
- Follow the on-screen prompts to use the application.

<!-- AUTHORS -->

## 👥 Authors <a name="authors"></a>

👤 **Ajayi Ridwan**

- GitHub: [@Ridwanullahi-code](https://github.com/Ridwanullahi-code)
- Twitter: [@Ridwanullahi22](https://twitter.com/twitterhandle)
- LinkedIn: [LinkedIn](https://www.linkedin.com/in/ajayi-ridwan/)

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- CONTRIBUTING -->

## 🤝 Contributing <a name="contributing"></a>
If you would like to contribute to this project, please fork the repository, make your changes, and submit a pull request. Please make sure to follow the coding style and write tests for your changes.
Feel free to check the [issues page](https://github.com/Ridwanullahi-code/OOP-School-Library/issues/)

## 🚀 **About Me**

I'm full stack software developer, Computer science, and Microverse student.

**Stack:** Python, JavaScript, Bootstrap, Ruby, Rails, React, Redux. Available for hire!

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- SUPPORT -->

## ⭐️ Show your support <a name="support"></a>

If you like this project...

Feel free to give it a start

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- ACKNOWLEDGEMENTS -->

## 🙏 Acknowledgments <a name="acknowledgements"></a>

> Give credit to everyone who inspired your codebase.
> Thanks Microverse for providing us with the right material to aid this project development

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<p align="right">(<a href="#readme-top">back to top</a>)</p>

<!-- LICENSE -->

## 📝 License <a name="license"></a>

This project is [MIT](./LICENSE) licensed.

_NOTE: we recommend using the [MIT license](https://choosealicense.com/licenses/mit/) - you can set it up quickly by [using templates available on GitHub](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-license-to-a-repository). You can also use [any other license](https://choosealicense.com/licenses/) if you wish._

<p align="right">(<a href="#readme-top">back to top</a>)</p>
39 changes: 39 additions & 0 deletions person.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# person class store person information and properties
class Person
attr_accessor :name, :age
attr_reader :id

def initialize(age, name = 'Unknown', parent_permission: true)
@id = generate_id
@age = age
@name = name
@parent_permission = parent_permission
end

def display_info
{ 'id' => @id, 'name' => @name, 'age' => @age }
end

def update_info(name, age)
@name = name
@age = age
end

def can_use_services
if of_age || @parent_permission
true
elsif !of_age || !@parent_permission
false
end
end

private

def of_age
@age.to_i >= 18
end

def generate_id
rand(1..100)
end
end
14 changes: 14 additions & 0 deletions student.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require_relative('./person')
# student class store student information and properties
class Student < Person
attr_accessor :classroom

def initialize(classroom)
@classroom = classroom
super(age, name, parent_permission: true)
end

def play_hook
'¯(ツ)/¯'
end
end
14 changes: 14 additions & 0 deletions teacher.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require_relative('./person')
# class to store teacher information and methods
class Teacher < Person
attr_accessor :specialization

def initialize(age, name, specialization, parent_permission: false)
@specialization = specialization
super(age, name, parent_permission: parent_permission)
end

def can_use_services
(of_age || !of_age) || (@parent_permission || !@parent_permission)
end
end