alexandria-book-collection-manager 0.7.8 → 0.7.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +48 -53
  3. data/.rubocop.yml +18 -5
  4. data/.rubocop_todo.yml +31 -37
  5. data/.simplecov +2 -2
  6. data/CHANGELOG.md +37 -0
  7. data/ChangeLog.0 +19 -19
  8. data/INSTALL.md +3 -5
  9. data/README.md +0 -5
  10. data/Rakefile +14 -14
  11. data/alexandria-book-collection-manager.gemspec +35 -34
  12. data/doc/FAQ +2 -2
  13. data/lib/alexandria/about.rb +1 -1
  14. data/lib/alexandria/book_providers/bl_provider.rb +88 -0
  15. data/lib/alexandria/book_providers/loc_provider.rb +38 -0
  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/console.rb +2 -2
  23. data/lib/alexandria/default_preferences.rb +1 -1
  24. data/lib/alexandria/export_library.rb +14 -14
  25. data/lib/alexandria/image_fetcher.rb +25 -0
  26. data/lib/alexandria/import_library.rb +10 -10
  27. data/lib/alexandria/library_store.rb +4 -5
  28. data/lib/alexandria/models/book.rb +13 -0
  29. data/lib/alexandria/models/library.rb +15 -23
  30. data/lib/alexandria/preferences.rb +4 -6
  31. data/lib/alexandria/{book_providers/pseudomarc.rb → pseudo_marc_parser.rb} +2 -2
  32. data/lib/alexandria/scanners/cue_cat.rb +1 -1
  33. data/lib/alexandria/smart_library.rb +2 -2
  34. data/lib/alexandria/ui/about_dialog.rb +1 -1
  35. data/lib/alexandria/ui/acquire_dialog.rb +6 -9
  36. data/lib/alexandria/ui/alert_dialog.rb +2 -2
  37. data/lib/alexandria/ui/barcode_animation.rb +1 -1
  38. data/lib/alexandria/ui/book_properties_dialog_base.rb +5 -9
  39. data/lib/alexandria/ui/completion_models.rb +1 -5
  40. data/lib/alexandria/ui/conflict_while_copying_dialog.rb +1 -1
  41. data/lib/alexandria/ui/icons.rb +2 -2
  42. data/lib/alexandria/ui/init.rb +10 -4
  43. data/lib/alexandria/ui/listview.rb +1 -1
  44. data/lib/alexandria/ui/multi_drag_treeview.rb +1 -1
  45. data/lib/alexandria/ui/new_book_dialog.rb +11 -13
  46. data/lib/alexandria/ui/new_book_dialog_manual.rb +1 -1
  47. data/lib/alexandria/ui/preferences_dialog.rb +2 -2
  48. data/lib/alexandria/ui/provider_preferences_base_dialog.rb +1 -1
  49. data/lib/alexandria/ui/really_delete_dialog.rb +1 -1
  50. data/lib/alexandria/ui/ui_manager.rb +17 -25
  51. data/lib/alexandria/version.rb +1 -1
  52. data/lib/alexandria/web_themes.rb +1 -1
  53. data/lib/alexandria.rb +6 -5
  54. data/po/cs.po +90 -125
  55. data/po/cy.po +87 -125
  56. data/po/de.po +96 -125
  57. data/po/el.po +96 -125
  58. data/po/es.po +96 -125
  59. data/po/fr.po +90 -125
  60. data/po/ga.po +83 -124
  61. data/po/gl.po +90 -125
  62. data/po/it.po +90 -125
  63. data/po/ja.po +90 -125
  64. data/po/mk.po +96 -125
  65. data/po/nb.po +90 -125
  66. data/po/nl.po +107 -124
  67. data/po/pl.po +113 -124
  68. data/po/pt.po +90 -125
  69. data/po/pt_BR.po +90 -125
  70. data/po/ru.po +92 -124
  71. data/po/sk.po +90 -125
  72. data/po/sv.po +90 -125
  73. data/po/uk.po +90 -125
  74. data/po/zh_TW.po +90 -125
  75. data/schemas/alexandria.schemas +1 -1
  76. data/share/gnome/help/alexandria/C/adding-books.xml +3 -4
  77. data/share/gnome/help/alexandria/C/introduction.xml +0 -16
  78. data/share/gnome/help/alexandria/C/searching.xml +1 -4
  79. data/share/gnome/help/alexandria/C/settings.xml +0 -30
  80. data/share/gnome/help/alexandria/fr/alexandria.xml +4 -159
  81. data/share/gnome/help/alexandria/ja/adding-books.xml +1 -1
  82. data/share/gnome/help/alexandria/ja/introduction.xml +0 -15
  83. data/share/gnome/help/alexandria/ja/searching.xml +3 -7
  84. data/share/gnome/help/alexandria/ja/settings.xml +0 -27
  85. data/spec/alexandria/book_providers/bl_provider_spec.rb +13 -0
  86. data/spec/alexandria/book_providers/loc_provider_spec.rb +17 -0
  87. data/spec/alexandria/book_providers/sbn_provider_spec.rb +13 -0
  88. data/spec/alexandria/book_providers/thalia_provider_spec.rb +1 -1
  89. data/spec/alexandria/book_providers/world_cat_provider_spec.rb +22 -10
  90. data/spec/alexandria/book_providers_spec.rb +0 -81
  91. data/spec/alexandria/book_spec.rb +5 -3
  92. data/spec/alexandria/export_library_spec.rb +8 -8
  93. data/spec/alexandria/library_spec.rb +83 -51
  94. data/spec/alexandria/library_store_spec.rb +1 -1
  95. data/spec/alexandria/preferences_spec.rb +7 -7
  96. data/spec/alexandria/pseudo_marc_parser_spec.rb +71 -0
  97. data/spec/alexandria/scanners/cue_cat_spec.rb +11 -4
  98. data/spec/alexandria/smart_library_spec.rb +7 -5
  99. data/spec/alexandria/ui/about_dialog_spec.rb +1 -1
  100. data/spec/alexandria/ui/acquire_dialog_spec.rb +1 -1
  101. data/spec/alexandria/ui/alert_dialog_spec.rb +5 -3
  102. data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +1 -1
  103. data/spec/alexandria/ui/book_properties_dialog_spec.rb +4 -4
  104. data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +18 -2
  105. data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +1 -1
  106. data/spec/alexandria/ui/error_dialog_spec.rb +13 -2
  107. data/spec/alexandria/ui/export_dialog_spec.rb +3 -3
  108. data/spec/alexandria/ui/iconview_spec.rb +1 -1
  109. data/spec/alexandria/ui/import_dialog_spec.rb +3 -3
  110. data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +1 -1
  111. data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +4 -4
  112. data/spec/alexandria/ui/new_book_dialog_spec.rb +2 -2
  113. data/spec/alexandria/ui/new_provider_dialog_spec.rb +3 -3
  114. data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +9 -7
  115. data/spec/alexandria/ui/preferences_dialog_spec.rb +1 -1
  116. data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +2 -2
  117. data/spec/alexandria/ui/really_delete_dialog_spec.rb +1 -1
  118. data/spec/alexandria/ui/sidepane_manager_spec.rb +1 -1
  119. data/spec/alexandria/ui/skip_entry_dialog_spec.rb +18 -2
  120. data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +2 -2
  121. data/spec/alexandria/ui/ui_manager_spec.rb +83 -5
  122. data/spec/data/libraries/0.6.2/My Library/9780571147168.yaml +2 -0
  123. data/spec/spec_helper.rb +23 -32
  124. data/util/rake/fileinstall.rb +12 -12
  125. data/util/rake/gettextgenerate.rb +1 -1
  126. data/util/rake/omfgenerate.rb +1 -1
  127. metadata +73 -58
  128. data/lib/alexandria/book_providers/adlibris.rb +0 -191
  129. data/lib/alexandria/book_providers/amazon_aws.rb +0 -239
  130. data/lib/alexandria/book_providers/amazon_ecs_util.rb +0 -373
  131. data/lib/alexandria/book_providers/barnes_and_noble.rb +0 -209
  132. data/lib/alexandria/book_providers/proxis.rb +0 -176
  133. data/lib/alexandria/book_providers/siciliano.rb +0 -256
  134. data/lib/alexandria/book_providers/z3950.rb +0 -408
