Sha256: 200cc431d3a481d941a2955fc810f16081f59cbe0cb6a35fef37a1196df75232

Contents?: true

Size: 1.35 KB

Versions: 15

Compression:

Stored size: 1.35 KB

Contents

#--
# 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
#++

def set_y2dir
  ENV["Y2DIR"] = Dir["**/src"].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 "Runs console with preloaded module directories"
task :console do
  set_y2dir
  sh "irb -ryast"
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
yast-rake-0.2.17 lib/tasks/run.rake
yast-rake-0.2.16 lib/tasks/run.rake
yast-rake-0.2.15 lib/tasks/run.rake
yast-rake-0.2.14 lib/tasks/run.rake
yast-rake-0.2.13 lib/tasks/run.rake
yast-rake-0.2.12 lib/tasks/run.rake
yast-rake-0.2.11 lib/tasks/run.rake
yast-rake-0.2.10 lib/tasks/run.rake
yast-rake-0.2.9 lib/tasks/run.rake
yast-rake-0.2.8 lib/tasks/run.rake
yast-rake-0.2.7 lib/tasks/run.rake
yast-rake-0.2.6 lib/tasks/run.rake
yast-rake-0.2.5 lib/tasks/run.rake
yast-rake-0.2.4 lib/tasks/run.rake
yast-rake-0.2.3 lib/tasks/run.rake