calibre-ruby 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: afd2661d0ccf57af8af51f30dda2138d4882ed3b
4
- data.tar.gz: 3023c261eb8a7fbc6947c3505d2ea52872b3b05f
2
+ SHA256:
3
+ metadata.gz: 9fea1c1cccdbae4cfa35438ca53457d106af62a1887260a0d113a64f5496289d
4
+ data.tar.gz: 715c88ce10bc94d73eda88e94d8edf8cfb31b222245d7b84a86ce3b5e2be5916
5
5
  SHA512:
6
- metadata.gz: cee0c325707725cc987ba09f5cee7288819c0ce73b370138ce0ac2f674ba80621e6edec5bc0dcc0276a008773f3858e49fa84634f2148afbe9bc964c4c891f90
7
- data.tar.gz: dfe5421dcbff8ebeb995e0cd33c5242cdac392a06d76b8d04c5e10dcab8d5fd9232bd4090e675fffe51c7f22e14238efd148da271d7eb5ef9f51462f4c0cacc4
6
+ metadata.gz: b538cbfcc4cf63572edad9b22da68d80f6e27db3e533cde259719aa5b9346ad074ee852ca7373d9c320ad9e704498d15739c6506cb95471590492031910e04fd
7
+ data.tar.gz: 00bd3c65d3ea6b1bbf3a8272cff2aef222553f6efa9a881ad75c6aa85949bba5d6accdf347b72c715abb37a92e7b473fab59848e0f98e6b01518ae7aad25edef
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
1
+ source 'https://gems.sutty.nl'
2
2
 
3
3
  gemspec
4
4
 
data/calibre-ruby.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ['lib']
20
20
 
21
- gem.add_dependency('activerecord', '~> 5.2.0')
22
- gem.add_dependency('sqlite3', '~> 1.3.0')
21
+ gem.add_dependency('activerecord', '~> 7.1.0')
22
+ gem.add_dependency('sqlite3')
23
+ gem.add_development_dependency('rubocop', '~> 1.66.0')
23
24
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
4
  class AbstractAuthor < ActiveRecord::Base
3
5
  self.table_name = 'authors'
4
6
 
5
7
  has_and_belongs_to_many :books,
6
- join_table: 'books_authors_link',
7
- association_foreign_key: 'book',
8
- foreign_key: 'author'
8
+ join_table: 'books_authors_link',
9
+ association_foreign_key: 'book',
10
+ foreign_key: 'author'
9
11
  end
10
12
 
11
13
  class Author < AbstractAuthor; end
data/lib/calibre/book.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
4
  # We do this to prevent AR to fail miserably because the foreign key
3
5
  # name is the same as the class
@@ -9,22 +11,22 @@ module Calibre
9
11
 
10
12
  %w[author publisher rating tag].each do |association|
11
13
  has_and_belongs_to_many "#{association}s".to_sym,
12
- join_table: "books_#{association}s_link",
13
- association_foreign_key: association,
14
- foreign_key: 'book'
14
+ join_table: "books_#{association}s_link",
15
+ association_foreign_key: association,
16
+ foreign_key: 'book'
15
17
  end
16
18
 
17
19
  # This association is pluralized
18
20
  has_and_belongs_to_many :series,
19
- join_table: "books_series_link",
20
- association_foreign_key: 'series',
21
- foreign_key: 'book'
21
+ join_table: 'books_series_link',
22
+ association_foreign_key: 'series',
23
+ foreign_key: 'book'
22
24
 
23
25
  # And this one is weirdly name
24
26
  has_and_belongs_to_many :languages,
25
- join_table: "books_languages_link",
26
- association_foreign_key: 'lang_code',
27
- foreign_key: 'book'
27
+ join_table: 'books_languages_link',
28
+ association_foreign_key: 'lang_code',
29
+ foreign_key: 'book'
28
30
 
29
31
  def cover
30
32
  File.join(path, 'cover.jpg')
@@ -36,5 +38,5 @@ module Calibre
36
38
  end
37
39
 
38
40
  # You can use this :)
39
- class Book < AbstractBook ; end
41
+ class Book < AbstractBook; end
40
42
  end
@@ -1,8 +1,12 @@
1
- class Calibre::Comment < ActiveRecord::Base
2
- belongs_to :reference, foreign_key: 'book', class_name: 'Calibre::Book'
3
- self.table_name = 'comments'
1
+ # frozen_string_literal: true
4
2
 
5
- # We alias reference, because the relationship can't clash with the
6
- # foreign key
7
- alias :book :reference
3
+ module Calibre
4
+ class Comment < ActiveRecord::Base
5
+ belongs_to :reference, foreign_key: 'book', class_name: 'Calibre::Book'
6
+ self.table_name = 'comments'
7
+
8
+ # We alias reference, because the relationship can't clash with the
9
+ # foreign key
10
+ alias book reference
11
+ end
8
12
  end
data/lib/calibre/data.rb CHANGED
@@ -1,12 +1,16 @@
1
- class Calibre::Data < ActiveRecord::Base
2
- belongs_to :reference, foreign_key: 'book', class_name: 'Calibre::Book'
3
- self.table_name = 'data'
1
+ # frozen_string_literal: true
4
2
 
5
- # We alias reference, because the relationship can't clash with the
6
- # foreign key
7
- alias :book :reference
3
+ module Calibre
4
+ class Data < ActiveRecord::Base
5
+ belongs_to :reference, foreign_key: 'book', class_name: 'Calibre::Book'
6
+ self.table_name = 'data'
8
7
 