@@ -10,7 +10,7 @@ describe Alexandria::UI::NewProviderDialog do
10
10
  let(:parent) { Gtk::Window.new :toplevel }
11
11
 
12
12
  it "can be instantiated" do
13
- described_class.new parent
13
+ expect { described_class.new parent }.not_to raise_error
14
14
  end
15
15
 
16
16
  describe "#acquire" do
@@ -19,12 +19,12 @@ describe Alexandria::UI::NewProviderDialog do
19
19
 
20
20
  it "works when response is cancel" do
21
21
  allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
22
- provider_dialog.acquire
22
+ expect { provider_dialog.acquire }.not_to raise_error
23
23
  end
24
24
 
25
25
  it "works when response is accept" do
26
26
  allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::ACCEPT)
27
- provider_dialog.acquire
27
+ expect { provider_dialog.acquire }.not_to raise_error
28
28
  end
29
29
  end
30
30
  end
@@ -10,30 +10,32 @@ describe Alexandria::UI::NewSmartLibraryDialog do
10
10
  let(:parent) { Gtk::Window.new :toplevel }
11
11
 
12
12
  it "can be instantiated" do
13
- described_class.new parent
13
+ expect { described_class.new parent }.not_to raise_error
14
14
  end
15
15
 
16
16
  describe "#acquire" do
