alexandria-book-collection-manager 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +4 -0
  3. data/.reek +3 -0
  4. data/.rubocop.yml +8 -0
  5. data/.rubocop_todo.yml +20 -23
  6. data/.simplecov +3 -0
  7. data/.yardopts +1 -0
  8. data/CHANGELOG.md +6 -0
  9. data/Gemfile +3 -2
  10. data/INSTALL.rdoc +0 -8
  11. data/README.md +72 -0
  12. data/Rakefile +4 -2
  13. data/TODO.md +26 -0
  14. data/alexandria-book-collection-manager.gemspec +6 -3
  15. data/bin/alexandria +1 -6
  16. data/dogtail/basic_run_test.py +9 -0
  17. data/lib/alexandria/book_providers.rb +2 -6
  18. data/lib/alexandria/book_providers/proxis.rb +1 -1
  19. data/lib/alexandria/book_providers/web.rb +1 -1
  20. data/lib/alexandria/book_providers/z3950.rb +4 -4
  21. data/lib/alexandria/export_library.rb +20 -27
  22. data/lib/alexandria/import_library.rb +7 -5
  23. data/lib/alexandria/models/book.rb +11 -1
  24. data/lib/alexandria/models/library.rb +4 -17
  25. data/lib/alexandria/preferences.rb +5 -5
  26. data/lib/alexandria/smart_library.rb +2 -8
  27. data/lib/alexandria/ui/callbacks.rb +1 -1
  28. data/lib/alexandria/ui/columns.rb +9 -0
  29. data/lib/alexandria/ui/completion_models.rb +1 -29
  30. data/lib/alexandria/ui/dialogs/acquire_dialog.rb +2 -3
  31. data/lib/alexandria/ui/dialogs/book_properties_dialog_base.rb +1 -2
  32. data/lib/alexandria/ui/dialogs/new_book_dialog_manual.rb +3 -2
  33. data/lib/alexandria/ui/iconview.rb +1 -6
  34. data/lib/alexandria/ui/libraries_combo.rb +1 -0
  35. data/lib/alexandria/ui/listview.rb +5 -10
  36. data/lib/alexandria/ui/main_app.rb +0 -1
  37. data/lib/alexandria/ui/sidepane.rb +1 -1
  38. data/lib/alexandria/ui/sound.rb +3 -3
  39. data/lib/alexandria/ui/ui_manager.rb +5 -13
  40. data/lib/alexandria/version.rb +2 -2
  41. data/spec/alexandria/book_providers_spec.rb +0 -17
  42. data/spec/alexandria/book_spec.rb +23 -0
  43. data/spec/alexandria/library_spec.rb +26 -0
  44. data/spec/alexandria/smart_library_spec.rb +11 -1
  45. data/spec/alexandria/ui/main_app_spec.rb +0 -11
  46. data/spec/spec_helper.rb +0 -1
  47. data/tasks/dogtail.rake +4 -0
  48. data/tasks/spec.rake +3 -3
  49. metadata +58 -12
  50. data/TODO +0 -24
  51. data/spec/alexandria/ui/listview_spec.rb +0 -28
  52. data/tasks/rdoc.rake +0 -6
@@ -49,7 +49,6 @@ module Alexandria
49
49
  class MainApp
50
50
  include Logging
51
51
  include GetText
52
- MAX_RATING_STARS = 5
53
52
  include Singleton
54
53
  attr_accessor :main_app, :libraries, :actiongroup, :appbar, :prefs
55
54
  attr_accessor :ui_manager
@@ -125,7 +125,7 @@ module Alexandria
125
125
  @library_listview.append_column(column)
126
126
 
127
127
  @library_listview.set_row_separator_func do |model, iter|
128
- # log.debug { "library_listview row_separator #{iter}" }
128
+ # TODO: Replace with iter[3] if possible
129
129
  model.get_value(iter, 3)
130
130
  end
131
131
 
@@ -36,12 +36,12 @@ module Alexandria
36
36
 
37
37
  def play(effect)
38
38
  file = File.join(@sounds_dir, "#{effect}.ogg")