9
- def path
10
- File.join(reference.path, [name,format.downcase].join('.'))
8
+ # We alias reference, because the relationship can't clash with the
9
+ # foreign key
10
+ alias book reference
11
+
12
+ def path
13
+ File.join(reference.path, [name, format.downcase].join('.'))
14
+ end
11
15
  end
12
16
  end
@@ -1,9 +1,13 @@
1
- class Calibre::Identifier < ActiveRecord::Base
2
- belongs_to :reference, foreign_key: 'book', class_name: 'Calibre::Book'
3
- self.table_name = 'identifiers'
4
- self.inheritance_column = 'noop'
1
+ # frozen_string_literal: true
5
2
 
6
- # We alias reference, because the relationship can't clash with the
7
- # foreign key
8
- alias :book :reference
3
+ module Calibre
4
+ class Identifier < ActiveRecord::Base
5
+ belongs_to :reference, foreign_key: 'book', class_name: 'Calibre::Book'
6
+ self.table_name = 'identifiers'
7
+ self.inheritance_column = 'noop'
8
+
9
+ # We alias reference, because the relationship can't clash with the
10
+ # foreign key
11
+ alias book reference
12
+ end
9
13
  end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
4
  class AbstractLanguage < ActiveRecord::Base
3
5
  self.table_name = 'languages'
4
6
 
5
7
  has_and_belongs_to_many :books,
6
- join_table: 'books_languages_link',
7
- association_foreign_key: 'book',
8
- foreign_key: 'lang_code'
8
+ join_table: 'books_languages_link',
9
+ association_foreign_key: 'book',
10
+ foreign_key: 'lang_code'
9
11
  end
10
12
 
11
13
  class Language < AbstractLanguage; end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
4
  class AbstractPublisher < ActiveRecord::Base
3
5
  self.table_name = 'publishers'
4
6
 
5
7
  has_and_belongs_to_many :books,
6
- join_table: 'books_publishers_link',
7
- association_foreign_key: 'book',
8
- foreign_key: 'publisher'
8
+ join_table: 'books_publishers_link',
9
+ association_foreign_key: 'book',
10
+ foreign_key: 'publisher'
9
11
  end
10
12
 
11
13
  class Publisher < AbstractPublisher; end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
4
  class AbstractRating < ActiveRecord::Base
3
5
  self.table_name = 'ratings'
4
6
 
5
7
  has_and_belongs_to_many :books,
6
- join_table: 'books_ratings_link',
7
- association_foreign_key: 'book',
8
- foreign_key: 'rating'
8
+ join_table: 'books_ratings_link',
9
+ association_foreign_key: 'book',
10
+ foreign_key: 'rating'
9
11
  end
10
12
 
11
13
  class Rating < AbstractRating; end
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
4
  class AbstractSeries < ActiveRecord::Base
3
5
  self.table_name = 'series'
4
6
 
5
7
  has_and_belongs_to_many :books,
6
- join_table: 'books_series_link',
7
- association_foreign_key: 'book',
8
- foreign_key: 'series'
8
+ join_table: 'books_series_link',
9
+ association_foreign_key: 'book',
10
+ foreign_key: 'series'
9
11
  end
10
12
 
11
13
  class Series < AbstractSeries; end
data/lib/calibre/tag.rb CHANGED
@@ -1,11 +1,13 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
4
  class AbstractTag < ActiveRecord::Base
3
5
  self.table_name = 'tags'
4
6
 
5
7
  has_and_belongs_to_many :books,
6
- join_table: 'books_tags_link',
7
- association_foreign_key: 'book',
8
- foreign_key: 'tag'
8
+ join_table: 'books_tags_link',
9
+ association_foreign_key: 'book',
10
+ foreign_key: 'tag'
9
11
  end
10
12
 
11
13
  class Tag < AbstractTag; end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Calibre
2
- VERSION = '0.0.2'.freeze
4
+ VERSION = '0.1.0'
3
5
  end
data/lib/calibre.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'sqlite3'
2
4
  require 'active_record'
3
5
 
@@ -15,6 +17,6 @@ require_relative 'calibre/language'
15
17
  module Calibre
16
18
  def self.db=(calibre_db)
17
19
  ActiveRecord::Base.establish_connection(adapter: 'sqlite3',
18
- database: calibre_db)
20
+ database: calibre_db)
19
21
  end
20
22
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calibre-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fauno
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-02 00:00:00.000000000 Z
11
+ date: 2026-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -16,28 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 5.2.0
19
+ version: 7.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 5.2.0
26
+ version: 7.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.0
33
+ version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.66.0
48
+ type: :development
49
+ prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: 1.3.0
54
+ version: 1.66.0
41
55
  description: This gem provides an ActiveRecord interface to Calibre's book database
42
56
  email:
43
57
  - fauno@partidopirata.com.ar
@@ -66,7 +80,7 @@ homepage: https://0xacab.org/partido-interdimensional-pirata/calibre-ruby
66
80
  licenses:
67
81
  - MIT
68
82
  metadata: {}
69
- post_install_message:
83
+ post_install_message:
70
84
  rdoc_options: []
71
85
  require_paths:
72
86
  - lib
@@ -81,9 +95,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
95
  - !ruby/object:Gem::Version
82
96
  version: '0'
83
97
  requirements: []
84
- rubyforge_project:
85
- rubygems_version: 2.5.2
86
- signing_key:
98
+ rubygems_version: 3.3.27
99
+ signing_key:
87
100
  specification_version: 4
88
101
  summary: This gem provides an ActiveRecord interface to Calibre's book database
89
102
  test_files: []