17
17
  let(:properties_dialog) { described_class.new parent }
18
18
  let(:gtk_dialog) { properties_dialog.dialog }
19
+ let(:rules_box) { properties_dialog.instance_variable_get(:@rules_box) }
20
+ let(:rule_entry) { rules_box.children.first.children[2] }
19
21
 
20
22
  it "works when response is cancel" do
21
23
  allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
22
- properties_dialog.acquire
24
+ expect { properties_dialog.acquire }.not_to raise_error
23
25
  end
24
26
 
25
27
  it "returns a smart library that can be saved when response is ok" do
26
28
  allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
27
29
 
28
30
  # Make sure entered rule is valid
29
- rules_box = properties_dialog.instance_variable_get("@rules_box")
30
- entry = rules_box.children.first.children[2]
31
- entry.text = "foo"
31
+ rule_entry.text = "foo"
32
32
 
33
33
  result = properties_dialog.acquire
34
34
 
35
- expect(result).to be_a Alexandria::SmartLibrary
36
- expect { result.save }.not_to raise_error
35
+ aggregate_failures do
36
+ expect(result).to be_a Alexandria::SmartLibrary
37
+ expect { result.save }.not_to raise_error
38
+ end
37
39
  end
38
40
  end
39
41
  end
@@ -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
+ expect { described_class.new(parent) { nil } }.not_to raise_error
13
13
  end
14
14
  end
@@ -19,7 +19,7 @@ describe Alexandria::UI::ProviderPreferencesDialog do
19
19
  end
20
20
 
21
21
  it "can be instantiated" do
22
- described_class.new parent, provider
22
+ expect { described_class.new parent, provider }.not_to raise_error
23
23
  end
24
24
 
25
25
  describe "#acquire" do
@@ -28,7 +28,7 @@ describe Alexandria::UI::ProviderPreferencesDialog do
28
28
  gtk_dialog = preferences_dialog.dialog
29
29
  allow(gtk_dialog).to receive(:run)
30
30
 
31
- preferences_dialog.acquire
31
+ expect { preferences_dialog.acquire }.not_to raise_error
32
32
  end
33
33
  end
34
34
  end
@@ -11,6 +11,6 @@ describe Alexandria::UI::ReallyDeleteDialog do
11
11
  library = instance_double(Alexandria::Library,
12
12
  name: "Bar Library", empty?: false, size: 12)
13
13
  parent = Gtk::Window.new :toplevel
14
- described_class.new parent, library
14
+ expect { described_class.new parent, library }.not_to raise_error
15
15
  end
16
16
  end
@@ -10,6 +10,6 @@ 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)
13
- described_class.new library_listview, parent
13
+ expect { described_class.new library_listview, parent }.not_to raise_error
14
14
  end
15
15
  end
@@ -7,8 +7,24 @@
7
7
  require_relative "../../spec_helper"
8
8
 
9
9
  describe Alexandria::UI::SkipEntryDialog do
