Class: BPM::CLI::Owner

Inherits:
Thor
  • Object
show all
Defined in:
lib/bpm/cli/owner.rb

Instance Method Summary collapse

Instance Method Details

#add(package, email) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/bpm/cli/owner.rb', line 24

def add(package, email)
  remote = BPM::Remote.new
  if remote.logged_in?
    say remote.add_owner(package, email)
  else
    abort LOGIN_MESSAGE
  end
end

#list(package) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/bpm/cli/owner.rb', line 4

def list(package)
  remote = BPM::Remote.new
  if remote.logged_in?
    yaml   = remote.list_owners(package)
    owners = YAML.load(yaml)

    if owners.is_a?(Array)
      say "Owners for package: #{package}"
      owners.each do |owner|
        say "- #{owner['email']}"
      end
    else
      say owners
    end
  else
    abort LOGIN_MESSAGE
  end
end

#remove(package, email) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/bpm/cli/owner.rb', line 34

def remove(package, email)
  remote = BPM::Remote.new
  if remote.logged_in?
    say remote.remove_owner(package, email)
  else
    abort LOGIN_MESSAGE
  end
end