Rakefile in alexandria-book-collection-manager-0.7.2 vs Rakefile in alexandria-book-collection-manager-0.7.3
- old
+ new
@@ -1,33 +1,10 @@
# frozen_string_literal: true
-# -*- ruby -*-
-#--
-# Copyright (C) 2009 Cathal Mc Ginley
-# Copyright (C) 2011, 2014, 2016 Matijs van Zuijlen
-#
# This file is part of the Alexandria build system.
#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#++
+# See the file README.md for authorship and licensing information.
load 'tasks/setup.rb'
require 'rake/packagetask'
@@ -146,21 +123,24 @@
doc = REXML::Document.new(IO.read(SCHEMA_PATH))
doc.elements.each('gconfschemafile/schemalist/schema') do |element|
default = element.elements['default'].text
next unless default
+
varname = File.basename(element.elements['key'].text)
type = element.elements['type'].text
if (type == 'list') || (type == 'pair')
ary = default[1..-2].split(',')
next if ary.empty?
+
if type == 'list'
list_type = element.elements['list_type'].text
ary.map! { |x| convert_with_type(x, list_type) }
elsif type == 'pair'
next if ary.length != 2
+
ary[0] = convert_with_type(ary[0],
element.elements['car_type'].text)
ary[1] = convert_with_type(ary[1],
element.elements['cdr_type'].text)
end
@@ -171,21 +151,21 @@
generated_lines << varname.inspect + ' => ' + default
end
generate(f.name) do
- <<EOS
-module Alexandria
- class Preferences
- DEFAULT_VALUES = {
- #{generated_lines.join(",\n ")}
- }
+ <<~EOS
+ module Alexandria
+ class Preferences
+ DEFAULT_VALUES = {
+ #{generated_lines.join(",\n ")}
+ }
+ end
+ end
+ EOS
end
end
-EOS
- end
-end
autogenerated_files = ['lib/alexandria/config.rb',
'lib/alexandria/default_preferences.rb']
desc 'Generate ruby files needed for the installation'
@@ -235,9 +215,10 @@
task pre_install: [:build]
task :scrollkeeper do
unless system('which scrollkeeper-update')
raise 'scrollkeeper-update cannot be found, is Scrollkeeper correctly installed?'
end
+
system('scrollkeeper-update -q') || raise('Scrollkeeper update failed')
end
task :gconf do
return if ENV['GCONF_DISABLE_MAKEFILE_SCHEMA_INSTALL']