alexandria-book-collection-manager 0.7.8 → 0.7.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +45 -50
  3. data/.rubocop.yml +18 -5
  4. data/.rubocop_todo.yml +29 -22
  5. data/CHANGELOG.md +29 -0
  6. data/ChangeLog.0 +19 -19
  7. data/INSTALL.md +3 -5
  8. data/README.md +0 -5
  9. data/Rakefile +11 -11
  10. data/alexandria-book-collection-manager.gemspec +35 -34
  11. data/doc/FAQ +2 -2
  12. data/lib/alexandria/about.rb +1 -1
  13. data/lib/alexandria/book_providers/bl_provider.rb +88 -0
  14. data/lib/alexandria/book_providers/loc_provider.rb +38 -0
  15. data/lib/alexandria/book_providers/pseudomarc.rb +1 -1
  16. data/lib/alexandria/book_providers/sbn_provider.rb +108 -0
  17. data/lib/alexandria/book_providers/thalia_provider.rb +1 -1
  18. data/lib/alexandria/book_providers/web.rb +2 -2
  19. data/lib/alexandria/book_providers/worldcat.rb +9 -7
  20. data/lib/alexandria/book_providers/z3950_provider.rb +199 -0
  21. data/lib/alexandria/book_providers.rb +10 -25
  22. data/lib/alexandria/default_preferences.rb +1 -1
  23. data/lib/alexandria/export_library.rb +10 -10
  24. data/lib/alexandria/image_fetcher.rb +25 -0
  25. data/lib/alexandria/import_library.rb +9 -9
  26. data/lib/alexandria/library_store.rb +3 -4
  27. data/lib/alexandria/models/book.rb +13 -0
  28. data/lib/alexandria/models/library.rb +13 -21
  29. data/lib/alexandria/preferences.rb +4 -6
  30. data/lib/alexandria/scanners/cue_cat.rb +1 -1
  31. data/lib/alexandria/ui/about_dialog.rb +1 -1
  32. data/lib/alexandria/ui/acquire_dialog.rb +6 -9
  33. data/lib/alexandria/ui/barcode_animation.rb +1 -1
  34. data/lib/alexandria/ui/book_properties_dialog_base.rb +2 -6
  35. data/lib/alexandria/ui/completion_models.rb +1 -5
  36. data/lib/alexandria/ui/conflict_while_copying_dialog.rb +1 -1
  37. data/lib/alexandria/ui/listview.rb +1 -1
  38. data/lib/alexandria/ui/multi_drag_treeview.rb +1 -1
  39. data/lib/alexandria/ui/new_book_dialog.rb +11 -13
  40. data/lib/alexandria/ui/new_book_dialog_manual.rb +1 -1
  41. data/lib/alexandria/ui/preferences_dialog.rb +2 -2
  42. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +1 -1
  43. data/lib/alexandria/ui/really_delete_dialog.rb +1 -1
  44. data/lib/alexandria/ui/ui_manager.rb +14 -22
  45. data/lib/alexandria/version.rb +1 -1
  46. data/po/cs.po +90 -125
  47. data/po/cy.po +87 -125
  48. data/po/de.po +96 -125
  49. data/po/el.po +96 -125
  50. data/po/es.po +96 -125
  51. data/po/fr.po +90 -125
  52. data/po/ga.po +83 -124
  53. data/po/gl.po +90 -125
  54. data/po/it.po +90 -125
  55. data/po/ja.po +90 -125
  56. data/po/mk.po +96 -125
  57. data/po/nb.po +90 -125
  58. data/po/nl.po +107 -124
  59. data/po/pl.po +113 -124
  60. data/po/pt.po +90 -125
  61. data/po/pt_BR.po +90 -125
  62. data/po/ru.po +92 -124
  63. data/po/sk.po +90 -125
  64. data/po/sv.po +90 -125
  65. data/po/uk.po +90 -125
  66. data/po/zh_TW.po +90 -125
  67. data/schemas/alexandria.schemas +1 -1
  68. data/share/gnome/help/alexandria/C/adding-books.xml +3 -4
  69. data/share/gnome/help/alexandria/C/introduction.xml +0 -16
  70. data/share/gnome/help/alexandria/C/searching.xml +1 -4
  71. data/share/gnome/help/alexandria/C/settings.xml +0 -30
  72. data/share/gnome/help/alexandria/fr/alexandria.xml +4 -159
  73. data/share/gnome/help/alexandria/ja/adding-books.xml +1 -1
  74. data/share/gnome/help/alexandria/ja/introduction.xml +0 -15
  75. data/share/gnome/help/alexandria/ja/searching.xml +3 -7
  76. data/share/gnome/help/alexandria/ja/settings.xml +0 -27
  77. data/spec/alexandria/book_providers/bl_provider_spec.rb +13 -0
  78. data/spec/alexandria/book_providers/loc_provider_spec.rb +17 -0
  79. data/spec/alexandria/book_providers/sbn_provider_spec.rb +13 -0
  80. data/spec/alexandria/book_providers_spec.rb +0 -81
  81. data/spec/alexandria/library_spec.rb +20 -2
  82. data/spec/alexandria/ui/import_dialog_spec.rb +1 -1
  83. data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +1 -1
  84. data/spec/alexandria/ui/preferences_dialog_spec.rb +1 -1
  85. data/spec/alexandria/ui/ui_manager_spec.rb +78 -2
  86. data/spec/data/libraries/0.6.2/My Library/9780571147168.yaml +2 -0
  87. data/util/rake/fileinstall.rb +4 -4
  88. data/util/rake/omfgenerate.rb +1 -1
  89. metadata +69 -55
  90. data/lib/alexandria/book_providers/adlibris.rb +0 -191
  91. data/lib/alexandria/book_providers/amazon_aws.rb +0 -239
  92. data/lib/alexandria/book_providers/amazon_ecs_util.rb +0 -373
  93. data/lib/alexandria/book_providers/barnes_and_noble.rb +0 -209
  94. data/lib/alexandria/book_providers/proxis.rb +0 -176
  95. data/lib/alexandria/book_providers/siciliano.rb +0 -256
  96. data/lib/alexandria/book_providers/z3950.rb +0 -408
