-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into nativerubymethods
Actually this was done with git merge -X ours --no-commit master and then for F in library/types/src/modules/URL.rb library/types/test/url_test.rb; do git show HEAD:$F > $F git add $F done to recover from the revert of these two files in master. This was trickier than I thought :-/
- Loading branch information
Showing
34 changed files
with
901 additions
and
66 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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
require "yast" | ||
|
||
module Installation | ||
# An abstract class that simplifies writing `*_auto.rb` clients for AutoYaST. | ||
# | ||
# It provides a single entry point | ||
# which dispatches calls to the abstract methods that all proposal clients | ||
# need to implement. | ||
# | ||
# You need to implement all the methods, except {#packages}. | ||
# | ||
# "Autoinstall" basically means {#import}, then {#write}. | ||
# "Clone" means {#read}, then {#export}. | ||
# | ||
# @example how to run a client | ||
# require "installation/example_auto" | ||
# ::Installation::ExampleAuto.run | ||
# | ||
# @see https://github.com/yast/yast-bootloader/blob/master/src/clients/bootloader_auto.rb | ||
# Example client, bootloader_auto.rb | ||
# @see http://users.suse.com/~ug/autoyast_doc/devel/ar01s05.html | ||
# Code-related configuration and some old documenation. | ||
class AutoClient < Yast::Client | ||
include Yast::Logger | ||
|
||
# Entry point for calling the client. | ||
# The only part needed in client rb file. | ||
# @return response from abstract methods | ||
def self.run | ||
self.new.run | ||
end | ||
|
||
# Dispatches to abstract method based on passed Arguments to client | ||
def run | ||
func, param = Yast::WFM.Args | ||
log.info "Called #{self.class}.run with #{func} and params #{param}" | ||
|
||
case func | ||
when "Import" | ||
import(param) | ||
when "Export" | ||
export | ||
when "Summary" | ||
summary | ||
when "Reset" | ||
reset | ||
when "Change" | ||
change | ||
when "Write" | ||
write | ||
when "Packages" | ||
packages | ||
when "Read" | ||
read | ||
when "GetModified" | ||
modified? | ||
when "SetModified" | ||
modified | ||
else | ||
raise ArgumentError, "Invalid action for auto client '#{func.inspect}'" | ||
end | ||
end | ||
|
||
protected | ||
|
||
# Import data from AutoYaST profile. | ||
# | ||
# The profile is a Hash or an Array according to the configuration item | ||
# `X-SuSE-YaST-AutoInstDataType` | ||
# @param profile [Hash, Array] profile data specific to this module. | ||
# @return true on success | ||
def import(profile) | ||
raise NotImplementedError, "Calling abstract method 'import'" | ||
end | ||
|
||
# Export profile data from AutoYaST. | ||
# | ||
# The profile is a Hash or an Array according to the configuration item | ||
# `X-SuSE-YaST-AutoInstDataType` | ||
# @return [Hash, Array] profile data | ||
def export | ||
raise NotImplementedError, "Calling abstract method 'export'" | ||
end | ||
|
||
# Provide a brief summary of configuration. | ||
# @return [String] description in RichText format | ||
def summary | ||
raise NotImplementedError, "Calling abstract method 'summary'" | ||
end | ||
|
||
# Reset configuration to default state. | ||
# @return [void] | ||
def reset | ||
raise NotImplementedError, "Calling abstract method 'reset'" | ||
end | ||
|
||
# Run UI to modify the configuration. | ||
# @return [Symbol] If one of `:accept`, `:next`, `:finish` is returned, | ||
# the changes are accepted, otherwise they are discarded. | ||
def change | ||
raise NotImplementedError, "Calling abstract method 'change'" | ||
end | ||
|
||
|
||
# Write settings to the target system. | ||
# @return [Boolean] true on success | ||
def write | ||
raise NotImplementedError, "Calling abstract method 'write'" | ||
end | ||
|
||
# Get a list of packages needed for configuration. | ||
# | ||
# The default implementation returns an empty list. | ||
# @return [Array<String>] list of required packages | ||
def packages | ||
log.info "#{self.class}#packages not implemented, returning []." | ||
|
||
[] | ||
end | ||
|
||
# Read settings from the target system. | ||
# | ||
# It is used to initialize configuration from the current system | ||
# for further represent in AutoYaST profile. | ||
# @return [void] | ||
def read | ||
raise NotImplementedError, "Calling abstract method 'write'" | ||
end | ||
|
||
# Set that the profile data has beed modified | ||
# and should be exported from the interactive editor, | ||
# or included in the cloned data. | ||
# @return [void] | ||
def modified | ||
raise NotImplementedError, "Calling abstract method 'modified'" | ||
end | ||
|
||
# Query whether the profile data has beed modified | ||
# and should be exported from the interactive editor, | ||
# or included in the cloned data. | ||
# @return [Boolean] | ||
def modified? | ||
raise NotImplementedError, "Calling abstract method 'modified?'" | ||
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,99 @@ | ||
require "yast" | ||
|
||
module Installation | ||
# Abstract class that simplify writting finish clients for installation. | ||
# It provides single entry point and abstract methods, that all finish clients | ||
# need to implement. | ||
# @example how to run client | ||
# require "installation/example_finish" | ||
# ::Installation::ExampleFinish.run | ||
# @see for example client in installation clone_finish.rb | ||
# | ||
# # Inst-Finish Scripts | ||
# ## About | ||
# They are called by the inst_finish.ycp installation client at the end of the | ||
# first stage installation. | ||
# | ||
# Part of these clients are called with SCR connected to inst-sys, the others | ||
# are called after SCR gets switched to the installed system (chrooted). | ||
# | ||
# Script inst_finish.ycp contains several stages, every has | ||
# | ||
# * label - visible in the writing progress | ||
# | ||
# * steps - list of additional inst_finish scripts that are called | ||
# ("bingo" -> "bingo_finish.ycp") | ||
# Important script is "switch_scr", after that call, SCR is connected to the | ||
# just installed system. | ||
# | ||
# ## Finish Scripts | ||
# | ||
# Every single finish script is a non-interactive script (write-only). It's | ||
# basically called twice: | ||
# | ||
# * At first "Info" returns in which modes "Write" should be called | ||
# | ||
# * Then "Write" should be called to do the job | ||
# | ||
class FinishClient < Yast::Client | ||
include Yast::Logger | ||
|
||
# Entry point for calling client. | ||
# The only part needed in client rb file. | ||
# @return response from abstract methods | ||
def self.run | ||
self.new.run | ||
end | ||
|
||
# Dispatches to abstract method based on passed arguments to client | ||
def run | ||
func = Yast::WFM.Args.first | ||
log.info "Called #{self.class}.run with #{func}" | ||
|
||
case func | ||
when "Info" | ||
info | ||
when "Write" | ||
write | ||
else | ||
raise ArgumentError, "Invalid action for proposal '#{func.inspect}'" | ||
end | ||
end | ||
|
||
protected | ||
|
||
# Write configuration. | ||
def write | ||
raise NotImplementedError, "Calling abstract method 'write'" | ||
end | ||
|
||
# Restrict in which modes it should run. | ||
# @return [Array<Symbol>, nil] | ||
# Valid values are `:autoinst`, `:autoupg`, `:installation`, | ||
# `:live_installation`, and `:update`. NOTE that these values | ||
# are NOT consistent with the names used in {Yast::ModeClass Mode}. | ||
# By default it returns `nil`, meaning to run always. | ||
def modes | ||
nil | ||
end | ||
|
||
# @return [Integer] the number of client steps. | ||
def steps | ||
1 | ||
end | ||
|
||
# @return [String] a title used to display to the user what is happening. | ||
def title | ||
raise NotImplementedError, "Calling abstract method 'title'" | ||
end | ||
|
||
# Adapt the metadata for inst_finish API | ||
def info | ||
{ | ||
"when " => modes, | ||
"steps" => steps, | ||
"title" => title | ||
} | ||
end | ||
end | ||
end |
Oops, something went wrong.