10
+ let(:parent) { Gtk::Window.new :toplevel }
11
+
10
12
  it "works" do
11
- parent = Gtk::Window.new :toplevel
12
- described_class.new parent, "Foo"
13
+ expect { described_class.new parent, "Foo" }.not_to raise_error
14
+ end
15
+
16
+ describe "continue?" do
17
+ let(:instance) { described_class.new parent, "Foo" }
18
+ let(:dialog) { instance.dialog }
19
+
20
+ it "returns false when response is cancel" do
21
+ allow(dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
22
+ expect(instance.continue?).to be false
23
+ end
24
+
25
+ it "returns true when response is OK" do
26
+ allow(dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
27
+ expect(instance.continue?).to be true
28
+ end
13
29
  end
14
30
  end
@@ -18,12 +18,12 @@ describe Alexandria::UI::SmartLibraryPropertiesDialog do
18
18
  describe "#acquire" do
19
19
  it "works when response is cancel" do
20
20
  allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::CANCEL)
21
- properties_dialog.acquire
21
+ expect { properties_dialog.acquire }.not_to raise_error
22
22
  end
23
23
 
24
24
  it "works when response is ok" do
25
25
  allow(gtk_dialog).to receive(:run).and_return(Gtk::ResponseType::OK)
26
- properties_dialog.acquire
26
+ expect { properties_dialog.acquire }.not_to raise_error
27
27
  end
28
28
  end
29
29
 
@@ -10,13 +10,13 @@ describe Alexandria::UI::UIManager do
10
10
  let(:main_app) { instance_double(Alexandria::UI::MainApp) }
11
11
 
12
12
  it "works" do
13
- described_class.new main_app
13
+ expect { described_class.new main_app }.not_to raise_error
14
14
  end
15
15
 
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
@@ -41,12 +41,90 @@ describe Alexandria::UI::UIManager do
41
41
  regular_library.each { |book| ui.append_book book }
42
42
  # This makes the iconview model re-appear
43
43
  ui.iconview.unfreeze
44
- expect(ui.model.iter_n_children).to eq regular_library.count
45
44
 
46
45
  # This triggers the #on_books_selection_changed callback
47
46
  ui.select_a_book regular_library.first
48
47
 
49
- expect(ui.iconview.selected_items).not_to be_empty
48
+ aggregate_failures do
49
+ expect(ui.model.iter_n_children).to eq regular_library.count
50
+ expect(ui.iconview.selected_items).not_to be_empty
51
+ end
52
+ end
53
+ end
54
+
55
+ describe "#select_a_book" do
56
+ let(:ui) { described_class.new main_app }
57
+ let(:libraries) { ui.instance_variable_get(:@libraries) }
58
+ let(:filter_entry) { ui.instance_variable_get(:@filter_entry) }
59
+ let(:regular_library) { libraries.all_regular_libraries.last }
60
+
61
+ before do
62
+ lib_version = File.join(LIBDIR, "0.6.2")
63
+ FileUtils.cp_r(lib_version, TESTDIR)
64
+
65
+ ui.select_a_library regular_library
66
+ # Make books appear in the view
67
+ regular_library.each { |book| ui.append_book book }
68
+ end
69
+
70
+ context "when selecting in the icon view" do
71
+ before do
72
+ # Make view model re-appear
73
+ ui.iconview.unfreeze
74
+ end
75
+
76
+ it "selects book if it is in view" do
77
+ ui.select_a_book regular_library.first
78
+
79
+ selected = ui.iconview.selected_items
80
+ expect(selected.count).to eq 1
81
+ end
82
+
83
+ it "selects nothing if book is not in view due to a filter" do
84
+ filter_entry.text = regular_library.last.title
85
+ ui.filtered_model.refilter
86
+
87
+ ui.select_a_book regular_library.first
88
+
89
+ selected = ui.iconview.selected_items
90
+ expect(selected.count).to eq 0
91
+ end
92
+ end
93
+
94
+ context "when selecting in the list view" do
95
+ before do
96
+ # Make view model re-appear
97
+ ui.listview.unfreeze
98
+ end
99
+
100
+ it "selects book if it is in view" do
101
+ ui.select_a_book regular_library.first
102
+
103
+ selected, _model = ui.listview.selection.selected_rows
104
+ expect(selected.count).to eq 1
105
+ end
106
+
107
+ it "selects nothing if book is not in view due to a filter" do
108
+ filter_entry.text = regular_library.last.title
109
+ ui.filtered_model.refilter
110
+
111
+ ui.select_a_book regular_library.first
112
+
113
+ selected = ui.listview.selection.to_a
114
+ expect(selected).to be_empty
115
+ end
116
+
117
+ it "selects nothing if a new book is not in view due to a filter" do
118
+ filter_entry.text = regular_library.last.title
119
+ ui.filtered_model.refilter
120
+
121
+ book = an_artist_of_the_floating_world
122
+ ui.append_book book
123
+ ui.select_a_book book
124
+
125
+ selected = ui.listview.selection.to_a
126
+ expect(selected).to be_empty
127
+ end
50
128
  end
51
129
  end
52
130
  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: []
data/spec/spec_helper.rb CHANGED
@@ -20,45 +20,36 @@ def an_artist_of_the_floating_world
20
20
  "Paperback")