@@ -165,27 +165,6 @@ Date : 30 décembre 2005
165
165
  <!--retrieves and displays book information (including cover pictures) from online libraries:-->
166
166
  </para>
167
167
  <itemizedlist>
168
- <listitem>
169
- <para>
170
- <orgname>Amazon</orgname> (.com, .co.uk, .de et .jp)&nbsp;;
171
- </para>
172
- </listitem>
173
- <listitem>
174
- <para>
175
- <orgname>Proxis</orgname>&nbsp;;
176
- </para>
177
- </listitem>
178
- <listitem>
179
- <para>
180
- <orgname>Barnes and Noble</orgname>&nbsp;;
181
- </para>
182
- </listitem>
183
- <listitem>
184
- <para>
185
- <orgname>Ministère de la Culture espagnole</orgname>&nbsp;;
186
- <!--the Spanish Ministry of Culture-->
187
- </para>
188
- </listitem>
189
168
  <listitem>
190
169
  <para>
191
170
  <orgname>Amadeus Buch</orgname>&nbsp;;
@@ -618,15 +597,14 @@ Date : 30 décembre 2005
618
597
  ajouter, vous pouvez rechercher par le titre,
619
598
  les auteurs ou des mots clés.
620
599
  &app; recherche les livres qui correspondent aux critères définis
621
- à partir de fournisseurs d&#8217;informations en ligne tel
622
- qu&#8217;<ulink url="http://www.amazon.fr">Amazon</ulink>.
600
+ à partir de fournisseurs d&#8217;informations en ligne.
623
601
  Vous pouvez ensuite sélectionner le livre désiré à partir de la liste
624
602
  affichée et cliquer sur le bouton
625
603
  <guibutton>A<accel>j</accel>outer</guibutton> pour
626
604
  l&#8217;intégrer à votre bibliothèque.
627
605
  <!--If you do not know the ISBN of the book you wish to add, you can specify
