Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
140 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/lib/installation/console/plugins/repositories_button.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2021 SUSE LLC, 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. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
require "yast" | ||
|
||
require "cwm" | ||
require "installation/console/menu_plugin" | ||
|
||
module Installation | ||
module Console | ||
module Plugins | ||
# define a CWM widget for starting repository configuration | ||
class RepositoriesButton < CWM::PushButton | ||
def initialize | ||
textdomain "packager" | ||
end | ||
|
||
def label | ||
# TRANSLATORS: a button label, it starts the repository configuration | ||
_("Configure Software Repositories...") | ||
end | ||
|
||
def help | ||
# TRANSLATORS: help text | ||
_("<p>If you need to use an additional repository for installing packages " \ | ||
"then use the <b>Configure Software Repositories</b> button.</p>") | ||
end | ||
|
||
def handle | ||
Yast::WFM.call("repositories") | ||
nil | ||
end | ||
end | ||
|
||
# define a console plugin | ||
class RepositoriesButtonPlugin < MenuPlugin | ||
def widget | ||
RepositoriesButton.new | ||
end | ||
end | ||
end | ||
end | ||
end |
38 changes: 38 additions & 0 deletions
38
src/lib/installation/console/plugins/repositories_command.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2021 SUSE LLC, 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. | ||
# | ||
# ------------------------------------------------------------------------------ | ||
|
||
require "pp" | ||
require "yast" | ||
|
||
module Installation | ||
module Console | ||
# define the "repositories" command in the expert console | ||
class Commands | ||
def repositories | ||
Yast.import "Pkg" | ||
|
||
repos = Yast::Pkg.SourceGetCurrent(false).map do |repo| | ||
Yast::Pkg.SourceGeneralData(repo) | ||
end | ||
|
||
pp repos | ||
end | ||
|
||
private | ||
|
||
def repositories_description | ||
"Dump the details of the currently defined software repositories" | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (c) [2021] SUSE LLC | ||
# | ||
# 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 LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require_relative "../../../test_helper" | ||
require "installation/console/plugins/repositories_button" | ||
|
||
require "cwm/rspec" | ||
|
||
describe Installation::Console::Plugins::RepositoriesButton do | ||
before do | ||
allow(Yast::WFM).to receive(:call) | ||
end | ||
|
||
include_examples "CWM::PushButton" | ||
end | ||
|
||
describe Installation::Console::Plugins::RepositoriesButtonPlugin do | ||
context "#widget" do | ||
it "returns a CWM widget" do | ||
w = subject.widget | ||
expect(w).to be_a(CWM::AbstractWidget) | ||
end | ||
end | ||
end |