alexandria-book-collection-manager 0.7.5 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/ruby.yml +72 -0
- data/.gitignore +4 -1
- data/.rubocop.yml +65 -30
- data/.rubocop_todo.yml +49 -165
- data/.simplecov +5 -2
- data/CHANGELOG.md +64 -0
- data/ChangeLog.0 +19 -19
- data/INSTALL.md +26 -16
- data/README.md +31 -35
- data/Rakefile +18 -16
- data/alexandria-book-collection-manager.gemspec +35 -29
- data/doc/FAQ +2 -2
- data/doc/dependency_decisions.yml +22 -3
- data/lib/alexandria/about.rb +1 -1
- data/lib/alexandria/book_providers/bl_provider.rb +88 -0
- data/lib/alexandria/book_providers/douban.rb +2 -2
- data/lib/alexandria/book_providers/loc_provider.rb +38 -0
- data/lib/alexandria/book_providers/pseudomarc.rb +61 -71
- data/lib/alexandria/book_providers/sbn_provider.rb +108 -0
- data/lib/alexandria/book_providers/{thalia.rb → thalia_provider.rb} +37 -74
- data/lib/alexandria/book_providers/web.rb +2 -2
- data/lib/alexandria/book_providers/worldcat.rb +34 -38
- data/lib/alexandria/book_providers/z3950_provider.rb +199 -0
- data/lib/alexandria/book_providers.rb +48 -65
- data/lib/alexandria/default_preferences.rb +2 -1
- data/lib/alexandria/execution_queue.rb +13 -12
- data/lib/alexandria/export_library.rb +21 -22
- data/lib/alexandria/image_fetcher.rb +25 -0
- data/lib/alexandria/import_library.rb +46 -70
- data/lib/alexandria/import_library_csv.rb +16 -16
- data/lib/alexandria/library_sort_order.rb +3 -1
- data/lib/alexandria/library_store.rb +19 -20
- data/lib/alexandria/logging.rb +5 -9
- data/lib/alexandria/models/book.rb +15 -2
- data/lib/alexandria/models/library.rb +31 -35
- data/lib/alexandria/net.rb +1 -2
- data/lib/alexandria/preferences.rb +27 -33
- data/lib/alexandria/scanners/cue_cat.rb +6 -6
- data/lib/alexandria/scanners/keyboard.rb +1 -1
- data/lib/alexandria/scanners.rb +2 -2
- data/lib/alexandria/smart_library.rb +22 -26
- data/lib/alexandria/ui/about_dialog.rb +1 -1
- data/lib/alexandria/ui/acquire_dialog.rb +15 -19
- data/lib/alexandria/ui/alert_dialog.rb +36 -19
- data/lib/alexandria/ui/bad_isbns_dialog.rb +13 -9
- data/lib/alexandria/ui/barcode_animation.rb +6 -6
- data/lib/alexandria/ui/book_properties_dialog.rb +2 -3
- data/lib/alexandria/ui/book_properties_dialog_base.rb +35 -137
- data/lib/alexandria/ui/calendar_popup.rb +58 -0
- data/lib/alexandria/ui/callbacks.rb +144 -123
- data/lib/alexandria/ui/completion_models.rb +2 -6
- data/lib/alexandria/ui/confirm_erase_dialog.rb +1 -1
- data/lib/alexandria/ui/conflict_while_copying_dialog.rb +2 -2
- data/lib/alexandria/ui/error_dialog.rb +1 -1
- data/lib/alexandria/ui/export_dialog.rb +19 -18
- data/lib/alexandria/ui/icons.rb +34 -40
- data/lib/alexandria/ui/iconview_tooltips.rb +40 -53
- data/lib/alexandria/ui/import_dialog.rb +49 -48
- data/lib/alexandria/ui/init.rb +14 -12
- data/lib/alexandria/ui/keep_bad_isbn_dialog.rb +2 -2
- data/lib/alexandria/ui/libraries_combo.rb +10 -9
- data/lib/alexandria/ui/listview.rb +6 -7
- data/lib/alexandria/ui/main_app.rb +2 -2
- data/lib/alexandria/ui/multi_drag_treeview.rb +5 -7
- data/lib/alexandria/ui/new_book_dialog.rb +63 -65
- data/lib/alexandria/ui/new_book_dialog_manual.rb +1 -1
- data/lib/alexandria/ui/new_provider_dialog.rb +12 -11
- data/lib/alexandria/ui/new_smart_library_dialog.rb +39 -27
- data/lib/alexandria/ui/preferences_dialog.rb +25 -84
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +10 -6
- data/lib/alexandria/ui/provider_preferences_dialog.rb +5 -5
- data/lib/alexandria/ui/really_delete_dialog.rb +2 -2
- data/lib/alexandria/ui/sidepane_manager.rb +38 -38
- data/lib/alexandria/ui/skip_entry_dialog.rb +3 -2
- data/lib/alexandria/ui/smart_library_properties_dialog.rb +35 -36
- data/lib/alexandria/ui/smart_library_properties_dialog_base.rb +61 -244
- data/lib/alexandria/ui/smart_library_rule_box.rb +119 -0
- data/lib/alexandria/ui/sound.rb +4 -6
- data/lib/alexandria/ui/ui_manager.rb +80 -83
- data/lib/alexandria/ui.rb +7 -7
- data/lib/alexandria/version.rb +2 -2
- data/lib/alexandria/web_themes.rb +15 -15
- data/lib/alexandria.rb +2 -2
- data/po/cs.po +947 -865
- data/po/cy.po +913 -864
- data/po/de.po +961 -865
- data/po/el.po +956 -861
- data/po/es.po +952 -857
- data/po/fr.po +950 -865
- data/po/ga.po +866 -819
- data/po/gl.po +946 -861
- data/po/it.po +945 -858
- data/po/ja.po +921 -836
- data/po/mk.po +953 -858
- data/po/nb.po +932 -847
- data/po/nl.po +955 -849
- data/po/pl.po +999 -963
- data/po/pt.po +946 -850
- data/po/pt_BR.po +944 -859
- data/po/ru.po +959 -868
- data/po/sk.po +950 -863
- data/po/sv.po +944 -859
- data/po/uk.po +925 -846
- data/po/zh_TW.po +926 -841
- data/schemas/alexandria.schemas +1 -1
- data/share/alexandria/glade/main_app__builder.glade +6 -21
- data/share/gnome/help/alexandria/C/adding-books.xml +3 -4
- data/share/gnome/help/alexandria/C/introduction.xml +0 -16
- data/share/gnome/help/alexandria/C/searching.xml +1 -4
- data/share/gnome/help/alexandria/C/settings.xml +0 -30
- data/share/gnome/help/alexandria/C/smart-libraries.xml +2 -2
- data/share/gnome/help/alexandria/C/working-with-libraries.xml +1 -1
- data/share/gnome/help/alexandria/fr/alexandria.xml +5 -160
- data/share/gnome/help/alexandria/ja/adding-books.xml +1 -1
- data/share/gnome/help/alexandria/ja/introduction.xml +0 -15
- data/share/gnome/help/alexandria/ja/searching.xml +3 -7
- data/share/gnome/help/alexandria/ja/settings.xml +0 -27
- data/share/gnome/help/alexandria/ja/smart-libraries.xml +1 -1
- data/spec/alexandria/book_providers/bl_provider_spec.rb +13 -0
- data/spec/alexandria/book_providers/loc_provider_spec.rb +17 -0
- data/spec/alexandria/book_providers/sbn_provider_spec.rb +13 -0
- data/spec/alexandria/book_providers/thalia_provider_spec.rb +119 -0
- data/spec/alexandria/book_providers/world_cat_provider_spec.rb +160 -0
- data/spec/alexandria/book_providers_spec.rb +0 -154
- data/spec/alexandria/console_spec.rb +0 -5
- data/spec/alexandria/export_library_spec.rb +27 -38
- data/spec/alexandria/library_spec.rb +76 -46
- data/spec/alexandria/preferences_spec.rb +29 -3
- data/spec/alexandria/scanners/cue_cat_spec.rb +1 -1
- data/spec/alexandria/ui/about_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/acquire_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/alert_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/book_properties_dialog_spec.rb +47 -5
- data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/error_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/export_dialog_spec.rb +25 -4
- data/spec/alexandria/ui/icons_spec.rb +26 -0
- data/spec/alexandria/ui/iconview_spec.rb +1 -1
- data/spec/alexandria/ui/import_dialog_spec.rb +35 -3
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/main_app_spec.rb +1 -1
- data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +39 -3
- data/spec/alexandria/ui/new_provider_dialog_spec.rb +19 -3
- data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +28 -3
- data/spec/alexandria/ui/preferences_dialog_spec.rb +2 -2
- data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +23 -8
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/sidepane_manager_spec.rb +2 -2
- data/spec/alexandria/ui/skip_entry_dialog_spec.rb +1 -1
- data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +37 -6
- data/spec/alexandria/ui/ui_manager_spec.rb +116 -2
- data/spec/data/libraries/0.6.2/My Library/9780571147168.yaml +2 -0
- data/spec/end_to_end/basic_run_spec.rb +3 -8
- data/spec/fixtures/cover.jpg +0 -0
- data/spec/spec_helper.rb +47 -3
- data/tasks/spec.rake +3 -5
- data/util/rake/fileinstall.rb +16 -15
- data/util/rake/omfgenerate.rb +1 -1
- metadata +141 -52
- data/.travis.yml +0 -39
- data/lib/alexandria/book_providers/adlibris.rb +0 -196
- data/lib/alexandria/book_providers/amazon_aws.rb +0 -252
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +0 -388
- data/lib/alexandria/book_providers/barnes_and_noble.rb +0 -209
- data/lib/alexandria/book_providers/proxis.rb +0 -175
- data/lib/alexandria/book_providers/siciliano.rb +0 -257
- data/lib/alexandria/book_providers/z3950.rb +0 -415
- data/spec/alexandria/ui/ui_utilities_spec.rb +0 -62
- data/spec/alexandria/utilities_spec.rb +0 -52
@@ -4,16 +4,31 @@
|
|
4
4
|
#
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
|
-
|
7
|
+
require_relative "../../spec_helper"
|
8
8
|
|
9
9
|
describe Alexandria::UI::ProviderPreferencesDialog do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
let(:parent) { Gtk::Window.new :toplevel }
|
11
|
+
let(:preferences) do
|
12
|
+
instance_double(Alexandria::BookProviders::Preferences,
|
13
|
+
length: 0, read: [])
|
14
|
+
end
|
15
|
+
let(:provider) do
|
16
|
+
instance_double(Alexandria::BookProviders::GenericProvider,
|
17
|
+
fullname: "FooProvider",
|
18
|
+
prefs: preferences)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "can be instantiated" do
|
17
22
|
described_class.new parent, provider
|
18
23
|
end
|
24
|
+
|
25
|
+
describe "#acquire" do
|
26
|
+
it "works" do
|
27
|
+
preferences_dialog = described_class.new parent, provider
|
28
|
+
gtk_dialog = preferences_dialog.dialog
|
29
|
+
allow(gtk_dialog).to receive(:run)
|
30
|
+
|
31
|
+
preferences_dialog.acquire
|
32
|
+
end
|
33
|
+
end
|
19
34
|
end
|
@@ -4,9 +4,9 @@
|
|
4
4
|
#
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
|
-
|
7
|
+
require_relative "../../spec_helper"
|
8
8
|
|
9
|
-
describe Alexandria::UI::
|
9
|
+
describe Alexandria::UI::SidepaneManager do
|
10
10
|
it "works" do
|
11
11
|
library_listview = instance_double(Gtk::TreeView).as_null_object
|
12
12
|
parent = instance_double(Alexandria::UI::UIManager, main_app: nil, append_library: nil)
|
@@ -4,15 +4,46 @@
|
|
4
4
|
#
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
|
-
|
7
|
+
require_relative "../../spec_helper"
|
8
8
|
|
9
9
|
describe Alexandria::UI::SmartLibraryPropertiesDialog do
|
10
|
-
|
10
|
+
let(:properties_dialog) do
|
11
11
|
parent = Gtk::Window.new :toplevel
|
12
|
-
|
13
|
-
|
14
|
-
rules: [],
|
15
|
-
predicate_operator_rule: :any)
|
12
|
+
loader = Alexandria::LibraryStore.new(TESTDIR)
|
13
|
+
smart_library = Alexandria::SmartLibrary.new("Foo", [], :all, loader)
|
16
14
|
described_class.new parent, smart_library
|
17
15
|
end
|
16
|
+
let(:gtk_dialog) { properties_dialog.dialog }
|
17
|
+
|
18
|
+
describe "#acquire" do
|
19
|
+
it "works when response is cancel" do
|
20
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
|
21
|
+
properties_dialog.acquire
|
22
|
+
end
|
23
|
+
|
24
|
+
it "works when response is ok" do
|
25
|
+
allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
|
26
|
+
properties_dialog.acquire
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#handle_date_icon_press" do
|
31
|
+
let(:date_entry) do
|
32
|
+
rule_boxes = properties_dialog.handle_add_rule_clicked
|
33
|
+
rule_box = rule_boxes.first
|
34
|
+
rule_box.children[3]
|
35
|
+
end
|
36
|
+
|
37
|
+
before do
|
38
|
+
gtk_dialog.show_all
|
39
|
+
end
|
40
|
+
|
41
|
+
it "pops up the calendar widget" do
|
42
|
+
properties_dialog.handle_date_icon_press(date_entry,
|
43
|
+
Gtk::EntryIconPosition::PRIMARY,
|
44
|
+
nil)
|
45
|
+
popup = properties_dialog.instance_variable_get(:@calendar_popup)
|
46
|
+
expect(popup).to be_visible
|
47
|
+
end
|
48
|
+
end
|
18
49
|
end
|
@@ -4,11 +4,125 @@
|
|
4
4
|
#
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
|
-
|
7
|
+
require_relative "../../spec_helper"
|
8
8
|
|
9
9
|
describe Alexandria::UI::UIManager do
|
10
|
+
let(:main_app) { instance_double(Alexandria::UI::MainApp) }
|
11
|
+
|
10
12
|
it "works" do
|
11
|
-
main_app = instance_double(Alexandria::UI::MainApp)
|
12
13
|
described_class.new main_app
|
13
14
|
end
|
15
|
+
|
16
|
+
describe "#on_new" do
|
17
|
+
it "works" do
|
18
|
+
ui = described_class.new main_app
|
19
|
+
libraries = ui.instance_variable_get(:@libraries)
|
20
|
+
libraries_count = libraries.all_libraries.count
|
21
|
+
ui.on_new
|
22
|
+
expect(libraries.all_libraries.count).to eq libraries_count + 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "#on_books_selection_changed" do
|
27
|
+
let(:lib_version) { File.join(LIBDIR, "0.6.2") }
|
28
|
+
let(:ui) { described_class.new main_app }
|
29
|
+
let(:libraries) { ui.instance_variable_get(:@libraries) }
|
30
|
+
let(:regular_library) { libraries.all_regular_libraries.last }
|
31
|
+
|
32
|
+
before do
|
33
|
+
FileUtils.cp_r(lib_version, TESTDIR)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "works when single book is selected" do
|
37
|
+
ui.select_a_library regular_library
|
38
|
+
|
39
|
+
# FIXME: This is needed because right now UIManager#refresh_books doesn't
|
40
|
+
# work without Gtk loop.
|
41
|
+
regular_library.each { |book| ui.append_book book }
|
42
|
+
# This makes the iconview model re-appear
|
43
|
+
ui.iconview.unfreeze
|
44
|
+
expect(ui.model.iter_n_children).to eq regular_library.count
|
45
|
+
|
46
|
+
# This triggers the #on_books_selection_changed callback
|
47
|
+
ui.select_a_book regular_library.first
|
48
|
+
|
49
|
+
expect(ui.iconview.selected_items).not_to be_empty
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe "#select_a_book" do
|
54
|
+
let(:ui) { described_class.new main_app }
|
55
|
+
let(:libraries) { ui.instance_variable_get(:@libraries) }
|
56
|
+
let(:filter_entry) { ui.instance_variable_get(:@filter_entry) }
|
57
|
+
let(:regular_library) { libraries.all_regular_libraries.last }
|
58
|
+
|
59
|
+
before do
|
60
|
+
lib_version = File.join(LIBDIR, "0.6.2")
|
61
|
+
FileUtils.cp_r(lib_version, TESTDIR)
|
62
|
+
|
63
|
+
ui.select_a_library regular_library
|
64
|
+
# Make books appear in the view
|
65
|
+
regular_library.each { |book| ui.append_book book }
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when selecting in the icon view" do
|
69
|
+
before do
|
70
|
+
# Make view model re-appear
|
71
|
+
ui.iconview.unfreeze
|
72
|
+
end
|
73
|
+
|
74
|
+
it "selects book if it is in view" do
|
75
|
+
ui.select_a_book regular_library.first
|
76
|
+
|
77
|
+
selected = ui.iconview.selected_items
|
78
|
+
expect(selected.count).to eq 1
|
79
|
+
end
|
80
|
+
|
81
|
+
it "selects nothing if book is not in view due to a filter" do
|
82
|
+
filter_entry.text = regular_library.last.title
|
83
|
+
ui.filtered_model.refilter
|
84
|
+
|
85
|
+
ui.select_a_book regular_library.first
|
86
|
+
|
87
|
+
selected = ui.iconview.selected_items
|
88
|
+
expect(selected.count).to eq 0
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
context "when selecting in the list view" do
|
93
|
+
before do
|
94
|
+
# Make view model re-appear
|
95
|
+
ui.listview.unfreeze
|
96
|
+
end
|
97
|
+
|
98
|
+
it "selects book if it is in view" do
|
99
|
+
ui.select_a_book regular_library.first
|
100
|
+
|
101
|
+
selected, _model = ui.listview.selection.selected_rows
|
102
|
+
expect(selected.count).to eq 1
|
103
|
+
end
|
104
|
+
|
105
|
+
it "selects nothing if book is not in view due to a filter" do
|
106
|
+
filter_entry.text = regular_library.last.title
|
107
|
+
ui.filtered_model.refilter
|
108
|
+
|
109
|
+
ui.select_a_book regular_library.first
|
110
|
+
|
111
|
+
selected = ui.listview.selection.to_a
|
112
|
+
expect(selected).to be_empty
|
113
|
+
end
|
114
|
+
|
115
|
+
it "selects nothing if a new book is not in view due to a filter" do
|
116
|
+
filter_entry.text = regular_library.last.title
|
117
|
+
ui.filtered_model.refilter
|
118
|
+
|
119
|
+
book = an_artist_of_the_floating_world
|
120
|
+
ui.append_book book
|
121
|
+
ui.select_a_book book
|
122
|
+
|
123
|
+
selected = ui.listview.selection.to_a
|
124
|
+
expect(selected).to be_empty
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
14
128
|
end
|
@@ -19,13 +19,6 @@ describe "The Alexandria application" do
|
|
19
19
|
driver.cleanup
|
20
20
|
end
|
21
21
|
|
22
|
-
it "starts and can be quit with Ctrl-q" do
|
23
|
-
driver.press_ctrl_q
|
24
|
-
|
25
|
-
status = driver.cleanup
|
26
|
-
expect(status.exitstatus).to eq 0
|
27
|
-
end
|
28
|
-
|
29
22
|
it "starts and can be quit with the menu" do
|
30
23
|
frame = driver.frame
|
31
24
|
menu = frame.find_role :menu_item, /Quit/
|
@@ -49,7 +42,9 @@ describe "The Alexandria application" do
|
|
49
42
|
table_cell.do_action idx if name == "activate"
|
50
43
|
end
|
51
44
|
|
52
|
-
driver.
|
45
|
+
frame = driver.frame
|
46
|
+
menu = frame.find_role :menu_item, /Quit/
|
47
|
+
menu.do_action 0
|
53
48
|
|
54
49
|
status = driver.cleanup
|
55
50
|
expect(status.exitstatus).to eq 0
|
Binary file
|
data/spec/spec_helper.rb
CHANGED
@@ -4,11 +4,12 @@
|
|
4
4
|
#
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
require "rspec"
|
9
8
|
require "alexandria"
|
9
|
+
require "webmock/rspec"
|
10
|
+
require "pry"
|
10
11
|
|
11
|
-
LIBDIR = File.expand_path(
|
12
|
+
LIBDIR = File.expand_path("data/libraries", __dir__)
|
12
13
|
TESTDIR = File.join(LIBDIR, "test")
|
13
14
|
|
14
15
|
def an_artist_of_the_floating_world
|
@@ -19,12 +20,55 @@ def an_artist_of_the_floating_world
|
|
19
20
|
"Paperback")
|
20
21
|
end
|
21
22
|
|
23
|
+
def assert_correct_search_result(provider, query,
|
24
|
+
search_type = Alexandria::BookProviders::SEARCH_BY_ISBN)
|
25
|
+
begin
|
26
|
+
results = provider.instance.search(query, search_type)
|
27
|
+
rescue SocketError
|
28
|
+
skip "Service is offline"
|
29
|
+
end
|
30
|
+
|
31
|
+
expect(results).to be_instance_of(Array), "Results are not an array for #{provider}"
|
32
|
+
expect(results).not_to be_empty, "Results are empty for #{provider}"
|
33
|
+
|
34
|
+
if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
|
35
|
+
expect(results.length).to be <= 2, "Results are greater than 2 for #{provider}"
|
36
|
+
|
37
|
+
book = results.first
|
38
|
+
|
39
|
+
expect(book).to be_instance_of(Alexandria::Book),
|
40
|
+
"Result is not a Book for #{provider}"
|
41
|
+
|
42
|
+
canonical_query = Alexandria::Library.canonicalise_ean(query)
|
43
|
+
canonical_result = Alexandria::Library.canonicalise_ean(book.isbn)
|
44
|
+
expect(canonical_query)
|
45
|
+
.to eq(canonical_result),
|
46
|
+
"Result's isbn #{book.isbn} is not equivalent" \
|
47
|
+
" to the requested isbn #{query} for #{provider}"
|
48
|
+
|
49
|
+
if results.length == 2
|
50
|
+
cover_url = results.last
|
51
|
+
if cover_url
|
52
|
+
expect(cover_url)
|
53
|
+
.to be_instance_of(String),
|
54
|
+
"Unexpected cover_url #{cover_url.inspect} for #{provider}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
else
|
58
|
+
expect(results.first.first)
|
59
|
+
.to be_instance_of(Alexandria::Book), "Result item is not a Book for #{provider}"
|
60
|
+
end
|
61
|
+
results
|
62
|
+
end
|
63
|
+
|
22
64
|
Alexandria::UI::Icons.init
|
23
65
|
|
24
66
|
test_store = Alexandria::LibraryStore.new(TESTDIR)
|
25
67
|
Alexandria::LibraryCollection.instance.library_store = test_store
|
26
68
|
|
27
69
|
RSpec.configure do |config|
|
70
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
71
|
+
|
28
72
|
config.before do
|
29
73
|
FileUtils.rm_rf(TESTDIR)
|
30
74
|
end
|
data/tasks/spec.rake
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -*- ruby -*-
|
4
4
|
#--
|
5
|
-
# Copyright (C) 2011
|
5
|
+
# Copyright (C) 2011 Matijs van Zuijlen
|
6
6
|
#
|
7
7
|
# This file is part of the Alexandria build system.
|
8
8
|
#
|
@@ -39,10 +39,8 @@ namespace "spec" do
|
|
39
39
|
t.ruby_opts = ["-rbundler/setup -rsimplecov -Ilib -w"]
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
t.ruby_opts = ["-rbundler/setup -rsimplecov -Ilib -w"]
|
45
|
-
end
|
42
|
+
desc "Runs all unit and end-to-end specs"
|
43
|
+
task "all" => ["spec:unit", "spec:end_to_end"]
|
46
44
|
end
|
47
45
|
|
48
46
|
task spec: "spec:all"
|
data/util/rake/fileinstall.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
# -*- ruby -*-
|
4
4
|
#--
|
5
5
|
# Copyright (C) 2009 Cathal Mc Ginley
|
6
|
-
# Copyright (C) 2011 Matijs van Zuijlen
|
6
|
+
# Copyright (C) 2011, 2020 Matijs van Zuijlen
|
7
7
|
#
|
8
8
|
# This file is part of the Alexandria build system.
|
9
9
|
#
|
@@ -105,7 +105,7 @@ class FileInstallTask < Rake::TaskLib
|
|
105
105
|
@dirs_to_remove_globs.each do |glob|
|
106
106
|
regex = glob2regex(glob)
|
107
107
|
all_dirs.each do |dir|
|
108
|
-
dir += "/" unless dir
|
108
|
+
dir += "/" unless dir.end_with?("/")
|
109
109
|
to_delete << Regexp.last_match[1] if regex =~ dir
|
110
110
|
end
|
111
111
|
end
|
@@ -182,7 +182,7 @@ class FileInstallTask < Rake::TaskLib
|
|
182
182
|
if @prefix == ruby_prefix
|
183
183
|
@rubylib = ruby_libdir
|
184
184
|
elsif ruby_libdir.index(ruby_prefix).zero?
|
185
|
-
libpart = ruby_libdir[ruby_prefix.size
|
185
|
+
libpart = ruby_libdir[ruby_prefix.size..]
|
186
186
|
@rubylib = File.join(@prefix, libpart)
|
187
187
|
else
|
188
188
|
@rubylib = ruby_libdir
|
@@ -190,12 +190,12 @@ class FileInstallTask < Rake::TaskLib
|
|
190
190
|
end
|
191
191
|
|
192
192
|
def glob2regex(pathglob)
|
193
|
-
pathglob += "/" if
|
193
|
+
pathglob += "/" if pathglob.end_with?("**")
|
194
194
|
real_parts = pathglob.split("**/")
|
195
195
|
real_parts.each do |part|
|
196
|
-
part.gsub!(".",
|
197
|
-
part.gsub!("*",
|
198
|
-
part.gsub!("?",
|
196
|
+
part.gsub!(".", "\\.")
|
197
|
+
part.gsub!("*", "[^\\/]*")
|
198
|
+
part.gsub!("?", "[^\\/]")
|
199
199
|
end
|
200
200
|
pattern = real_parts.join("([^\/]+\/)*")
|
201
201
|
/(#{pattern})/
|
@@ -210,16 +210,16 @@ class FileInstallTask < Rake::TaskLib
|
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
|
-
# Delete the directory at the given Pathname +
|
213
|
+
# Delete the directory at the given Pathname +path+ if all its children
|
214
214
|
# can be similarly deleted, and if it is then empty.
|
215
|
-
def delete_if_empty(
|
216
|
-
return false unless
|
215
|
+
def delete_if_empty(path)
|
216
|
+
return false unless path.directory?
|
217
217
|
|
218
|
-
|
218
|
+
path.children.each do |c|
|
219
219
|
delete_if_empty(c)
|
220
220
|
end
|
221
|
-
if
|
222
|
-
|
221
|
+
if path.children.empty?
|
222
|
+
path.delete # TODO: optional verbose output here
|
223
223
|
true
|
224
224
|
else
|
225
225
|
false
|
@@ -229,6 +229,7 @@ class FileInstallTask < Rake::TaskLib
|
|
229
229
|
class FileGroup
|
230
230
|
attr_reader :mode
|
231
231
|
attr_accessor :description
|
232
|
+
|
232
233
|
def initialize(src_dir, file_glob, dest_dir, mode = 0o644)
|
233
234
|
@src_dir = src_dir
|
234
235
|
@file_glob = file_glob
|
@@ -290,5 +291,5 @@ class FileInstallTask < Rake::TaskLib
|
|
290
291
|
all_dirs_set << File.dirname(file)
|
291
292
|
end
|
292
293
|
end
|
293
|
-
end
|
294
|
-
end
|
294
|
+
end
|
295
|
+
end
|
data/util/rake/omfgenerate.rb
CHANGED
@@ -67,7 +67,7 @@ class OmfGenerateTask < Rake::TaskLib
|
|
67
67
|
rule ".omf" => [".omf.in"] do |t|
|
68
68
|
path = File.join(@gnome_helpfiles_dir, @projectname,
|
69
69
|
locale_for(t.name), "#{@projectname}.xml")
|
70
|
-
data =
|
70
|
+
data = File.read(t.source)
|
71
71
|
data.sub!(/PATH_TO_DOC_FILE/, path)
|
72
72
|
puts "Generating #{t.name}..."
|
73
73
|
File.open(t.name, "w") { |io| io.puts data }
|