628
606
  either the Title, the Authors or the Keywords, and &app; will search
629
- your online information provider, such as Amazon, for books that match.
607
+ your online information provider for books that match.
630
608
  You can then select the desired book from the displayed list and
631
609
  click <guibutton>Add</guibutton> to the book to the selected library.-->
632
610
  </para>
@@ -1610,55 +1588,21 @@ Date : 30 décembre 2005
1610
1588
  </title>
1611
1589
  <para>
1612
1590
  Pour trouver plus d&#8217;informations au sujet de vos livres, vous
1613
- pouvez utiliser &app; pour ouvrir une page web sur
1614
- <orgname>Amazon</orgname>, <orgname>Barnes and Noble</orgname>
1615
- ou chez l&#8217;un des autres fournisseurs d&#8217;informations en ligne
1591
+ pouvez utiliser &app; pour ouvrir une page web
1592
+ chez l&#8217;un des fournisseurs d&#8217;informations en ligne
1616
1593
  et être dirigé directement à la page du livre concerné.
1617
1594
  Pour cela, sélectionnez le livre, cliquez dessus avec le bouton
1618
1595
  <mousebutton>droit</mousebutton> de la souris,
1619
1596
  et à partir du menu contextuel choisissez
1620
1597
  <guimenu>Afficher les <accel>i</accel>nformations en ligne</guimenu>
1621
1598
  puis sélectionnez le fournisseur dans la liste présentée.
1622
- <!--If you want to find out more information about your book, you
1623
- can use &app; to open the web page of Amazon, Barnes and Noble,
1624
- or one of the other online information providers and be
1625
- taken directly to the relevant book. Simply select the book you
1626
- wish to know more about, right-click on it, and from the menu
1627
- <guimenuitem>Display Online Information</guimenuitem>, choose
1628
- from either Amazon, Barnes and Nobel, Proxis,
1629
- Spanish Culture Ministry, Amadeus Buch, or
1630
- Internet Bookshop Italia.-->
1631
1599
  </para>
1632
- <tip>
1633
- <para>
1634
- Le menu
1635
- <menuchoice>
1636
- <guimenu>Afficher les <accel>i</accel>nformations en ligne</guimenu>
1637
- <guimenuitem>Sur <accel>A</accel>mazon</guimenuitem>
1638
- </menuchoice>
1639
- vous envoie sur le site d&#8217;<orgname>Amazon</orgname> .com,
1640
- .ca, .co.uk, .de, .fr, ou .jp en fonction de votre
1641
- configuration pour ce fournisseur (voir
1642
- <xref linkend="alexandria-amazon-prefs"/>).
1643
- <!--The
1644
- <menuchoice>
1645
- <guimenu>Display Online Information</guimenu>
1646
- <guimenuitem>At Amazon</guimenuitem>
1647
- </menuchoice>
1648
- choice will take you to the Amazon .com, .co.uk, .de, or jp
1649
- site, as set up in the
1650
- <xref linkend="alexandria-amazon-prefs"/>.-->
1651
- </para>
1652
- </tip>
1653
1600
  <caution>
1654
1601
  <para>
1655
1602
  Les sources d&#8217;informations en ligne n&#8217;ont pas une liste
1656
1603
  complète de livres et il est possible que vous deviez
1657
1604
  essayer plusieurs fournisseurs pour trouver
1658
1605
  l&#8217;information recherchée.
1659
- <!--Not every online information source has a complete list of
1660
- books and you may have to try several different providers
1661
- to find the information you want.-->
1662
1606
  </para>
1663
1607
  </caution>
1664
1608
  </sect2>
@@ -1964,35 +1908,7 @@ Date : 30 décembre 2005
1964
1908
  en déplaçant chaque source en utilisant
1965
1909
  les boutons <guibutton><accel>V</accel>ers le haut</guibutton>
1966
1910
  ou <guibutton><accel>V</accel>ers le bas</guibutton>.
