Sha256: 60384d780b83cf50f33ea4a861b8832b7497065d7031c72648b7a96e5d8a67d6

Contents?: true

Size: 1.71 KB

Versions: 11

Compression:

Stored size: 1.71 KB

Contents

# frozen_string_literal: true

#--
# Yast rake
#
# Copyright (C) 2009-2013 Novell, Inc.
#   This library is free software; you can redistribute it and/or modify
# it only under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
#   This library 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 Lesser General Public License for more
# details.
#
#   You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#++

require_relative "container_runner"

def set_y2dir
  dirs = Dir["**/src"]
  dirs << ENV["Y2DIR"] if ENV["Y2DIR"] && !ENV["Y2DIR"].empty?
  ENV["Y2DIR"] = dirs.join(":")
end

desc "Run given client"
task :run, :client do |_t, args|
  args.with_defaults = { client: nil }
  client = args[:client]
  if client
    client = Dir["**/src/clients/#{client}.rb"].first
  else
    clients = Dir["**/src/clients/*.rb"]
    client = clients.reduce do |min, n|
      next n if min.nil?

      # use client with shortest name by default
      (min.size > n.size) ? n : min
    end
  end

  raise "No client found" unless client

  set_y2dir
  sh "/sbin/yast2 #{client}"
end

desc "Run given client in a Docker container"
task :"run:container", :client do |_t, args|
  args.with_defaults = { client: nil }
  client = args[:client]

  runner = ContainerRunner.new
  runner.run(client)
end

desc "Runs console with preloaded module directories"
task :console do
  set_y2dir
  sh "irb -ryast"
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
yast-rake-0.2.50 lib/tasks/run.rake
yast-rake-0.2.49 lib/tasks/run.rake
yast-rake-0.2.48 lib/tasks/run.rake
yast-rake-0.2.47 lib/tasks/run.rake
yast-rake-0.2.46 lib/tasks/run.rake
yast-rake-0.2.45 lib/tasks/run.rake
yast-rake-0.2.44 lib/tasks/run.rake
yast-rake-0.2.43 lib/tasks/run.rake
yast-rake-0.2.42 lib/tasks/run.rake
yast-rake-0.2.41 lib/tasks/run.rake
yast-rake-0.2.40 lib/tasks/run.rake