Skip to content

Commit

Permalink
YCP Killer: Translate YCP files into Ruby
Browse files Browse the repository at this point in the history
The commit is a result of running YCP Killer's "ruby" command.

See also:

  https://github.com/yast/ycp-killer
  • Loading branch information
yast-bot committed Jul 31, 2013
1 parent 90dff9a commit 16ef6b8
Show file tree
Hide file tree
Showing 20 changed files with 2,093 additions and 1,637 deletions.
100 changes: 100 additions & 0 deletions src/clients/drbd.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
# encoding: utf-8

# ------------------------------------------------------------------------------
# Copyright (c) 2006 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.
# ------------------------------------------------------------------------------

# File: clients/drbd.ycp
# Package: Configuration of drbd
# Summary: Main file
# Authors: xwhu <xwhu@novell.com>
#
# $Id: drbd.ycp 27914 2006-02-13 14:32:08Z locilka $
#
# Main file for drbd configuration. Uses all other files.
module Yast
class DrbdClient < Client
def main
Yast.import "UI"

#**
# <h3>Configuration of drbd</h3>

textdomain "drbd"

# The main ()
Builtins.y2milestone("----------------------------------------")
Builtins.y2milestone("Drbd module started")

Yast.import "Progress"
Yast.import "Report"
Yast.import "Summary"

Yast.import "CommandLine"
Yast.include self, "drbd/wizards.rb"

@cmdline_description = {
"id" => "drbd",
# Command line help text for the Xdrbd module
"help" => _(
"Configuration of DRBD"
),
"guihandler" => fun_ref(method(:DrbdSequence), "any ()"),
"initialize" => fun_ref(Drbd.method(:Read), "boolean ()"),
"finish" => fun_ref(Drbd.method(:Write), "boolean ()"),
"actions" =>
# FIXME TODO: fill the functionality description here
{},
"options" =>
# FIXME TODO: fill the option descriptions here
{},
"mappings" =>
# FIXME TODO: fill the mappings of actions and options here
{}
}

# is this proposal or not?
@propose = false
@args = WFM.Args
if Ops.greater_than(Builtins.size(@args), 0)
if Ops.is_path?(WFM.Args(0)) && WFM.Args(0) == path(".propose")
Builtins.y2milestone("Using PROPOSE mode")
@propose = true
end
end

# main ui function
@ret = nil

if @propose
@ret = DrbdAutoSequence()
else
@ret = CommandLine.Run(@cmdline_description)
end
Builtins.y2debug("ret=%1", @ret)

# Finish
Builtins.y2milestone("Drbd module finished")
Builtins.y2milestone("----------------------------------------")

deep_copy(@ret)
end
end
end

Yast::DrbdClient.new.main
92 changes: 0 additions & 92 deletions src/clients/drbd.ycp

This file was deleted.

121 changes: 121 additions & 0 deletions src/include/drbd/common.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# encoding: utf-8

# ------------------------------------------------------------------------------
# Copyright (c) 2006 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.
# ------------------------------------------------------------------------------

# File: include/drbd/dialogs.ycp
# Package: Configuration of drbd
# Summary: Dialogs definitions
# Authors: xwhu <xwhu@novell.com>
#
# $Id: dialogs.ycp 27914 2006-02-13 14:32:08Z locilka $
module Yast
module DrbdCommonInclude
def initialize_drbd_common(include_target)
textdomain "drbd"

Yast.import "Label"
Yast.import "Wizard"
Yast.import "Drbd"
Yast.import "Popup"
Yast.import "CWM"

@DIALOG = ["startup_conf", "global_conf", "resource_conf"]

@PARENT = {}

@NAME = {
"startup_conf" => _("Start-up Configuration"),
"global_conf" => _("Global Configuration"),
"resource_conf" => _("Resource Configuration")
}
end

def PollAbort
UI.PollInput == :abort
end

def ReallyAbort
# return !Heartbeat::Modified() || Popup::ReallyAbort(true);
Popup.ReallyAbort(true)
end

def my_SetContents(conf, contents)
contents = deep_copy(contents)
Wizard.SetContents(
Ops.add("DRBD - ", Ops.get_string(@NAME, conf, "")),
contents,
Ops.get_string(@HELPS, conf, ""),
true,
true
)

if UI.WidgetExists(Id(:wizardTree))
# UI::ChangeWidget(`id(`wizardTree), `CurrentItem, current_dialog);
UI.SetFocus(Id(:wizardTree))
end

# if (Heartbeat::firstrun) {
# UI::ChangeWidget(`id(`back), `Enabled, conf != "node_conf");
# if (conf == "startup_conf") {
# UI::WizardCommand(`SetNextButtonLabel( Label::FinishButton() ) );
# Wizard::SetNextButton(`PushButton(`id(`next), `opt(`key_F10), Label::FinishButton()));
# } else {
# UI::WizardCommand(`SetNextButtonLabel( Label::NextButton() ) );
# Wizard::SetNextButton(`PushButton(`id(`next), `opt(`key_F10), Label::NextButton()));
# }
# }

nil
end

def cmpList(a, b)
a = deep_copy(a)
b = deep_copy(b)
same = true
if Builtins.size(a) != Builtins.size(b)
same = false
#TODO:
end
false
end

def myHelp(help)
UI.OpenDialog(
Opt(:decorated),
HBox(
VSpacing(16),
VBox(
HSpacing(60),
VSpacing(0.5),
RichText(Ops.get_string(@HELPS, help, "")),
VSpacing(1.5),
PushButton(Id(:ok), Opt(:default, :key_F10), Label.OKButton)
)
)
)

UI.SetFocus(Id(:ok))
UI.UserInput
UI.CloseDialog

nil
end
end
end
Loading

0 comments on commit 16ef6b8

Please sign in to comment.