1967
- <!--&app; can download information from a variety of different
1968
- online sources; some of these sources have additional options
1969
- to control how the information is downloaded. &app; will
1970
- search each of the sources in turn, in the order displayed in
1971
- the list. You can change the order in which the sources are
1972
- searched by moving each source up or down using the
1973
- <guibutton>Up</guibutton> and <guibutton>Down</guibutton> buttons.-->
1974
1911
  <itemizedlist>
1975
- <listitem>
1976
- <para>
1977
- <xref linkend="alexandria-amazon-prefs"/>&nbsp;;
1978
- </para>
1979
- </listitem>
1980
- <listitem>
1981
- <para>
1982
- <xref linkend="alexandria-proxis-prefs"/>&nbsp;;
1983
- </para>
1984
- </listitem>
1985
- <listitem>
1986
- <para>
1987
- Ministère de la Culture espagnol&nbsp;;
1988
- <!--The Spanish Culture Ministry-->
1989
- </para>
1990
- </listitem>
1991
- <listitem>
1992
- <para>
1993
- Barnes and Noble&nbsp;;
1994
- </para>
1995
- </listitem>
1996
1912
  <listitem>
1997
1913
  <para>
1998
1914
  Amadeus Buch&nbsp;;
@@ -2035,77 +1951,6 @@ Date : 30 décembre 2005
2035
1951
  </para>
2036
1952
 
2037
1953
 
2038
- <sect3 id="alexandria-amazon-prefs">
2039
- <title>
2040
- Préférences pour <orgname>Amazon</orgname>
2041
- <!-- Amazon preferences-->
2042
- </title>
2043
- <para>
2044
- &app; peut télécharger les informations d&#8217;un livre à partir
2045
- de différents sites web d&#8217;<orgname>Amazon</orgname>.
2046
- Les sites actuellement supportés sont&nbsp;:
2047
- amazon.com (us), .ca, .co.uk (uk), .de, .fr et .jp.
2048
- Pour changer le site utilisé, sélectionnez
2049
- <guilabel>Amazon</guilabel> à partir de la liste des
2050
- fournisseurs et cliquez sur
2051
- <guibutton><accel>C</accel>onfigurer</guibutton>.
2052
- Ensuite choisissez dans le menu déroulant
2053
- <guilabel><accel>L</accel>angue</guilabel> le site
2054
- qui vous convient.
2055
- <!--&app; can download book information from different amazon
2056
- websites - currently, amazon.com, .co.uk, .de and .jp.
2057
- To change which site to use, select Amazon from the
2058
- Provider list, and click on <guibutton>Setup</guibutton>.
2059
- Then choose either <guilabel>UK, DE, JP</guilabel> or
2060
- <guilabel>US</guilabel> from the drop-down menu.-->
2061
- </para>
2062
-
2063
- <warning>
2064
- <para>
2065
- <guilabel><accel>J</accel>eton de développeur</guilabel>
2066
- et <guilabel><accel>I</accel>dentifiant d&#8217;associé</guilabel>
2067
- peuvent être changés si vous avez un compte de service web
2068
- d&#8217;<orgname>Amazon</orgname>. Vous pouvez obtenir
2069
- un compte à l&#8217;adresse
2070
- <ulink url="https://aws-portal.amazon.com/gp/aws/developer/registration/index.html/002-9602971-5248069">aws-portal.amazon.com</ulink>.
2071
- Si vous ne savez pas ce que cela signifie, alors vous pouvez
2072
- laisser ces champs tels quels.
2073
- <!--The <guilabel>Development token</guilabel> and
2074
- <guilabel>Associate ID</guilabel> can be changed if you
2075
- have an amazon web services account. You sign for an
2076
- Amazon Web Services account at
2077
- <ulink url="https://aws-portal.amazon.com/gp/aws/developer/registration/index.html/002-9602971-5248069">aws-portal.amazon.com</ulink>.
2078
- If you don&#8217;t know what this means, then you can leave
2079
- these values alone.-->
2080
- </para>
2081
- </warning>
2082
- </sect3>
2083
-
2084
-
2085
- <sect3 id="alexandria-proxis-prefs">
2086
- <title>
2087
- Préférences <orgname>Proxis</orgname>
2088
- <!--Proxis preferences-->
2089
- </title>
2090
- <para>
2091
- &app; peut chercher dans le site web de
2092
- <orgname>Proxis</orgname> pour des livres en
2093
- anglais (en), français (fr) ou néerlandais (nl). Pour changer
2094
- la langue utilisée, sélectionnez <guilabel>Proxis</guilabel>
2095
- dans la liste
2096
- <guilabel><accel>F</accel>ournisseurs</guilabel> et cliquez
2097
- sur <guibutton><accel>C</accel>onfigurer</guibutton>.
2098
- Ensuite, sélectionnez la langue dans le menu déroulant
2099
- <guilabel><accel>L</accel>angue</guilabel>.
2100
- <!--&app; can search the Proxis website for books in either
2101
- English, French or Dutch. To change which language to use,
2102
- select Proxis from the Provider list, and click on
2103
- <guibutton>Setup</guibutton>. Then chose either
2104
- <guilabel>en, fr</guilabel> or <guilabel>nl</guilabel> from
2105
- the drop-down menu.-->
2106
- </para>
2107
- </sect3>
2108
-
2109
1954
  <sect3 id="alexandria-britlib-prefs">
