-
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 #8 from 9AMPYLO/database
Database
- Loading branch information
Showing
37 changed files
with
1,241 additions
and
177 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
config/secrets.yml | ||
coverage/* | ||
!coverage/.resultset.json | ||
!coverage/.resultset.json | ||
*.db |
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,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'hirb-unicode' | ||
|
||
Hirb.enable | ||
|
||
old_print = Pry.config.print | ||
Pry.config.print = proc do |*args| | ||
Hirb::View.view_or_page_output(args[1]) || old_print.call(*args) | ||
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
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
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
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module PapMon | ||
module Database | ||
# Paper ORM | ||
class DatasetOrm < Sequel::Model(:datasets) | ||
many_to_many :papers, | ||
class: :'PapMon::Database::PaperOrm', | ||
join_table: :papers_datasets, | ||
left_key: :dataset_id, right_key: :paper_id | ||
plugin :timestamps, update_on_create: true | ||
def self.find_or_create(dataset_info) | ||
first(id: dataset_info[:id]) || create(dataset_info) | ||
end | ||
end | ||
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,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module PapMon | ||
module Database | ||
# Paper ORM | ||
class PaperOrm < Sequel::Model(:papers) | ||
one_to_many :repositories, | ||
class: :'PapMon::Database::RepositoryOrm', | ||
key: :paper_id | ||
many_to_many :datasets, | ||
class: :'PapMon::Database::DatasetOrm', | ||
join_table: :papers_datasets, | ||
left_key: :paper_id, right_key: :dataset_id | ||
plugin :timestamps, update_on_create: true | ||
end | ||
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,16 @@ | ||
# frozen_string_literal: true | ||
|
||
module PapMon | ||
module Database | ||
# Paper ORM | ||
class RepositoryOrm < Sequel::Model(:repositories) | ||
many_to_one :paper, | ||
class: :'PapMon::Database::PaperOrm' | ||
|
||
plugin :timestamps, update_on_create: true | ||
def self.find_or_create(repo_info) | ||
first(id: repo_info[:id]) || create(repo_info) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.