Sha256: fbb655546d8eb700aac0ec5213fd857f089e3de3c9f2b750655cc18bb0b89570

Contents?: true

Size: 1.03 KB

Versions: 3

Compression:

Stored size: 1.03 KB

Contents

namespace :app do
  desc "Add an application"
  task :add, [:app, :role] do |t, args|
    abort("Missing parameters") if args[:app].nil? || args[:app].empty? || args[:role].nil? || args[:role].empty?
    ex = DH.get_app_data(args[:app])
    unless ex.nil?
      puts "Updating application #{args[:app]}" unless ex.nil?
      DH.remove_app(args[:app])
    end
    DH.add_app(args[:app], args[:role])
    puts "Added app #{args[:app]} in role #{args[:role]}"
  end

  desc "Remove an application"
  task :del, [:app] do |t, args|
    unless args[:app].nil? || args[:app].empty?
      DH.remove_app(args[:app])
      puts "Removed app #{args[:app]}"
    end
  end

  desc "Print app info"
  task :info, [:app] do |t, args|
    info = DH.get_app_data(args[:app])
    if info.nil? || info.empty?
      puts "No such app #{args[:app]}"
    else
      puts " * #{args[:app]} => #{info["role"]}"
    end

  end
end

desc "List apps"
task :app do
  puts "Apps:"
  DH.apps.each do |app|
    info = DH.get_app_data(app)
    puts " * #{app} => #{info["role"]}"
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gaptool-server-0.6.6 tasks/app.rb
gaptool-server-0.6.4 tasks/app.rb
gaptool-server-0.6.3 tasks/app.rb