39
- unless @playing
39
+ if @playing
40
+ puts "Already playing #{effect}." if $DEBUG
41
+ else
40
42
  puts "Not playing. Starting #{effect}." if $DEBUG
41
43
  @filesrc.location = file
42
44
  start_playback
43
- else
44
- puts "Already playing #{effect}." if $DEBUG
45
45
  end
46
46
  end
47
47
 
@@ -17,9 +17,10 @@
17
17
  # write to the Free Software Foundation, Inc., 51 Franklin Street,
18
18
  # Fifth Floor, Boston, MA 02110-1301 USA.
19
19
 
20
+ require 'alexandria/ui/columns'
21
+
20
22
  module Alexandria
21
23
  module UI
22
- MAX_RATING_STARS = 5
23
24
  class UIManager < BuilderBase
24
25
  attr_accessor :main_app, :actiongroup, :appbar, :prefs, :listview, :iconview, :listview_model,
25
26
  :iconview_model, :filtered_model
@@ -28,15 +29,6 @@ module Alexandria
28
29
  include GetText
29
30
  GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: 'UTF-8')
30
31
 
31
- module Columns
32
- COVER_LIST, COVER_ICON, TITLE, TITLE_REDUCED, AUTHORS,
33
- ISBN, PUBLISHER, PUBLISH_DATE, EDITION, RATING, IDENT,
34
- NOTES, REDD, OWN, WANT, TAGS, LOANED_TO = (0..17).to_a # duplicated from listview.rb
35
- end
36
-
37
- # The maximum number of rating stars displayed.
38
- MAX_RATING_STARS = 5
39
-
40
32
  def initialize(parent)
41
33
  super('main_app__builder.glade', widget_names)
42
34
  @parent = parent
@@ -153,7 +145,7 @@ module Alexandria
153
145
  def setup_toolbar_combobox
154
146
  cb = Gtk::ComboBoxText.new
155
147
  cb.set_row_separator_func do |model, iter|
156
- # log.debug { "row_separator" }
148
+ # TODO: Replace with iter[0] if possible
157
149
  model.get_value(iter, 0) == '-'
158
150
  end
