module SSC::Handler::Helper::InstanceMethods
Public Instance Methods
connect(user, pass, connection_options)
click to toggle source
Establish connection to Suse Studio with username, password
# File lib/handlers/helper.rb, line 58 def connect(user, pass, connection_options) @connection= StudioApi::Connection.new(user, pass, self.class::API_URL, connection_options) StudioApi::Util.configure_studio_connection @connection end
filter_options(options, keys)
click to toggle source
# File lib/handlers/helper.rb, line 63 def filter_options(options, keys) keys.inject({}) do |out, key| (options.respond_to?(key) && options.send(key)) ? out.merge({ key => options.send(key) }) : out end end
require_appliance() { |find| ... }
click to toggle source
# File lib/handlers/helper.rb, line 83 def require_appliance if options.appliance_id yield(StudioApi::Appliance.find(options.appliance_id)) else raise "Unable to find the appliance" end end
require_appliance_directory() { |appliance, files| ... }
click to toggle source
# File lib/handlers/helper.rb, line 93 def require_appliance_directory if File.exist?('./.sscrc') require_appliance do |appliance| files= { :package => PackageFile.new, :repository => RepositoryFile.new, :file_list => FileListFile.new } yield(appliance, files) end else raise ApplianceDirectoryError, 'Appliance directory not found' end end
say_array(array, color= nil) { |i| ... }
click to toggle source
# File lib/handlers/helper.rb, line 69 def say_array(array, color= nil) # NOTE # Included for those methods that still return arrays for printing # Can be removed eventually # Still seems to be a nice way to format the text output of methods if array.is_a?(Array) array= array.collect {|i| yield(i)} if block_given? say array.join("\n"), color else say "\n" end array end