diff --git a/.travis.yml b/.travis.yml index cab0a26..9996f78 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,7 +5,7 @@ before_install: # disable rvm, use system Ruby - rvm reset - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh - - sh ./travis_setup.sh -p "yast2-devtools yast2 yast2-packager rake" -g "gettext yast-rake yard rspec:2.14.1 simplecov coveralls rubocop:0.29.1" + - sh ./travis_setup.sh -p "yast2-devtools yast2 yast2-packager yast2-installation rake" -g "gettext yast-rake yard rspec:2.14.1 simplecov coveralls rubocop:0.29.1" script: - rake check:syntax - rake check:pot diff --git a/package/yast2-migration.spec b/package/yast2-migration.spec index 25761f9..77e07b6 100644 --- a/package/yast2-migration.spec +++ b/package/yast2-migration.spec @@ -36,6 +36,8 @@ Requires: yast2 Requires: yast2-packager Requires: yast2-pkg-bindings Requires: yast2-ruby-bindings +Requires: yast2-installation +Requires: yast2-update BuildArch: noarch diff --git a/src/lib/migration/proposal_store.rb b/src/lib/migration/proposal_store.rb new file mode 100644 index 0000000..85aef10 --- /dev/null +++ b/src/lib/migration/proposal_store.rb @@ -0,0 +1,72 @@ +# encoding: utf-8 + +# ------------------------------------------------------------------------------ +# Copyright (c) 2014 Novell, Inc. All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as published by the +# Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact Novell, Inc. +# +# To contact Novell about this file by physical or electronic mail, you may find +# current contact information at www.novell.com. +# ------------------------------------------------------------------------------ + +require "yast" +require "installation/proposal_store" + +module Migration + # Provides access to static metadata for update proposal. + class ProposalStore < Installation::ProposalStore + include Yast::Logger + include Yast::I18n + + PROPOSAL_NAMES = ["update_proposal"] + PROPOSAL_PROPERTIES = {} + MODULES_ORDER = PROPOSAL_NAMES + + def initialize(_unused_mode) + textdomain "migration" + + super("migration") + end + + # @return [String] translated headline + def headline + _("Migration proposal") + end + + # @return [Array] proposal names in execution order, including + # the "_proposal" suffix + def proposal_names + PROPOSAL_NAMES + end + + # returns single list of modules presentation order or list of tabs with + # list of modules + def presentation_order + MODULES_ORDER + end + + private + + def global_help + _( + "

\n" \ + "To start online migration, press Next.\n" \ + "

\n" + ) + end + + def properties + PROPOSAL_PROPERTIES + end + end +end diff --git a/test/proposal_store_test.rb b/test/proposal_store_test.rb new file mode 100644 index 0000000..24740bb --- /dev/null +++ b/test/proposal_store_test.rb @@ -0,0 +1,72 @@ +# ------------------------------------------------------------------------------ +# Copyright (c) 2015 SUSE GmbH, All Rights Reserved. +# +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; if not, contact SUSE GmbH. +# +# To contact SUSE about this file by physical or electronic mail, you may find +# current contact information at www.suse.com. +# ------------------------------------------------------------------------------ + +require_relative "test_helper" + +require "migration/proposal_store" + +module Yast + + extend Yast::I18n + + describe Migration::ProposalStore do + subject { Migration::ProposalStore.new(nil) } + + describe ".headline" do + it "returns a headline" do + expect(subject.headline).to eq(Yast::_("Migration proposal")) + end + end + + describe ".proposal_names" do + it "returns an update proposal" do + expect(subject.proposal_names).to eq ["update_proposal"] + end + end + + describe ".presentation_order" do + it "returns a presentation order" do + expect(subject.presentation_order).to eq ["update_proposal"] + end + end + + describe ".help_text" do + it "returns the right help text" do + help_string = Yast::_( + "

\n" \ + "To start online migration, press Next.\n" \ + "

\n" + ) + expect(subject.help_text.start_with?(help_string)).to eq true + end + end + + describe ".icon" do + it "returns 'yast-software'" do + expect(subject.icon).to eq "yast-software" + end + end + + describe ".tabs?" do + it "returns false" do + expect(subject.tabs?).to eq false + end + end + end +end