Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Always display unjoined org apps #1692

Merged
merged 1 commit into from
Aug 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions lib/heroku/command/apps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Heroku::Command::Apps < Heroku::Command::Base
#
# -o, --org ORG # the org to list the apps for
# --space SPACE # HIDDEN: list apps in a given space
# -A, --all # list all apps in the org. Not just joined apps
# -A, --all # list all collaborated apps, including joined org apps in personal app list
# -p, --personal # list apps in personal account when a default org is set
#
#Example:
Expand Down Expand Up @@ -43,26 +43,8 @@ def index

unless apps.empty?
if org
joined, unjoined = apps.partition { |app| app['joined'] == true }

styled_header(in_message("Apps joined", app_in_msg_opts))
unless joined.empty?
styled_array(joined.map {|app| regionized_app_name(app) + (app['locked'] ? ' (locked)' : '') })
else
display("You haven't joined any apps.")
display("Use --all to see unjoined apps.") unless options[:all]
display
end

if options[:all]
styled_header(in_message("Apps available to join", app_in_msg_opts))
unless unjoined.empty?
styled_array(unjoined.map {|app| regionized_app_name(app) + (app['locked'] ? ' (locked)' : '') })
else
display("There are no apps to join.")
display
end
end
styled_header(in_message("Apps", app_in_msg_opts))
styled_array(apps.map {|app| regionized_app_name(app) + (app['locked'] ? ' (locked)' : '') })
else
my_apps, collaborated_apps = apps.partition { |app| app["owner_email"] == Heroku::Auth.user }

Expand Down
22 changes: 4 additions & 18 deletions spec/heroku/command/apps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -263,24 +263,12 @@ module Heroku::Command
)
end

it "lists joined apps in an organization" do
it "list all in an organization" do
stderr, stdout = execute("apps -o test-org")
expect(stderr).to eq("")
expect(stdout).to eq <<-STDOUT
=== Apps joined in organization test-org
=== Apps in organization test-org
org-app-1

STDOUT
end

it "list all apps in an organization with the --all flag" do
stderr, stdout = execute("apps --all -o test-org")
expect(stderr).to eq("")
expect(stdout).to eq <<-STDOUT
=== Apps joined in organization test-org
org-app-1

=== Apps available to join in organization test-org
org-app-2

STDOUT
Expand Down Expand Up @@ -325,13 +313,11 @@ module Heroku::Command
end

it "lists only apps in spaces by name" do
stderr, stdout = execute("apps --space test-space --all")
stderr, stdout = execute("apps --space test-space")
expect(stderr).to eq("")
expect(stdout).to eq <<-STDOUT
=== Apps joined in space test-space
=== Apps in space test-space
space-app-1

=== Apps available to join in space test-space
space-app-2

STDOUT
Expand Down