159
151
  [_('Match everything'),
@@ -761,7 +753,7 @@ module Alexandria
761
753
  iter[Columns::NOTES] = (book.notes || '')
762
754
  iter[Columns::LOANED_TO] = (book.loaned_to || '')
763
755
  rating = (book.rating || Book::DEFAULT_RATING)
764
- iter[Columns::RATING] = MAX_RATING_STARS - rating # ascending order is the default
756
+ iter[Columns::RATING] = Book::MAX_RATING_STARS - rating # ascending order is the default
765
757
  iter[Columns::OWN] = book.own?
766
758
  iter[Columns::REDD] = book.redd?
767
759
  iter[Columns::WANT] = book.want?
@@ -780,7 +772,7 @@ module Alexandria
780
772
  new_height = [ICON_HEIGHT, icon.height].min
781
773
  icon = cache_scaled_icon(icon, new_width, new_height)
782
774
  end
783
- if rating == MAX_RATING_STARS
775
+ if rating == Book::MAX_RATING_STARS
784
776
  icon = icon.tag(Icons::FAVORITE_TAG)
785
777
  end
786
778
  iter[Columns::COVER_ICON] = icon
@@ -18,7 +18,7 @@
18
18
  # Fifth Floor, Boston, MA 02110-1301 USA.
19
19
 
20
20
  module Alexandria
21
- VERSION = '0.7.0'.freeze
21
+ VERSION = '0.7.1'.freeze
22
22
  DATA_VERSION = '0.6.3'.freeze
23
- DISPLAY_VERSION = '0.7.0'.freeze
23
+ DISPLAY_VERSION = '0.7.1'.freeze
24
24
  end
@@ -102,11 +102,6 @@ describe Alexandria::BookProviders do
102
102
  # Right? Don't test if dependency isn't present.
103
103
 
104
104
  it 'LOC should work' do
105
- begin
106
- require 'zoom'
107
- rescue LoadError
108
- skip 'This test needs zoom'
109
- end
110
105
  assert_correct_search_result(Alexandria::BookProviders::LOCProvider,
111
106
  '9780805335583')
112
107
  # this book has non-ASCII letters
@@ -115,23 +110,11 @@ describe Alexandria::BookProviders do
115
110
  end
116
111
 
117
112
  it 'BL should work' do
118
- begin
119
- require 'zoom'
120
- rescue LoadError
121
- skip 'This test needs zoom'
122
- end
123
-
124
113
  assert_correct_search_result(Alexandria::BookProviders::BLProvider,
125
114
  '9781853260803')
126
115
  end
127
116
 
128
117
  it 'SBN should work' do
129
- begin
130
- require 'zoom'
131
- rescue LoadError
132
- skip 'This test needs zoom'
133
- end
134
-
135
118
  assert_correct_search_result(Alexandria::BookProviders::SBNProvider,
136
119
  '9788835926436')
137
120
  end
@@ -31,4 +31,27 @@ describe Alexandria::Book do
31
31
  different_book.isbn = '9780571147999'
32
32
  expect(different_book).not_to eq book
33
33
  end
34
+
35
+ describe '#rating' do
36
+ let(:book) { an_artist_of_the_floating_world }
37
+ it 'returns 0 by default' do
38
+ expect(book.rating).to eq 0
39
+ end
40
+ end
41
+
42
+ describe '#rating=' do
43
+ let(:book) { an_artist_of_the_floating_world }
44
+ it 'assigns rating' do
45
+ book.rating = 5
46
+ expect(book.rating).to eq 5
47
+ end
48
+
49
+ it 'does not allow higher rating than 5 to be assigned' do
50
+ expect { book.rating = 6 }.to raise_error
51
+ end
52
+
53
+ it 'does not allow lower rating than 0 to be assigned' do
54
+ expect { book.rating = -1 }.to raise_error
55
+ end
56
+ end
34
57
  end
@@ -40,11 +40,37 @@ describe Alexandria::Library do
40
40
  describe '#valid_ean?' do
41
41
  it 'returns a true value for valid EANs' do
42
42
  expect(Alexandria::Library.valid_ean?('9780345431929')).to be_truthy
43
+ expect(Alexandria::Library.valid_ean?('978034543192912345')).to be_truthy
43
44
 
44
45
  # Regression test: this EAN has a checksum of 10, which should be
45
46
  # treated like a checksum of 0.
46
47
  expect(Alexandria::Library.valid_ean?('9784047041790')).to be_truthy
47
48
  end
49
+
50
+ it 'returns a false value for invalid EANs' do
51
+ expect(Alexandria::Library.valid_ean?('780345431929')).to be_falsey
52
+ expect(Alexandria::Library.valid_ean?('97803454319290')).to be_falsey
53
+ expect(Alexandria::Library.valid_ean?('97803454319291234')).to be_falsey
54
+ expect(Alexandria::Library.valid_ean?('9780345431929123456')).to be_falsey
55
+ expect(Alexandria::Library.valid_ean?('9780345431928')).to be_falsey
56
+ expect(Alexandria::Library.valid_ean?('9780345431929A')).to be_falsey
57
+
58
+ expect(Alexandria::Library.valid_ean?('9784047041791')).to be_falsey
59
+ end
60
+ end
61
+
62
+ describe '#valid_upc?' do
63
+ it 'returns a true value for valid UPCs' do
64
+ expect(Alexandria::Library.valid_upc?('97803454319312356')).to be_truthy
65
+ end
66
+
67
+ it 'returns a false value for invalid UPCs' do
68
+ expect(Alexandria::Library.valid_upc?('978034543193123567')).to be_falsey
69
+ expect(Alexandria::Library.valid_upc?('9780345431931235')).to be_falsey
70
+
71
+ expect(Alexandria::Library.valid_upc?('97803454319412356')).to be_falsey
72
+ expect(Alexandria::Library.valid_upc?('97803454319212356')).to be_falsey
73
+ end
48
74
  end
49
75
 
50
76
  describe '#canonicalise_isbn' do
@@ -18,5 +18,15 @@
18
18
  require File.dirname(__FILE__) + '/../spec_helper'
19
19
 
20
20
  describe Alexandria::SmartLibrary do
21
- it 'should be clever'
21
+ it 'can be instantiated simply' do
22
+ lib = described_class.new('Hello', [], :all)
23
+ expect(lib.name).to eq 'Hello'
24
+ end
25
+
26
+ it 'normalizes the encoding for name' do
27
+ bad_name = 'Prêts'.force_encoding('ascii')
28
+ lib = described_class.new(bad_name, [], :all)
29
+ expect(lib.name.encoding.name).to eq 'UTF-8'
30
+ expect(bad_name.encoding.name).to eq 'US-ASCII'
31
+ end
22
32
  end
@@ -39,15 +39,4 @@ describe Alexandria::UI::MainApp do
39
39
  Alexandria::UI::MainApp.new
40
40
  end.to raise_error NoMethodError
41
41
  end
42
-
43
- it 'runs' do
44
- @main_app = Alexandria::UI::MainApp.instance
45
-
46
- GLib::Timeout.add(100) do
47
- @main_app.main_app.destroy
48
- Gtk.main_quit
49
- end
50
-
51
- Gtk.main
52
- end
53
42
  end
@@ -37,7 +37,6 @@ def an_artist_of_the_floating_world
37
37
  end
38
38
 
39
39
  Alexandria::UI::Icons.init
40
- Alexandria::UI.start_main_app
41
40
 
42
41
  module Alexandria
43
42
  class Library
@@ -0,0 +1,4 @@
1
+ desc 'run dogtail integration tests'
2
+ task :dogtail do
3
+ `RUBYOPT='-rbundler/setup -Ilib' python dogtail/*.py`
4
+ end
@@ -26,6 +26,6 @@
26
26
 
27
27
  require 'rspec/core/rake_task'
28
28
 
29
- RSpec::Core::RakeTask.new(:spec)
30
-
31
- task default: :spec
29
+ RSpec::Core::RakeTask.new(:spec) do |t|
30
+ t.ruby_opts = ['-rbundler/setup -rsimplecov -Ilib -w']
31
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexandria-book-collection-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander McCormmach
@@ -28,7 +28,7 @@ authors:
28
28
  autorequire:
29
29
  bindir: bin
30
30
  cert_chain: []
31
- date: 2016-10-02 00:00:00.000000000 Z
31
+ date: 2016-12-13 00:00:00.000000000 Z
32
32
  dependencies:
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: gettext
@@ -78,28 +78,28 @@ dependencies:
78
78
  requirements:
79
79
  - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: 3.0.9
81
+ version: 3.1.0
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
- version: 3.0.9
88
+ version: 3.1.0
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: gio2
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 3.0.9
95
+ version: 3.1.0
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 3.0.9
102
+ version: 3.1.0
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: gstreamer
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +114,48 @@ dependencies:
114
114
  - - "~>"
115
115
  - !ruby/object:Gem::Version
116
116
  version: '3.0'
117
+ - !ruby/object:Gem::Dependency
118
+ name: image_size
119
+ requirement: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 1.5.0
124
+ type: :runtime
125
+ prerelease: false
126
+ version_requirements: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - "~>"
129
+ - !ruby/object:Gem::Version
130
+ version: 1.5.0
131
+ - !ruby/object:Gem::Dependency
132
+ name: marc
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: 1.0.0
138
+ type: :runtime
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: 1.0.0
145
+ - !ruby/object:Gem::Dependency
146
+ name: zoom
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: 0.5.0
152
+ type: :runtime
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: 0.5.0
117
159
  - !ruby/object:Gem::Dependency
118
160
  name: minitest
119
161
  requirement: !ruby/object:Gem::Requirement
@@ -134,14 +176,14 @@ dependencies:
134
176
  requirements:
135
177
  - - "~>"
136
178
  - !ruby/object:Gem::Version
137
- version: '11.1'
179
+ version: '12.0'
138
180
  type: :development
139
181
  prerelease: false
140
182
  version_requirements: !ruby/object:Gem::Requirement
141
183
  requirements:
142
184
  - - "~>"
143
185
  - !ruby/object:Gem::Version
144
- version: '11.1'
186
+ version: '12.0'
145
187
  - !ruby/object:Gem::Dependency
146
188
  name: rspec
147
189
  requirement: !ruby/object:Gem::Requirement
@@ -165,8 +207,11 @@ extensions: []
165
207
  extra_rdoc_files: []
166
208
  files:
167
209
  - ".gitignore"
210
+ - ".reek"
168
211
  - ".rubocop.yml"
169
212
  - ".rubocop_todo.yml"
213
+ - ".simplecov"
214
+ - ".yardopts"
170
215
  - CHANGELOG.md
171
216
  - COPYING
172
217
  - ChangeLog.0
@@ -176,7 +221,7 @@ files:
176
221
  - README.md
177
222
  - RELEASE_CHECKLIST
178
223
  - Rakefile
179
- - TODO
224
+ - TODO.md
180
225
  - alexandria-book-collection-manager.gemspec
181
226
  - alexandria.desktop.in
182
227
  - bin/alexandria
@@ -187,6 +232,7 @@ files:
187
232
  - doc/NEWS
188
233
  - doc/alexandria.1
189
234
  - doc/cuecat_support.rdoc
235
+ - dogtail/basic_run_test.py
190
236
  - lib/alexandria.rb
191
237
  - lib/alexandria/about.rb
192
238
  - lib/alexandria/book_providers.rb
@@ -227,6 +273,7 @@ files:
227
273
  - lib/alexandria/ui.rb
228
274
  - lib/alexandria/ui/builder_base.rb
229
275
  - lib/alexandria/ui/callbacks.rb
276
+ - lib/alexandria/ui/columns.rb
230
277
  - lib/alexandria/ui/completion_models.rb
231
278
  - lib/alexandria/ui/dialogs/about_dialog.rb
232
279
  - lib/alexandria/ui/dialogs/acquire_dialog.rb
@@ -420,7 +467,6 @@ files:
420
467
  - spec/alexandria/smart_library_spec.rb
421
468
  - spec/alexandria/ui/dialogs_spec.rb
422
469
  - spec/alexandria/ui/iconview_spec.rb
423
- - spec/alexandria/ui/listview_spec.rb
424
470
  - spec/alexandria/ui/main_app_spec.rb
425
471
  - spec/alexandria/ui/sidepane_spec.rb
426
472
  - spec/alexandria/ui/sound_spec.rb
@@ -445,7 +491,7 @@ files:
445
491
  - spec/data/libraries/0.6.2/My Library/9780755322800.cover
446
492
  - spec/data/libraries/0.6.2/My Library/9780755322800.yaml
447
493
  - spec/spec_helper.rb
448
- - tasks/rdoc.rake
494
+ - tasks/dogtail.rake
449
495
  - tasks/setup.rb
450
496
  - tasks/spec.rake
451
497
  - util/rake/fileinstall.rb
@@ -473,7 +519,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
473
519
  version: '0'
474
520
  requirements: []
475
521
  rubyforge_project:
476
- rubygems_version: 2.5.1
522
+ rubygems_version: 2.6.8
477
523
  signing_key:
478
524
  specification_version: 4
479
525
  summary: GNOME application for managing collections of books
data/TODO DELETED
@@ -1,24 +0,0 @@
1
- Alexandria's TODO list
2
- ======================
3
-
4
- For the next release:
5
-
6
- [X] Drag-and-drop books within libraries
7
- [X] Infinite Undo/Redo
8
- [X] Smart libraries
9
- [X] CueCat userland support
10
- [ ] Threading of all operations
11
-
12
- Future releases:
13
-
14
- [ ] Sort providers meaningfully according to the current locale
15
- [ ] ONIX import
16
- [ ] Import/export via GNOME-DB
17
- [ ] Zoom in the current view, giving more or less details
18
- [ ] PDA support
19
- [ ] Win32 MinGW port
20
- [ ] Show more details about books, like number of pages, price, topic, a
21
- user defined field
22
- [ ] Printing
23
- [ ] Editable views; for icons, renaming their title, for list, editing each
24
- field