alexandria-book-collection-manager 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +28 -25
- data/.rubocop_todo.yml +87 -67
- data/CHANGELOG.md +12 -1
- data/Gemfile +4 -3
- data/README.md +16 -6
- data/Rakefile +71 -72
- data/alexandria-book-collection-manager.gemspec +44 -44
- data/bin/alexandria +12 -12
- data/lib/alexandria.rb +22 -22
- data/lib/alexandria/about.rb +50 -50
- data/lib/alexandria/book_providers.rb +50 -50
- data/lib/alexandria/book_providers/adlibris.rb +28 -44
- data/lib/alexandria/book_providers/amazon_aws.rb +64 -64
- data/lib/alexandria/book_providers/amazon_ecs_util.rb +52 -78
- data/lib/alexandria/book_providers/barnes_and_noble.rb +34 -34
- data/lib/alexandria/book_providers/douban.rb +21 -37
- data/lib/alexandria/book_providers/proxis.rb +24 -24
- data/lib/alexandria/book_providers/pseudomarc.rb +19 -19
- data/lib/alexandria/book_providers/renaud.rb +44 -57
- data/lib/alexandria/book_providers/siciliano.rb +39 -39
- data/lib/alexandria/book_providers/thalia.rb +33 -33
- data/lib/alexandria/book_providers/web.rb +5 -5
- data/lib/alexandria/book_providers/worldcat.rb +44 -69
- data/lib/alexandria/book_providers/z3950.rb +94 -109
- data/lib/alexandria/config.rb +1 -1
- data/lib/alexandria/console.rb +3 -3
- data/lib/alexandria/export_format.rb +8 -8
- data/lib/alexandria/export_library.rb +112 -113
- data/lib/alexandria/import_library.rb +45 -45
- data/lib/alexandria/import_library_csv.rb +30 -30
- data/lib/alexandria/library_collection.rb +4 -4
- data/lib/alexandria/library_sort_order.rb +1 -1
- data/lib/alexandria/library_store.rb +14 -14
- data/lib/alexandria/logging.rb +5 -5
- data/lib/alexandria/models/book.rb +1 -1
- data/lib/alexandria/models/library.rb +36 -36
- data/lib/alexandria/net.rb +5 -5
- data/lib/alexandria/preferences.rb +32 -32
- data/lib/alexandria/scanners/{cuecat.rb → cue_cat.rb} +13 -13
- data/lib/alexandria/scanners/keyboard.rb +5 -5
- data/lib/alexandria/smart_library.rb +53 -53
- data/lib/alexandria/ui.rb +15 -15
- data/lib/alexandria/ui/{dialogs/about_dialog.rb → about_dialog.rb} +1 -1
- data/lib/alexandria/ui/{dialogs/acquire_dialog.rb → acquire_dialog.rb} +66 -65
- data/lib/alexandria/ui/{dialogs/alert_dialog.rb → alert_dialog.rb} +1 -16
- data/lib/alexandria/ui/{dialogs/bad_isbns_dialog.rb → bad_isbns_dialog.rb} +0 -0
- data/lib/alexandria/ui/{dialogs/barcode_animation.rb → barcode_animation.rb} +7 -7
- data/lib/alexandria/ui/{dialogs/book_properties_dialog.rb → book_properties_dialog.rb} +25 -37
- data/lib/alexandria/ui/{dialogs/book_properties_dialog_base.rb → book_properties_dialog_base.rb} +38 -37
- data/lib/alexandria/ui/builder_base.rb +1 -1
- data/lib/alexandria/ui/callbacks.rb +95 -91
- data/lib/alexandria/ui/completion_models.rb +7 -21
- data/lib/alexandria/ui/confirm_erase_dialog.rb +33 -0
- data/lib/alexandria/ui/conflict_while_copying_dialog.rb +34 -0
- data/lib/alexandria/ui/dndable.rb +7 -7
- data/lib/alexandria/ui/error_dialog.rb +25 -0
- data/lib/alexandria/ui/{dialogs/export_dialog.rb → export_dialog.rb} +22 -42
- data/lib/alexandria/ui/icons.rb +6 -6
- data/lib/alexandria/ui/iconview.rb +7 -7
- data/lib/alexandria/ui/iconview_tooltips.rb +6 -6
- data/lib/alexandria/ui/{dialogs/import_dialog.rb → import_dialog.rb} +14 -32
- data/lib/alexandria/ui/init.rb +16 -29
- data/lib/alexandria/ui/{dialogs/keep_bad_isbn_dialog.rb → keep_bad_isbn_dialog.rb} +6 -4
- data/lib/alexandria/ui/libraries_combo.rb +7 -7
- data/lib/alexandria/ui/listview.rb +40 -40
- data/lib/alexandria/ui/main_app.rb +22 -24
- data/lib/alexandria/ui/misc_dialogs.rb +10 -0
- data/lib/alexandria/ui/multi_drag_treeview.rb +4 -4
- data/lib/alexandria/ui/{dialogs/new_book_dialog.rb → new_book_dialog.rb} +46 -45
- data/lib/alexandria/ui/{dialogs/new_book_dialog_manual.rb → new_book_dialog_manual.rb} +20 -19
- data/lib/alexandria/ui/new_provider_dialog.rb +99 -0
- data/lib/alexandria/ui/{dialogs/new_smart_library_dialog.rb → new_smart_library_dialog.rb} +4 -4
- data/lib/alexandria/ui/{dialogs/preferences_dialog.rb → preferences_dialog.rb} +44 -235
- data/lib/alexandria/ui/provider_preferences_base_dialog.rb +90 -0
- data/lib/alexandria/ui/provider_preferences_dialog.rb +35 -0
- data/lib/alexandria/ui/{dialogs/misc_dialogs.rb → really_delete_dialog.rb} +6 -27
- data/lib/alexandria/ui/{sidepane.rb → sidepane_manager.rb} +27 -25
- data/lib/alexandria/ui/skip_entry_dialog.rb +32 -0
- data/lib/alexandria/ui/{dialogs/smart_library_properties_dialog.rb → smart_library_properties_dialog.rb} +2 -2
- data/lib/alexandria/ui/{dialogs/smart_library_properties_dialog_base.rb → smart_library_properties_dialog_base.rb} +30 -30
- data/lib/alexandria/ui/sound.rb +8 -8
- data/lib/alexandria/ui/ui_manager.rb +136 -135
- data/lib/alexandria/version.rb +4 -19
- data/lib/alexandria/web_themes.rb +8 -8
- data/po/cs.po +97 -97
- data/po/cy.po +97 -97
- data/po/de.po +97 -97
- data/po/el.po +97 -97
- data/po/es.po +97 -97
- data/po/fr.po +97 -97
- data/po/ga.po +97 -97
- data/po/gl.po +97 -97
- data/po/it.po +97 -97
- data/po/ja.po +97 -97
- data/po/mk.po +97 -97
- data/po/nb.po +97 -97
- data/po/nl.po +97 -97
- data/po/pl.po +97 -97
- data/po/pt.po +97 -97
- data/po/pt_BR.po +97 -97
- data/po/ru.po +97 -97
- data/po/sk.po +97 -97
- data/po/sv.po +97 -97
- data/po/uk.po +97 -97
- data/po/zh_TW.po +97 -97
- data/schemas/alexandria.schemas +24 -2
- data/spec/alexandria/book_providers_spec.rb +65 -82
- data/spec/alexandria/book_spec.rb +12 -10
- data/spec/alexandria/console_spec.rb +9 -9
- data/spec/alexandria/export_library_spec.rb +31 -31
- data/spec/alexandria/library_spec.rb +86 -86
- data/spec/alexandria/library_store_spec.rb +8 -8
- data/spec/alexandria/preferences_spec.rb +18 -17
- data/spec/alexandria/scanners/cue_cat_spec.rb +52 -0
- data/spec/alexandria/smart_library_spec.rb +15 -15
- data/spec/alexandria/ui/about_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/acquire_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/alert_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/bad_isbns_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/book_properties_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/confirm_erase_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/conflict_while_copying_dialog_spec.rb +16 -0
- data/spec/alexandria/ui/error_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/export_dialog_spec.rb +15 -0
- data/spec/alexandria/ui/iconview_spec.rb +7 -21
- data/spec/alexandria/ui/import_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/keep_bad_isbn_dialog_spec.rb +17 -0
- data/spec/alexandria/ui/main_app_spec.rb +6 -6
- data/spec/alexandria/ui/new_book_dialog_manual_spec.rb +15 -0
- data/spec/alexandria/ui/{dialogs/new_book_dialog_spec.rb → new_book_dialog_spec.rb} +4 -4
- data/spec/alexandria/ui/new_provider_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/new_smart_library_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/preferences_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/provider_preferences_dialog_spec.rb +19 -0
- data/spec/alexandria/ui/really_delete_dialog_spec.rb +15 -0
- data/spec/alexandria/ui/sidepane_manager_spec.rb +15 -0
- data/spec/alexandria/ui/skip_entry_dialog_spec.rb +14 -0
- data/spec/alexandria/ui/smart_library_properties_dialog_spec.rb +18 -0
- data/spec/alexandria/ui/sound_spec.rb +2 -2
- data/spec/alexandria/ui/ui_manager_spec.rb +6 -20
- data/spec/alexandria/ui/ui_utilities_spec.rb +9 -9
- data/spec/alexandria/utilities_spec.rb +6 -6
- data/spec/end_to_end/basic_run_spec.rb +24 -36
- data/spec/spec_helper.rb +9 -9
- data/tasks/dogtail.rake +1 -1
- data/tasks/setup.rb +2 -2
- data/tasks/spec.rake +11 -11
- data/util/rake/fileinstall.rb +25 -25
- data/util/rake/gettextgenerate.rb +7 -7
- data/util/rake/omfgenerate.rb +7 -7
- metadata +59 -33
- data/spec/alexandria/scanners/cuecat_spec.rb +0 -67
- data/spec/alexandria/ui/dialogs_spec.rb +0 -162
- data/spec/alexandria/ui/sidepane_spec.rb +0 -29
@@ -1,28 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
4
|
-
# Copyright (C) 2014 Matijs van Zuijlen
|
3
|
+
# This file is part of Alexandria.
|
5
4
|
#
|
6
|
-
#
|
7
|
-
# modify it under the terms of the GNU General Public License as
|
8
|
-
# published by the Free Software Foundation; either version 2 of the
|
9
|
-
# License, or (at your option) any later version.
|
10
|
-
#
|
11
|
-
# Alexandria is distributed in the hope that it will be useful,
|
12
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
# General Public License for more details.
|
15
|
-
#
|
16
|
-
# You should have received a copy of the GNU General Public
|
17
|
-
# License along with Alexandria; see the file COPYING. If not,
|
18
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
19
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
20
6
|
|
21
|
-
require File.dirname(__FILE__) +
|
7
|
+
require File.dirname(__FILE__) + "/../../spec_helper"
|
22
8
|
|
23
9
|
describe Alexandria::UI::UIManager do
|
24
|
-
it
|
25
|
-
main_app =
|
26
|
-
|
10
|
+
it "works" do
|
11
|
+
main_app = instance_double(Alexandria::UI::MainApp)
|
12
|
+
described_class.new main_app
|
27
13
|
end
|
28
14
|
end
|
@@ -18,45 +18,45 @@
|
|
18
18
|
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
19
19
|
# Fifth Floor, Boston, MA 02110-1301 USA.
|
20
20
|
|
21
|
-
require File.dirname(__FILE__) +
|
21
|
+
require File.dirname(__FILE__) + "/../../spec_helper"
|
22
22
|
|
23
23
|
# from completion_models
|
24
24
|
describe Gtk::Entry do
|
25
|
-
it
|
25
|
+
it "should extend Gtk::Entry"
|
26
26
|
end
|
27
27
|
|
28
28
|
describe Alexandria::UI::CompletionModels do
|
29
|
-
it
|
29
|
+
it "should work"
|
30
30
|
end
|
31
31
|
|
32
32
|
# from glade_base
|
33
33
|
|
34
34
|
describe Alexandria::UI::BuilderBase do
|
35
|
-
it
|
35
|
+
it "should be revisited"
|
36
36
|
end
|
37
37
|
|
38
38
|
# from icons
|
39
39
|
|
40
40
|
describe GdkPixbuf::Pixbuf do
|
41
|
-
it
|
41
|
+
it "should extend GdkPixbuf::PixBuf"
|
42
42
|
end
|
43
43
|
|
44
44
|
describe Alexandria::UI::Icons do
|
45
|
-
it
|
45
|
+
it "should aid identification"
|
46
46
|
end
|
47
47
|
|
48
48
|
# from libraries_combo
|
49
49
|
|
50
50
|
describe Gtk::ComboBox do
|
51
|
-
it
|
51
|
+
it "should extend Gtk::ComboBox"
|
52
52
|
end
|
53
53
|
|
54
54
|
# from multi_drag_treeview
|
55
55
|
|
56
56
|
describe Gdk::Event do
|
57
|
-
it
|
57
|
+
it "should extend Gdk::Event"
|
58
58
|
end
|
59
59
|
|
60
60
|
describe Gtk::TreeView do
|
61
|
-
it
|
61
|
+
it "should extend Gtk::TreeView"
|
62
62
|
end
|
@@ -17,14 +17,14 @@
|
|
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 File.dirname(__FILE__) +
|
20
|
+
require File.dirname(__FILE__) + "/../spec_helper"
|
21
21
|
|
22
22
|
describe Alexandria::ExecutionQueue do
|
23
23
|
it "should not have so many u's and e's"
|
24
24
|
end
|
25
25
|
|
26
26
|
describe Alexandria::ExportFormat do
|
27
|
-
it
|
27
|
+
it "should justify its existence"
|
28
28
|
end
|
29
29
|
|
30
30
|
describe Alexandria::ImportFilter do
|
@@ -32,11 +32,11 @@ describe Alexandria::ImportFilter do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
describe Alexandria::Logger do
|
35
|
-
it
|
35
|
+
it "should fulfill its function"
|
36
36
|
end
|
37
37
|
|
38
38
|
describe Alexandria::UndoManager do
|
39
|
-
it
|
39
|
+
it "should make right what is wrong"
|
40
40
|
end
|
41
41
|
|
42
42
|
describe Time do
|
@@ -44,9 +44,9 @@ describe Time do
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe String do
|
47
|
-
it
|
47
|
+
it "should do what it does"
|
48
48
|
end
|
49
49
|
|
50
50
|
describe Alexandria::WebTheme do
|
51
|
-
it
|
51
|
+
it "should be themeable"
|
52
52
|
end
|
@@ -1,50 +1,42 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
#
|
3
|
+
# This file is part of Alexandria.
|
4
4
|
#
|
5
|
-
#
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
#
|
10
|
-
# Alexandria is distributed in the hope that it will be useful,
|
11
|
-
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
-
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
-
# General Public License for more details.
|
14
|
-
#
|
15
|
-
# You should have received a copy of the GNU General Public
|
16
|
-
# License along with Alexandria; see the file COPYING. If not,
|
17
|
-
# write to the Free Software Foundation, Inc., 51 Franklin Street,
|
18
|
-
# Fifth Floor, Boston, MA 02110-1301 USA.
|
5
|
+
# See the file README.md for authorship and licensing information.
|
6
|
+
|
7
|
+
require "gnome_app_driver"
|
8
|
+
require "tmpdir"
|
19
9
|
|
20
|
-
|
21
|
-
|
10
|
+
describe "The Alexandria application" do
|
11
|
+
let(:driver) { GnomeAppDriver.new "alexandria" }
|
22
12
|
|
23
|
-
describe 'The Alexandria application' do
|
24
13
|
before do
|
25
|
-
ENV[
|
26
|
-
|
27
|
-
@driver.boot
|
14
|
+
ENV["HOME"] = Dir.mktmpdir
|
15
|
+
driver.boot
|
28
16
|
end
|
29
17
|
|
30
|
-
|
31
|
-
|
18
|
+
after do
|
19
|
+
driver.cleanup
|
20
|
+
end
|
32
21
|
|
33
|
-
|
22
|
+
it "starts and can be quit with Ctrl-q" do
|
23
|
+
driver.press_ctrl_q
|
24
|
+
|
25
|
+
status = driver.cleanup
|
34
26
|
expect(status.exitstatus).to eq 0
|
35
27
|
end
|
36
28
|
|
37
|
-
it
|
38
|
-
frame =
|
29
|
+
it "starts and can be quit with the menu" do
|
30
|
+
frame = driver.frame
|
39
31
|
menu = frame.find_role :menu_item, /Quit/
|
40
32
|
menu.do_action 0
|
41
33
|
|
42
|
-
status =
|
34
|
+
status = driver.cleanup
|
43
35
|
expect(status.exitstatus).to eq 0
|
44
36
|
end
|
45
37
|
|
46
|
-
it
|
47
|
-
frame =
|
38
|
+
it "can be interacted with" do
|
39
|
+
frame = driver.frame
|
48
40
|
frame.find_role(:menu_item, /Title contains/).do_action 0
|
49
41
|
frame.find_role(:menu_item, /View as Icons/).do_action 0
|
50
42
|
frame.find_role(:menu_item, /View as List/).do_action 0
|
@@ -54,16 +46,12 @@ describe 'The Alexandria application' do
|
|
54
46
|
|
55
47
|
table_cell.n_actions.times do |idx|
|
56
48
|
name = table_cell.get_action_name idx
|
57
|
-
table_cell.do_action idx if name ==
|
49
|
+
table_cell.do_action idx if name == "activate"
|
58
50
|
end
|
59
51
|
|
60
|
-
|
52
|
+
driver.press_ctrl_q
|
61
53
|
|
62
|
-
status =
|
54
|
+
status = driver.cleanup
|
63
55
|
expect(status.exitstatus).to eq 0
|
64
56
|
end
|
65
|
-
|
66
|
-
after do
|
67
|
-
@driver.cleanup
|
68
|
-
end
|
69
57
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -4,19 +4,19 @@
|
|
4
4
|
#
|
5
5
|
# See the file README.md for authorship and licensing information.
|
6
6
|
|
7
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__),
|
7
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "/../lib"))
|
8
8
|
|
9
|
-
require
|
9
|
+
require "alexandria"
|
10
10
|
|
11
|
-
LIBDIR = File.expand_path(File.join(File.dirname(__FILE__),
|
12
|
-
TESTDIR = File.join(LIBDIR,
|
11
|
+
LIBDIR = File.expand_path(File.join(File.dirname(__FILE__), "/data/libraries"))
|
12
|
+
TESTDIR = File.join(LIBDIR, "test")
|
13
13
|
|
14
14
|
def an_artist_of_the_floating_world
|
15
|
-
Alexandria::Book.new(
|
16
|
-
[
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
Alexandria::Book.new("An Artist of the Floating World",
|
16
|
+
["Kazuo Ishiguro"],
|
17
|
+
"9780571147168",
|
18
|
+
"Faber and Faber", 1999,
|
19
|
+
"Paperback")
|
20
20
|
end
|
21
21
|
|
22
22
|
Alexandria::UI::Icons.init
|
data/tasks/dogtail.rake
CHANGED
data/tasks/setup.rb
CHANGED
@@ -24,9 +24,9 @@
|
|
24
24
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
25
25
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
26
|
#++
|
27
|
-
require
|
27
|
+
require "rake/clean"
|
28
28
|
|
29
29
|
# Load the other rake files in the tasks folder
|
30
30
|
tasks_dir = __dir__
|
31
|
-
rakefiles = Dir.glob(File.join(tasks_dir,
|
31
|
+
rakefiles = Dir.glob(File.join(tasks_dir, "*.rake")).sort
|
32
32
|
import(*rakefiles)
|
data/tasks/spec.rake
CHANGED
@@ -26,21 +26,21 @@
|
|
26
26
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
27
|
#++
|
28
28
|
|
29
|
-
require
|
29
|
+
require "rspec/core/rake_task"
|
30
30
|
|
31
|
-
namespace
|
32
|
-
RSpec::Core::RakeTask.new(
|
33
|
-
t.pattern =
|
34
|
-
t.ruby_opts = [
|
31
|
+
namespace "spec" do
|
32
|
+
RSpec::Core::RakeTask.new("unit") do |t|
|
33
|
+
t.pattern = "spec/alexandria/**/*_spec.rb"
|
34
|
+
t.ruby_opts = ["-rbundler/setup -rsimplecov -Ilib -w"]
|
35
35
|
end
|
36
36
|
|
37
|
-
RSpec::Core::RakeTask.new(
|
38
|
-
t.pattern =
|
39
|
-
t.ruby_opts = [
|
37
|
+
RSpec::Core::RakeTask.new("end_to_end") do |t|
|
38
|
+
t.pattern = "spec/end_to_end/**/*_spec.rb"
|
39
|
+
t.ruby_opts = ["-rbundler/setup -rsimplecov -Ilib -w"]
|
40
40
|
end
|
41
41
|
|
42
|
-
desc
|
43
|
-
task
|
42
|
+
desc "Runs all unit and end-to-end specs"
|
43
|
+
task "all" => ["spec:unit", "spec:end_to_end"]
|
44
44
|
end
|
45
45
|
|
46
|
-
task default:
|
46
|
+
task default: "spec:all"
|
data/util/rake/fileinstall.rb
CHANGED
@@ -27,10 +27,10 @@
|
|
27
27
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
28
28
|
#++
|
29
29
|
|
30
|
-
require
|
31
|
-
require
|
32
|
-
require
|
33
|
-
require
|
30
|
+
require "fileutils"
|
31
|
+
require "pathname"
|
32
|
+
require "set"
|
33
|
+
require "rake/tasklib"
|
34
34
|
|
35
35
|
# A file installer task, capable of installing into the system
|
36
36
|
# directories, or doing a staged install to a given directory
|
@@ -84,8 +84,8 @@ class FileInstallTask < Rake::TaskLib
|
|
84
84
|
|
85
85
|
# INSTALL TASK
|
86
86
|
|
87
|
-
description =
|
88
|
-
description +=
|
87
|
+
description = "Install package files"
|
88
|
+
description += " to staging directory" if @stage_dir
|
89
89
|
desc description
|
90
90
|
task tasknames[:install] do
|
91
91
|
@file_groups.each { |g| g.install(@stage_dir) }
|
@@ -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 +=
|
108
|
+
dir += "/" unless dir =~ %r{/$}
|
109
109
|
to_delete << Regexp.last_match[1] if regex =~ dir
|
110
110
|
end
|
111
111
|
end
|
@@ -116,8 +116,8 @@ class FileInstallTask < Rake::TaskLib
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
uninstall_description =
|
120
|
-
uninstall_description +=
|
119
|
+
uninstall_description = "Uninstall package files"
|
120
|
+
uninstall_description += " from staging directory" if @stage_dir
|
121
121
|
desc uninstall_description
|
122
122
|
task tasknames[:uninstall] => [tasknames[:uninstall_files],
|
123
123
|
tasknames[:uninstall_dirs]]
|
@@ -145,7 +145,7 @@ class FileInstallTask < Rake::TaskLib
|
|
145
145
|
|
146
146
|
# Install icon files. This method splits up the source file name and
|
147
147
|
# determines where they should be put in the destination hierarchy.
|
148
|
-
def install_icons(file_globs, dest_dir, theme =
|
148
|
+
def install_icons(file_globs, dest_dir, theme = "hicolor", icon_type = "apps")
|
149
149
|
file_globs.each do |fg|
|
150
150
|
files = FileList.new(fg)
|
151
151
|
files.each do |f|
|
@@ -154,7 +154,7 @@ class FileInstallTask < Rake::TaskLib
|
|
154
154
|
icon_size = Pathname.new(icon_dir).basename
|
155
155
|
icon_dest_dir = "#{dest_dir}/#{theme}/#{icon_size}/#{icon_type}"
|
156
156
|
group = FileGroup.new(icon_dir, f, icon_dest_dir)
|
157
|
-
group.description =
|
157
|
+
group.description = "icons"
|
158
158
|
@file_groups << group
|
159
159
|
end
|
160
160
|
end
|
@@ -169,16 +169,16 @@ class FileInstallTask < Rake::TaskLib
|
|
169
169
|
private
|
170
170
|
|
171
171
|
def calculate_ruby_dir
|
172
|
-
ruby_prefix = RbConfig::CONFIG[
|
172
|
+
ruby_prefix = RbConfig::CONFIG["prefix"]
|
173
173
|
|
174
174
|
ruby_libdir = if @install_to_rubylibdir
|
175
|
-
RbConfig::CONFIG[
|
175
|
+
RbConfig::CONFIG["rubylibdir"]
|
176
176
|
else
|
177
|
-
RbConfig::CONFIG[
|
177
|
+
RbConfig::CONFIG["sitelibdir"]
|
178
178
|
end
|
179
|
-
ruby_libdir = ENV[
|
179
|
+
ruby_libdir = ENV["RUBYLIBDIR"] if ENV.key?("RUBYLIBDIR")
|
180
180
|
|
181
|
-
@prefix = ENV[
|
181
|
+
@prefix = ENV["PREFIX"] || ruby_prefix
|
182
182
|
if @prefix == ruby_prefix
|
183
183
|
@rubylib = ruby_libdir
|
184
184
|
elsif ruby_libdir.index(ruby_prefix).zero?
|
@@ -190,12 +190,12 @@ class FileInstallTask < Rake::TaskLib
|
|
190
190
|
end
|
191
191
|
|
192
192
|
def glob2regex(pathglob)
|
193
|
-
pathglob +=
|
194
|
-
real_parts = pathglob.split(
|
193
|
+
pathglob += "/" if /\*\*$/.match?(pathglob)
|
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})/
|
@@ -234,7 +234,7 @@ class FileInstallTask < Rake::TaskLib
|
|
234
234
|
@file_glob = file_glob
|
235
235
|
@dest_dir = dest_dir
|
236
236
|
@mode = mode
|
237
|
-
@description =
|
237
|
+
@description = "files"
|
238
238
|
end
|
239
239
|
|
240
240
|
def to_s
|
@@ -264,8 +264,8 @@ class FileInstallTask < Rake::TaskLib
|
|
264
264
|
puts "Installing #{@description} to #{base_dir}#{@dest_dir}"
|
265
265
|
files.each do |f|
|
266
266
|
dest = dest_dir(f, base_dir)
|
267
|
-
FileUtils.mkdir_p(dest) unless test(
|
268
|
-
FileUtils.install(f, dest, mode: mode) if test(
|
267
|
+
FileUtils.mkdir_p(dest) unless test("d", dest)
|
268
|
+
FileUtils.install(f, dest, mode: mode) if test("f", f)
|
269
269
|
end
|
270
270
|
end
|
271
271
|
|
@@ -274,7 +274,7 @@ class FileInstallTask < Rake::TaskLib
|
|
274
274
|
dest = dest_dir(f, base_dir)
|
275
275
|
filename = File.basename(f)
|
276
276
|
file = File.join(dest, filename)
|
277
|
-
if test(
|
277
|
+
if test("f", file)
|
278
278
|
FileUtils::Verbose.rm_f(file) # , :noop => true)
|
279
279
|
end
|
280
280
|
end
|
@@ -26,9 +26,9 @@
|
|
26
26
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27
27
|
#++
|
28
28
|
|
29
|
-
require
|
30
|
-
require
|
31
|
-
require
|
29
|
+
require "fileutils"
|
30
|
+
require "pathname"
|
31
|
+
require "rake/tasklib"
|
32
32
|
|
33
33
|
class GettextGenerateTask < Rake::TaskLib
|
34
34
|
def initialize(projectname)
|
@@ -39,7 +39,7 @@ class GettextGenerateTask < Rake::TaskLib
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def make_task
|
42
|
-
desc
|
42
|
+
desc "Generate gettext localization files"
|
43
43
|
task gettext: @generated_files
|
44
44
|
|
45
45
|
@generated_files.each { |gen| CLOBBER << gen } if CLOBBER
|
@@ -49,7 +49,7 @@ class GettextGenerateTask < Rake::TaskLib
|
|
49
49
|
@po_dir = po_dir
|
50
50
|
@po_files_glob = file_glob
|
51
51
|
@mo_dir = dest_dir
|
52
|
-
@mo_files_regex =
|
52
|
+
@mo_files_regex = %r{.*/(.+)/LC_MESSAGES/.+\.mo}
|
53
53
|
|
54
54
|
# create MO files
|
55
55
|
rule(/\.mo$/ => [->(dest) { source_file(dest) }]) do |t|
|
@@ -72,14 +72,14 @@ class GettextGenerateTask < Rake::TaskLib
|
|
72
72
|
begin
|
73
73
|
`intltool-merge --version`
|
74
74
|
rescue Errno::ENOENT
|
75
|
-
raise
|
75
|
+
raise "Need to install intltool"
|
76
76
|
end
|
77
77
|
system("intltool-merge -d #{@po_dir} #{infile} #{outfile}")
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
81
|
def locales
|
82
|
-
po_files.map { |po| File.basename(po).split(
|
82
|
+
po_files.map { |po| File.basename(po).split(".")[0] }
|
83
83
|
end
|
84
84
|
|
85
85
|
def mo_files
|