2110
1955
  <title>
2111
1956
  Préférences <orgname>Bibliothèque Britannique</orgname>
@@ -101,7 +101,7 @@
101
101
 
102
102
  <para>
103
103
  追加したい本のISBNが分からない場合には、本のタイトルや作者、キーワードを入力すると、
104
- &app; はAmazonなどのオンライン情報のプロバイダーから本を検索します。
104
+ &app; はオンライン情報のプロバイダーから本を検索します。
105
105
  リストに表示された検索結果から追加したい本を選択し、<guibutton>追加</guibutton>
106
106
  のボタンを押して選択したライブラリに本を追加できます。</para>
107
107
 
@@ -21,21 +21,6 @@
21
21
  オンラインの図書館や書店から本の情報(や本の表紙)を検索して表示できます。
22
22
  例として、
23
23
  <itemizedlist>
24
- <listitem>
25
- <para>
26
- <ulink url="http://www.amazon.com">Amazon</ulink>
27
- (amazon.comの他に .co.uk, .fr, .de, .ja, .caのウェブサイトを検索できます)
28
- </para>
29
- </listitem>
30
-
31
- <listitem>
32
- <para><ulink url="http://www.proxis.be">Proxis</ulink></para>
33
- </listitem>
34
-
35
- <listitem>
36
- <para><ulink url="http://www.barnesandnoble.com">Barnes and Noble</ulink></para>
37
- </listitem>
38
-
39
24
  <listitem>
40
25
  <para><ulink url="http://www.thalia.de">Thalia</ulink></para>
41
26
  </listitem>
@@ -87,15 +87,11 @@
87
87
  <!-- ========= Finding out more online =========== -->
88
88
  <section id="searching-more-online">
89
89
  <title>オンラインで本に関する詳細な情報を探すには</title>
90
- <para>もし本について詳細な情報を知りたければ、&app; はAmazonやBarnes and Noble
91
- などのオンライン情報プロバイダーのウェブページを開いて、その本に関する情報を直接得ることが
90
+ <para>もし本について詳細な情報を知りたければ、&app; は
91
+ オンライン情報プロバイダーのウェブページを開いて、その本に関する情報を直接得ることが
92
92
  出来ます。より詳しく知りたい本を選択して右クリックし、
93
- <guimenuitem>オンライン情報の表示</guimenuitem>を選択して、Amazonなどのプロバイダーを
93
+ <guimenuitem>オンライン情報の表示</guimenuitem>を選択して、プロバイダーを
94
94
  選択してください。</para>
95
- <tip>
96
- <para><menuchoice><guimenu>オンライン情報の表示</guimenu><guimenuitem>Amazon</guimenuitem></menuchoice>を選択した時は、<xref linkend="alexandria-amazon-prefs"/>で
97
- 設定した amazon.com, co.uk, .de, .jpのいずれかのサイトが選択されます。</para>
98
- </tip>
99
95
  <caution>
