Class: Neetob::CLI::Heroku::Access::Add

Inherits:
Base
  • Object
show all
Defined in:
lib/neetob/cli/heroku/access/add.rb

Constant Summary

Constants inherited from Base

Base::NEETO_DEPLOY_DOCS

Constants inherited from Base

Base::NEETO_APPS_LIST_LINK

Instance Attribute Summary collapse

Attributes inherited from Base

#ui

Instance Method Summary collapse

Methods inherited from Base

#process

Methods included from Utils

#camel_case_to_slug, #is_upper?, #symbolize_keys

Constructor Details

#initialize(apps, new_users = [], sandbox = false) ⇒ Add

Returns a new instance of Add.



12
13
14
15
16
17
# File 'lib/neetob/cli/heroku/access/add.rb', line 12

def initialize(apps, new_users = [], sandbox = false)
  super()
  @apps = apps
  @new_users = new_users
  @sandbox = sandbox
end

Instance Attribute Details

#appsObject

Returns the value of attribute apps.



10
11
12
# File 'lib/neetob/cli/heroku/access/add.rb', line 10

def apps
  @apps
end

#new_usersObject

Returns the value of attribute new_users.



10
11
12
# File 'lib/neetob/cli/heroku/access/add.rb', line 10

def new_users
  @new_users
end

#sandboxObject

Returns the value of attribute sandbox.



10
11
12
# File 'lib/neetob/cli/heroku/access/add.rb', line 10

def sandbox
  @sandbox
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/neetob/cli/heroku/access/add.rb', line 19

def run
  matching_apps = find_all_matching_apps_or_repos(apps, :heroku, sandbox)
  matching_apps.each do |app|
    `heroku access -a #{app}`
    unless $?.success?
      ui.error("There is a problem in accessing the app with name \"#{app}\" in your account.")
      ui.error("Please check the specified app name and ensure you're authorized to view that app.")
      next
    end

    new_users.each do |user|
      ui.info(`heroku access:add #{user} -a #{app}`)
    end
  end
end