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
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ gem "sinatra-activerecord", "~> 2.0"
gem "rake", "~> 13.0"
gem "sqlite3", "~> 1.4"
gem "require_all", "~> 3.0"
gem 'tty-prompt', "~> 0.22.0"
62 changes: 39 additions & 23 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,46 +1,61 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (6.0.1)
activesupport (= 6.0.1)
activerecord (6.0.1)
activemodel (= 6.0.1)
activesupport (= 6.0.1)
activesupport (6.0.1)
activemodel (6.0.3.3)
activesupport (= 6.0.3.3)
activerecord (6.0.3.3)
activemodel (= 6.0.3.3)
activesupport (= 6.0.3.3)
activesupport (6.0.3.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2)
coderay (1.1.2)
concurrent-ruby (1.1.5)
i18n (1.7.0)
zeitwerk (~> 2.2, >= 2.2.2)
coderay (1.1.3)
concurrent-ruby (1.1.7)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
method_source (0.9.2)
minitest (5.13.0)
mustermann (1.0.3)
minitest (5.14.2)
mustermann (1.1.1)
ruby2_keywords (~> 0.0.1)
pastel (0.8.0)
tty-color (~> 0.5)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
rack (2.0.7)
rack-protection (2.0.7)
rack (2.2.3)
rack-protection (2.1.0)
rack
rake (13.0.1)
require_all (3.0.0)
sinatra (2.0.7)
ruby2_keywords (0.0.2)
sinatra (2.1.0)
mustermann (~> 1.0)
rack (~> 2.0)
rack-protection (= 2.0.7)
rack (~> 2.2)
rack-protection (= 2.1.0)
tilt (~> 2.0)
sinatra-activerecord (2.0.14)
activerecord (>= 3.2)
sinatra-activerecord (2.0.18)
activerecord (>= 4.1)
sinatra (>= 1.0)
sqlite3 (1.4.1)
sqlite3 (1.4.2)
thread_safe (0.3.6)
tilt (2.0.10)
tzinfo (1.2.5)
tty-color (0.5.2)
tty-cursor (0.7.1)
tty-prompt (0.22.0)
pastel (~> 0.8)
tty-reader (~> 0.8)
tty-reader (0.8.0)
tty-cursor (~> 0.7)
tty-screen (~> 0.8)
wisper (~> 2.0)
tty-screen (0.8.1)
tzinfo (1.2.7)
thread_safe (~> 0.1)
zeitwerk (2.2.2)
wisper (2.0.1)
zeitwerk (2.4.0)

PLATFORMS
ruby
Expand All @@ -52,6 +67,7 @@ DEPENDENCIES
require_all (~> 3.0)
sinatra-activerecord (~> 2.0)
sqlite3 (~> 1.4)
tty-prompt (~> 0.22.0)

BUNDLED WITH
2.0.2
2.1.4
2 changes: 1 addition & 1 deletion config/database.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
development:
adapter: sqlite3
database: db/cats.sqlite3
database: db/music.sqlite3
3 changes: 3 additions & 0 deletions config/environment.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
require 'bundler/setup'
Bundler.require


require 'tty-prompt'

require_all 'lib'
9 changes: 9 additions & 0 deletions db/migrate/20201001134020_create_user_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateUserTable < ActiveRecord::Migration[6.0]
def change
create_table :users do |table|
table.string :name
table.integer :age
table.string :mood
end
end
end
9 changes: 9 additions & 0 deletions db/migrate/20201001134211_create_song_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class CreateSongTable < ActiveRecord::Migration[6.0]
def change
create_table :songs do |table|
table.string :title
table.string :artist
table.string :lyrics
end
end
end
7 changes: 7 additions & 0 deletions db/migrate/20201001141928_create_keyword_table.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class CreateKeywordTable < ActiveRecord::Migration[6.0]
def change
create_table :keywords do |table|
table.string :mood
end
end
end
31 changes: 31 additions & 0 deletions db/schema.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema when running `rails
# db:schema:load`. When creating a new database, `rails db:schema:load` tends to
# be faster and is potentially less error prone than running all of your
# migrations from scratch. Old migrations may fail to apply correctly if those
# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 2020_10_01_141928) do

create_table "keywords", force: :cascade do |t|
t.string "mood"
end

create_table "songs", force: :cascade do |t|
t.string "title"
t.string "artist"
t.string "lyrics"
end

create_table "users", force: :cascade do |t|
t.string "name"
t.integer "age"
t.string "mood"
end

end
12 changes: 12 additions & 0 deletions db/seeds.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
User.destroy_all
user1 = User.create(name: "Eric Christine", age: 22, mood: "happy")
user2 = User.create(name: "Marcos Lipic", age: 24, mood: "happy")

Song.destroy_all
song1 = Song.create(title: "What's My Age Again?", artist: "Blink-182", lyrics: "carefree")
song2 = Song.create(title: "Electric Feel", artist: "MGMT", lyrics: "love")
song3 = Song.create(title: "Be Above It", artist: "Tame Impala", lyrics: "motivated")
song4 = Song.create(title: "Going Native", artist: "Summer Salt", lyrics: "happy")
song5 = Song.create(title: "Yer Blues", artist: "The Beatles", lyrics: "sad")

# Keyword.create(user: user1, song: song4, mood: "happy")
22 changes: 22 additions & 0 deletions lib/cli.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class Cli
def welcome
system 'clear'
puts "Hello"
end

def prompt
prompt = TTY::Prompt.new
prompt.select("Enter your mood", %w(Happy Sad Motivated Carefree Love))
end

def recommend_songs
if prompt

end






end
4 changes: 4 additions & 0 deletions lib/models/keyword.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Keyword < ActiveRecord::Base
belongs_to :user
belongs_to :song
end
4 changes: 4 additions & 0 deletions lib/models/song.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Song < ActiveRecord::Base
has_many :keywords
has_many :users, through: :keywords
end
4 changes: 4 additions & 0 deletions lib/models/user.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class User < ActiveRecord::Base
has_many :keywords
has_many :songs, through: :keywords
end
8 changes: 7 additions & 1 deletion runner.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
require_relative 'config/environment'

Cli.new.start_game
# Cli.new.start_game

# binding.pry

app = Cli.new

app.welcome
app.prompt

app.mood