100
96
  <para>すべてのオンライン情報源が、本に関する完璧な情報を持っているわけではありません。
101
97
  欲しい情報を得るために、別のプロバイダーをいくつか試す必要があるかもしれません。</para>
@@ -37,10 +37,7 @@
37
37
  <guibutton>上へ</guibutton>と<guibutton>下へ</guibutton>のボタンを使って
38
38
  検索する情報源の順番を変えることができます。
39
39
  <itemizedlist>
40
- <listitem><para><xref linkend="alexandria-amazon-prefs"/></para></listitem>
41
- <listitem><para><xref linkend="alexandria-proxis-prefs"/></para></listitem>
42
40
  <listitem><para>スペイン文化省</para></listitem>
43
- <listitem><para>Barnes and Noble</para></listitem>
44
41
  <listitem><para>Amadeus Buch</para></listitem>
45
42
  <listitem><para>Internet Bookshop Italia</para></listitem>
46
43
  <listitem><para><xref linkend="alexandria-britlib-prefs"/></para></listitem>
@@ -55,30 +52,6 @@
55
52
  </para>
56
53
 
57
54
 
58
- <sect3 id="alexandria-amazon-prefs">
59
- <title>Amazonの設定</title>
60
- <para>&app; はいくつかの異なるAmazonのサイトから本の情報をダウンロード出来ます。
61
- 現時点では、amazon.com, .co.uk, .de, .jp, .fr, .ca です。使用するサイトを
62
- 変更するには、プロバイダーの一覧からAmazonを選択し、<guibutton>セットアップ</guibutton>
63
- をクリックします。次にドロップダウンメニューから<guilabel>UK, DE, JP, FR, CA, US</guilabel>
64
- のいずれかを選択します。</para>
65
- <warning>
66
- <para><guilabel>デベロッパートークン</guilabel>と <guilabel>アソシエイトID</guilabel>は、もしあなたがAmazonのウェブサービスアカウントを持っていればそれに変更できます。
67
- <ulink url="https://aws-portal.amazon.com/gp/aws/developer/registration/index.html/002-9602971-5248069">aws-portal.amazon.com</ulink>でAmazon
68
- ウェブサービスアカウントのサインアップをしてください。もしこの意味が分からなければ、
69
- 変更せずにデフォルトのままにしておいてください。</para>
70
- </warning>
71
- </sect3>
72
-
73
-
74
- <sect3 id="alexandria-proxis-prefs">
75
- <title>Proxisの設定</title>
76
- <para>&app; は Proxisのウェブサイトで英語またはフランス語、またはオランダ語で
77
- 本を検索できます。どの言語で検索するかを選択するには、プロバイダーの一覧からProxisを
78
- 選択し、<guibutton>セットアップ</guibutton>をクリックします。次にドロップダウンメニュー
79
- から<guilabel>en, fr, nl</guilabel>のいずれかを選択します。</para>
80
- </sect3>
81
-
82
55
  <sect3 id="alexandria-britlib-prefs">
83
56
  <title>大英図書館の設定</title>
84
57
  <para>大英図書館のアカウントを持っているなら、ダイアログでz39.50サービス用の
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is part of Alexandria.
4
+ #
5
+ # See the file README.md for authorship and licensing information.
6
+
7
+ require "spec_helper"
8
+
9
+ describe Alexandria::BookProviders::BLProvider do
10
+ it "works" do
11
+ assert_correct_search_result(described_class, "9781853260803")
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is part of Alexandria.
4
+ #
5
+ # See the file README.md for authorship and licensing information.
6
+
7
+ require "spec_helper"
8
+
9
+ describe Alexandria::BookProviders::LOCProvider do
10
+ it "works for a book with ASCII title" do
11
+ assert_correct_search_result(described_class, "9780805335583")
12
+ end
13
+
14
+ it "works for a book with a title with non-ASCII letters" do
15
+ assert_correct_search_result(described_class, "9782070379248")
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is part of Alexandria.
4
+ #
5
+ # See the file README.md for authorship and licensing information.
6
+
7
+ require "spec_helper"
8
+
9
+ describe Alexandria::BookProviders::SBNProvider do
10
+ it "works" do
11
+ assert_correct_search_result(described_class, "9788835926436")
12
+ end
13
+ end
@@ -8,85 +8,4 @@ require "spec_helper"
8
8
 