21
21
  end
22
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}"
23
+ RSpec::Matchers.define :have_correct_search_result_for do |query|
24
+ match(notify_expectation_failures: true) do |provider|
25
+ begin
26
+ results = provider.instance.search(query, Alexandria::BookProviders::SEARCH_BY_ISBN)
27
+ rescue SocketError
28
+ skip "Service is offline"
29
+ end
33
30
 
34
- if search_type == Alexandria::BookProviders::SEARCH_BY_ISBN
35
- expect(results.length).to be <= 2, "Results are greater than 2 for #{provider}"
31
+ expect(results).to be_instance_of(Array)
32
+ expect(results).not_to be_empty
33
+ expect(results.length).to be <= 2
36
34
 
37
- book = results.first
35
+ book, cover_url = *results
38
36
 
39
- expect(book).to be_instance_of(Alexandria::Book),
40
- "Result is not a Book for #{provider}"
37
+ expect(book).to be_instance_of(Alexandria::Book)
41
38
 
42
39
  canonical_query = Alexandria::Library.canonicalise_ean(query)
43
40
  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}"
41
+ expect(canonical_query).to eq(canonical_result)
42
+
43
+ expect(cover_url).to be_instance_of(String) if cover_url
44
+
45
+ true
46
+ end
47
+ end
48
+
49
+ RSpec::Matchers.define :be_an_existing_file do
50
+ match do |filename|
51
+ File.exist? filename
60
52
  end
61
- results
62
53
  end
63
54
 
64
55
  Alexandria::UI::Icons.init
@@ -171,18 +171,18 @@ class FileInstallTask < Rake::TaskLib
171
171
  def calculate_ruby_dir
172
172
  ruby_prefix = RbConfig::CONFIG["prefix"]
173
173
 
174
- ruby_libdir = if @install_to_rubylibdir
175
- RbConfig::CONFIG["rubylibdir"]
176
- else
177
- RbConfig::CONFIG["sitelibdir"]
178
- end
179
- ruby_libdir = ENV["RUBYLIBDIR"] if ENV.key?("RUBYLIBDIR")
180
-
181
- @prefix = ENV["PREFIX"] || ruby_prefix
174
+ ruby_libdir = ENV.fetch("RUBYLIBDIR", nil)
175
+ ruby_libdir ||= if @install_to_rubylibdir
176
+ RbConfig::CONFIG["rubylibdir"]
177
+ else
178
+ RbConfig::CONFIG["sitelibdir"]
179
+ end
180
+
181
+ @prefix = ENV.fetch("PREFIX", ruby_prefix)
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})/
@@ -54,7 +54,7 @@ class GettextGenerateTask < Rake::TaskLib
54
54
  # create MO files
55
55
  rule(/\.mo$/ => [->(dest) { source_file(dest) }]) do |t|
56
56
  dest_dir = File.dirname(t.name)
57
- FileUtils.makedirs(dest_dir) unless FileTest.exists?(dest_dir)
57
+ FileUtils.makedirs(dest_dir)
58
58
  puts "Generating #{t.name}"
59
59
  result = system("msgfmt #{t.source} -o #{t.name}")
60
60
  raise "msgfmt failed for #{t.source}" unless result
@@ -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 }