-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from IvonneBenitesRodriguez/feature-initial-co…
…nfig-addClassesFolder feature-initial-config-addClassesFolder
- Loading branch information
Showing
7 changed files
with
110 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v3 | ||
- 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'json', '~> 2.6' | ||
gem 'rspec' | ||
gem 'rubocop', '>= 1.0', '< 2.0' | ||
|
||
gem 'rspec' | ||
source 'https://rubygems.org' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,6 +46,7 @@ PLATFORMS | |
x86_64-darwin-23 | ||
|
||
DEPENDENCIES | ||
json (~> 2.6) | ||
rspec | ||
rubocop (>= 1.0, < 2.0) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
class Item | ||
attr_reader :id, :publish_date | ||
|
||
def initialize(_publish_date, archived: true) | ||
@id = Random.rand(1..1000) | ||
@publish_date = date | ||
@archived = archived | ||
end | ||
|
||
def genre=(genre) | ||
@genre = genre | ||
genre.add_item(self) unless genre.items.include?(self) | ||
end | ||
|
||
def author=(author) | ||
@author = author | ||
author.add_item(self) unless author.items.include?(self) | ||
end | ||
|
||
def source=(source) | ||
@source = source | ||
source.add_item(self) unless source.items.include?(self) | ||
end | ||
|
||
def label=(label) | ||
@label = label | ||
label.add_item(self) unless label.items.include?(self) | ||
end | ||
|
||
def move_to_archive | ||
return unless can_be_archived? | ||
|
||
@archived = true | ||
end | ||
|
||
private | ||
|
||
def can_be_archived? | ||
publish_date < 10.years.ago | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
def main | ||
puts 'Welcome to the Catalog of my things App!' | ||
puts '----------------------------------------' | ||
loop do | ||
puts 'Please select an option by entering a number:' | ||
puts '1. List all books' | ||
puts '2. List all music albums' | ||
puts '3. List of games' | ||
puts '4. List all labels' | ||
puts '5. List all genres' | ||
puts '6. List all authors' | ||
puts '7. Add a book' | ||
puts '8. Add a music album' | ||
puts '9. Add a game' | ||
puts '10. Exit' | ||
options = gets.chomp.to_i | ||
case options | ||
when 1 | ||
puts 'List of all books' | ||
when 2 | ||
puts 'List of all music albums' | ||
when 3 | ||
puts 'List of all games' | ||
when 4 | ||
puts 'List of all labels' | ||
when 5 | ||
puts 'List of all genres' | ||
when 6 | ||
puts 'List of all authors' | ||
when 7 | ||
puts 'Add a book' | ||
when 8 | ||
puts 'Add a music album' | ||
when 9 | ||
puts 'Add a game' | ||
when 10 | ||
puts 'Goodbye!' | ||
break | ||
else | ||
puts 'Invalid option. Please try again.' | ||
end | ||
end | ||
end | ||
|
||
main |
This file was deleted.
Oops, something went wrong.