9
9
  describe Alexandria::BookProviders do
10
10
  it "should be less clever"
11
-
12
- describe Alexandria::BookProviders::AmazonProvider do
13
- before do
14
- skip "Amazon requires an API key. Remove it altogether as a provider?"
15
- end
16
-
17
- it "does not piss off Rich Burridge" do
18
- assert_correct_search_result(described_class, "033025068X")
19
- end
20
-
21
- it "works" do
22
- assert_correct_search_result(described_class, "9780385504201")
23
- end
24
-
25
- it "works when searching for title" do
26
- assert_correct_search_result(described_class, "A Confederacy of Dunces",
27
- Alexandria::BookProviders::SEARCH_BY_TITLE)
28
- end
29
-
30
- it "amazon authors should work" do
31
- assert_correct_search_result(described_class, "John Kennedy Toole",
32
- Alexandria::BookProviders::SEARCH_BY_AUTHORS)
33
- end
34
-
35
- it "amazon keyword should work" do
36
- assert_correct_search_result(described_class, "Confederacy Dunces",
37
- Alexandria::BookProviders::SEARCH_BY_KEYWORD)
38
- end
39
- end
40
-
41
- describe Alexandria::BookProviders::LOCProvider do
42
- it "works for a book with ASCII title" do
43
- assert_correct_search_result(described_class, "9780805335583")
44
- end
45
-
46
- it "works for a book with a title with non-ASCII letters" do
47
- assert_correct_search_result(described_class, "9782070379248")
48
- end
49
- end
50
-
51
- describe Alexandria::BookProviders::BLProvider do
52
- it "works" do
53
- skip "Not working: connect failed"
54
- assert_correct_search_result(described_class, "9781853260803")
55
- end
56
- end
57
-
58
- describe Alexandria::BookProviders::SBNProvider do
59
- it "works" do
60
- assert_correct_search_result(described_class, "9788835926436")
61
- end
62
- end
63
-
64
- describe Alexandria::BookProviders::BarnesAndNobleProvider do
65
- it "works" do
66
- skip "Barnes and Noble is not operational at the moment"
67
- assert_correct_search_result(described_class, "9780961328917") # see #1433
68
- end
69
- end
70
-
71
- describe Alexandria::BookProviders::ProxisProvider do
72
- it "works" do
73
- skip "Needs fixing"
74
- assert_correct_search_result(described_class, "9789026965746")
75
- assert_correct_search_result(described_class, "9780586071403")
76
- end
77
- end
78
-
79
- describe Alexandria::BookProviders::AdLibrisProvider do
80
- it "works" do
81
- skip "Needs fixing: site has changed"
82
- assert_correct_search_result(described_class, "9789100109332")
83
- end
84
- end
85
-
86
- describe Alexandria::BookProviders::SicilianoProvider do
87
- it "works" do
88
- skip "Needs fixing: no results found"
89
- assert_correct_search_result(described_class, "9788599170380")
90
- end
91
- end
92
11
  end
@@ -150,7 +150,7 @@ describe Alexandria::Library do
150
150
  # Guide to LaTeX
151
151
  latex_book = my_library.find { |b| b.title.include? "Latex" }
152
152
  expect(latex_book.isbn).to eq("9780201398250")
153
- expect(latex_book.publisher).to eq("Addison Wesley") # note, no Ruby-Amazon cruft
153
+ expect(latex_book.publisher).to eq("Addison Wesley")
154
154
  end
155
155
  end
156
156
 
@@ -176,7 +176,7 @@ describe Alexandria::Library do
176
176
  # Guide to LaTeX
177
177
  latex_book = my_library.find { |b| b.title.include? "Latex" }
178
178
  expect(latex_book.isbn).to eq("9780201398250")
179
- expect(latex_book.publisher).to eq("Addison Wesley") # note, no Ruby-Amazon cruft
179
+ expect(latex_book.publisher).to eq("Addison Wesley")
180
180
  expect(latex_book.version).to eq(Alexandria::DATA_VERSION)
181
181
  end
182
182
 
@@ -231,4 +231,22 @@ describe Alexandria::Library do
231
231
  end
232
232
  end
233
233
  end
234
+
235
+ describe "#name=" do
236
+ let(:my_library) { loader.load_library("Empty") }
237
+
238
+ before do
239
+ FileUtils.mkdir(TESTDIR) unless File.exist? TESTDIR
240
+ end
241
+
242
+ it "changes the library's name" do
243
+ my_library.name = "Really Empty"
244
+ expect(my_library.name).to eq "Really Empty"
245
+ end
246
+
247
+ it "moves the library's directory" do
248
+ my_library.name = "Really Empty"
249
+ expect(File.exist?(File.join(TESTDIR, "Really Empty"))).to be_truthy
250
+ end
251
+ end
234
252
  end
@@ -32,7 +32,7 @@ describe Alexandria::UI::ImportDialog do
32
32
 
33
33
  it "works when response is cancel" do
34
34
  allow(chooser).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
35
- import_dialog.acquire {}
35
+ import_dialog.acquire { nil }
36
36
  end
37
37
 
38
38
  it "works when response is OK" do
@@ -26,7 +26,7 @@ describe Alexandria::UI::NewSmartLibraryDialog do
26
26
  allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
27
27
 
28
28
  # Make sure entered rule is valid
29
- rules_box = properties_dialog.instance_variable_get("@rules_box")
29
+ rules_box = properties_dialog.instance_variable_get(:@rules_box)
30
30
  entry = rules_box.children.first.children[2]
31
31
  entry.text = "foo"
32
32
 
@@ -9,6 +9,6 @@ require_relative "../../spec_helper"
9
9
  describe Alexandria::UI::PreferencesDialog do
10
10
  it "works" do
11
11
  parent = Gtk::Window.new :toplevel
12
- described_class.new(parent) {}
12
+ described_class.new(parent) { nil }
13
13
  end
14
14
  end
@@ -16,7 +16,7 @@ describe Alexandria::UI::UIManager do
16
16
  describe "#on_new" do
17
17
  it "works" do
18
18
  ui = described_class.new main_app
19
- libraries = ui.instance_variable_get("@libraries")
19
+ libraries = ui.instance_variable_get(:@libraries)
20
20
  libraries_count = libraries.all_libraries.count
21
21
  ui.on_new
22
22
  expect(libraries.all_libraries.count).to eq libraries_count + 1
@@ -26,7 +26,7 @@ describe Alexandria::UI::UIManager do
26
26
  describe "#on_books_selection_changed" do
27
27
  let(:lib_version) { File.join(LIBDIR, "0.6.2") }
28
28
  let(:ui) { described_class.new main_app }
29
- let(:libraries) { ui.instance_variable_get("@libraries") }
29
+ let(:libraries) { ui.instance_variable_get(:@libraries) }
30
30
  let(:regular_library) { libraries.all_regular_libraries.last }
31
31
 
32
32
  before do
@@ -49,4 +49,80 @@ describe Alexandria::UI::UIManager do
49
49
  expect(ui.iconview.selected_items).not_to be_empty
50
50
  end
51
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
52
128
  end
@@ -18,3 +18,5 @@ tags: []
18
18
  title: An Artist of the Floating World
19
19
  version: 0.6.2b1
20
20
  want: true
21
+ library: !ruby/array:Alexandria:Library
22
+ internal: []
@@ -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..-1]
185
+ libpart = ruby_libdir[ruby_prefix.size..]
186
186
  @rubylib = File.join(@prefix, libpart)
187
187
  else
188
188
  @rubylib = ruby_libdir
@@ -193,9 +193,9 @@ class FileInstallTask < Rake::TaskLib
193
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})/
@@ -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 = IO.read(t.source)
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 }