Skip to content

Commit

Permalink
feat(cli): remove references to free (#2145)
Browse files Browse the repository at this point in the history
* chore(apps-v5): remove free dyno quota exhaustion error & update apps readme (#2142)

* chore(addons-v5): update addons copy to reflect new plans (#2141)

* chore(addons-v5): update addons copy to support new plans

* Address feedback & update tests

* chore(ps): remove free and add basic for dynos (#2137)

* chore(ps): remove free and add basic for dynos

* Address feedback & update tests

* chore(cli): update size flags for free (#2146)

* chore(cli): update size flags for free

* Update indentation

* Add back free metadata and process tier check

* Remove free check for size. API will handle invalid params.
  • Loading branch information
zwhitfield3 authored Nov 29, 2022
1 parent aad2046 commit 0f52326
Show file tree
Hide file tree
Showing 15 changed files with 82 additions and 85 deletions.
4 changes: 2 additions & 2 deletions docs/ps.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ DESCRIPTION
Called with no arguments shows the current dyno size.
Called with one argument sets the size.
Where SIZE is one of free|eco|hobby|standard-1x|standard-2x|performance
Where SIZE is one of eco|basic|standard-1x|standard-2x|performance
Called with 1..n TYPE=SIZE arguments sets the quantity per type.
```
Expand Down Expand Up @@ -300,7 +300,7 @@ DESCRIPTION
Called with no arguments shows the current dyno size.
Called with one argument sets the size.
Where SIZE is one of free|eco|hobby|standard-1x|standard-2x|performance
Where SIZE is one of eco|basic|standard-1x|standard-2x|performance
Called with 1..n TYPE=SIZE arguments sets the quantity per type.
```
Expand Down
28 changes: 14 additions & 14 deletions packages/addons-v5/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports.topic = {
Add-ons are created with the \`addons:create\` command, providing a reference
to an add-on service (such as \`heroku-postgresql\`) or a service and plan
(such as \`heroku-postgresql:hobby-dev\`).
(such as \`heroku-postgresql:mini\`).
At creation, each add-on is given a globally unique name. In addition, each
add-on has at least one attachment alias to each application which uses the
Expand All @@ -21,34 +21,34 @@ exports.topic = {
is \`postgresql-deep-6913\` with a default attachment alias of \`DATABASE\`:
$ heroku addons:create heroku-postgresql --app my-app
Creating postgresql-deep-6913... done, (free)
Creating postgresql-deep-6913... done, (mini)
Adding postgresql-deep-6913 to my-app... done
Setting DATABASE_URL and restarting my-app... done, v5
Database has been created and is available
$ heroku addons --app my-app
Add-on Plan Price
───────────────────────────────────────── ───────── ─────
heroku-postgresql (postgresql-deep-6913) hobby-dev free
Add-on Plan Price
───────────────────────────────────────── ──── ────────
heroku-postgresql (postgresql-deep-6913) mini $5/month
└─ as DATABASE
The add-on name and, in some cases, the attachment alias can be specified by
the user. For instance, we can add a second database to the app, specifying
both these identifiers:
$ heroku addons:create heroku-postgresql --app my-app --name main-db --as PRIMARY_DB
Creating main-db... done, (free)
Creating main-db... done, ($5/month)
Adding main-db to my-app... done
Setting PRIMARY_DB_URL and restarting my-app... done, v6
Database has been created and is available
$ heroku addons --app my-app
Add-on Plan Price
───────────────────────────────────────── ───────── ─────
heroku-postgresql (main-db) hobby-dev free
Add-on Plan Price
───────────────────────────────────────── ──── ────────
heroku-postgresql (main-db) mini $5/month
└─ as PRIMARY_DB
heroku-postgresql (postgresql-deep-6913) hobby-dev free
heroku-postgresql (postgresql-deep-6913) mini $5/month
└─ as DATABASE
Attachment aliases can also be specified when making attachments:
Expand All @@ -58,13 +58,13 @@ exports.topic = {
Setting ANOTHER_NAME vars and restarting my-app... done, v7
$ heroku addons --app my-app
Add-on Plan Price
───────────────────────────────────────── ───────── ─────
heroku-postgresql (main-db) hobby-dev free
Add-on Plan Price
───────────────────────────────────────── ──── ────────
heroku-postgresql (main-db) mini $5/month
├─ as PRIMARY_DB
└─ as ANOTHER_NAME
heroku-postgresql (postgresql-deep-6913) hobby-dev free
heroku-postgresql (postgresql-deep-6913) mini $5/month
└─ as DATABASE
For more information, read https://devcenter.heroku.com/articles/add-ons`
Expand Down
10 changes: 5 additions & 5 deletions packages/addons-v5/test/commands/addons.--all.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ describe('addons --all', function () {
it('prints add-ons in a table', function () {
return cmd.run({ flags: {} }).then(function () {
util.expectOutput(cli.stdout,
`Owning App Add-on Plan Price State
──────────── ───────── ─────────────────────────── ───────── ────────
acme-inc-api api-redis heroku-redis:premium-2 $60/month created
acme-inc-www www-db heroku-postgresql:hobby-dev free created
acme-inc-www www-redis heroku-redis:premium-2 $60/month creating`)
`Owning App Add-on Plan Price State
──────────── ───────── ────────────────────── ───────── ────────
acme-inc-api api-redis heroku-redis:premium-2 $60/month created
acme-inc-www www-db heroku-postgresql:mini $5/month created
acme-inc-www www-redis heroku-redis:premium-2 $60/month creating`)
})
})

Expand Down
16 changes: 8 additions & 8 deletions packages/addons-v5/test/commands/addons.--app.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('addons --app', function () {
util.expectOutput(cli.stdout, `
Add-on Plan Price State
────────────────────────── ───────── ───────── ────────
heroku-postgresql (www-db) hobby-dev free created
heroku-postgresql (www-db) mini $5/month created
└─ as DATABASE
heroku-redis (www-redis) premium-2 $60/month creating
Expand All @@ -72,9 +72,9 @@ The table above shows add-ons and the attachments to the current app (acme-inc-w
])
return run('acme-inc-www', function () {
util.expectOutput(cli.stdout, `
Add-on Plan Price State
───────────────────────────────── ───────── ───── ───────
heroku-postgresql (www-db) hobby-dev free created
Add-on Plan Price State
───────────────────────────────── ──── ──────── ───────
heroku-postgresql (www-db) mini $5/month created
├─ as DATABASE
└─ as WWW_DB on acme-inc-dwh app
Expand All @@ -91,9 +91,9 @@ The table above shows add-ons and the attachments to the current app (acme-inc-w

return run('acme-inc-dwh', function () {
util.expectOutput(cli.stdout, `
Add-on Plan Price State
─────────────────────────────────── ───────── ──────────────────────────── ───────
heroku-postgresql (www-db) hobby-dev (billed to acme-inc-www app) created
Add-on Plan Price State
─────────────────────────────────── ──── ──────────────────────────── ───────
heroku-postgresql (www-db) mini (billed to acme-inc-www app) created
├─ as WWW_DB
└─ as DATABASE on acme-inc-www app
Expand Down Expand Up @@ -171,7 +171,7 @@ The table above shows add-ons and the attachments to the current app (acme-inc-d
])

return run('acme-inc-dwh', function () {
expect(cli.stdout.indexOf('hobby-dev')).to.be.lt(cli.stdout.indexOf('standard-2'))
expect(cli.stdout.indexOf('mini')).to.be.lt(cli.stdout.indexOf('standard-2'))
})
})

Expand Down
2 changes: 1 addition & 1 deletion packages/addons-v5/test/commands/addons/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('addons:docs', function () {
.get('/addon-services/slowdb')
.reply(200, { name: 'slowdb' })

return cmd.run({ args: { addon: 'slowdb:free' }, flags: { 'show-url': true } })
return cmd.run({ args: { addon: 'slowdb' }, flags: { 'show-url': true } })
.then(() => expect(cli.stdout).to.equal('https://devcenter.heroku.com/articles/slowdb\n'))
.then(() => expect(cli.stderr).to.equal(''))
.then(() => api.done())
Expand Down
12 changes: 6 additions & 6 deletions packages/addons-v5/test/commands/addons/info.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('addons:info', function () {
Attachments: acme-inc-www::DATABASE
Installed at: Invalid Date
Owning app: acme-inc-www
Plan: heroku-postgresql:hobby-dev
Price: free
Plan: heroku-postgresql:mini
Price: $5/month
State: created
`)
})
Expand Down Expand Up @@ -71,8 +71,8 @@ State: created
Attachments: acme-inc-www::DATABASE
Installed at: Invalid Date
Owning app: acme-inc-www
Plan: heroku-postgresql:hobby-dev
Price: free
Plan: heroku-postgresql:mini
Price: $5/month
State: created
`)
})
Expand Down Expand Up @@ -109,8 +109,8 @@ State: created
Attachments: acme-inc-www::DATABASE
Installed at: Invalid Date
Owning app: acme-inc-www
Plan: heroku-postgresql:hobby-dev
Price: free
Plan: heroku-postgresql:mini
Price: $5/month
State: created
`)
})
Expand Down
18 changes: 9 additions & 9 deletions packages/addons-v5/test/fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ fixtures.services = {
}

fixtures.plans = {
'heroku-postgresql:hobby-dev': {
'heroku-postgresql:mini': {
'created_at': '2013-10-24T17:21:05Z',
'default': true,
'description': 'Heroku Postgres Hobby Dev',
'human_name': 'Hobby Dev',
'description': 'Heroku Postgres Mini',
'human_name': 'Mini',
'id': '062a1cc7-f79f-404c-9f91-135f70175577',
'name': 'heroku-postgresql:hobby-dev',
'name': 'heroku-postgresql:mini',
'price': {
'cents': 0,
'cents': 500,
'unit': 'month'
},
'state': 'ga',
Expand Down Expand Up @@ -98,10 +98,10 @@ fixtures.addons = {
id: '8895ea98-4c7b-11e5-9a16-2cf0ee2c94de',
name: 'www-db',
addon_service: fixtures.services['heroku-postgresql'],
plan: fixtures.plans['heroku-postgresql:hobby-dev'],
plan: fixtures.plans['heroku-postgresql:mini'],
state: 'provisioned',
billed_price: {
cents: 0
cents: 500
}
},
'www-redis': {
Expand Down Expand Up @@ -131,10 +131,10 @@ fixtures.addons = {
id: '87f63372-60f8-11e5-bd19-2cf0ee2c94de',
name: 'dwh-test-db',
addon_service: fixtures.services['heroku-postgresql'],
plan: fixtures.plans['heroku-postgresql:hobby-dev'],
plan: fixtures.plans['heroku-postgresql:mini'],
state: 'provisioned',
billed_price: {
cents: 0
cents: 500
}
},
'dwh-db': {
Expand Down
6 changes: 3 additions & 3 deletions packages/apps-v5/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ DESCRIPTION
Called with no arguments shows the current dyno size.
Called with one argument sets the size.
Where SIZE is one of free|eco|hobby|standard-1x|standard-2x|performance
Where SIZE is one of eco|basic|standard-1x|standard-2x|performance
Called with 1..n TYPE=SIZE arguments sets the quantity per type.
```
Expand Down Expand Up @@ -769,7 +769,7 @@ DESCRIPTION
Called with no arguments shows the current dyno size.
Called with one argument sets the size.
Where SIZE is one of free|eco|hobby|standard-1x|standard-2x|performance
Where SIZE is one of eco|basic|standard-1x|standard-2x|performance
Called with 1..n TYPE=SIZE arguments sets the quantity per type.
```
Expand Down Expand Up @@ -865,7 +865,7 @@ DESCRIPTION
Called with no arguments shows the current dyno size.
Called with one argument sets the size.
Where SIZE is one of free|eco|hobby|standard-1x|standard-2x|performance
Where SIZE is one of eco|basic|standard-1x|standard-2x|performance
Called with 1..n TYPE=SIZE arguments sets the quantity per type.
```
Expand Down
6 changes: 2 additions & 4 deletions packages/apps-v5/src/commands/ps/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function printExtended (dynos) {
})
}

async function printAccountQuota(context, heroku, app, account) {
async function printAccountQuota (context, heroku, app, account) {
if (app.process_tier !== 'free' && app.process_tier !== 'eco') {
return
}
Expand Down Expand Up @@ -83,10 +83,8 @@ async function printAccountQuota(context, heroku, app, account) {
cli.log('https://devcenter.heroku.com/articles/dyno-sleeping')
cli.log()
}

}


function printDynos (dynos) {
let dynosByCommand = reduce(dynos, function (dynosByCommand, dyno) {
let since = time.ago(new Date(dyno.updated_at))
Expand All @@ -113,7 +111,7 @@ function printDynos (dynos) {
})
}

async function run(context, heroku) {
async function run (context, heroku) {
const { app, flags, args } = context
const types = args
const { json, extended } = flags
Expand Down
31 changes: 15 additions & 16 deletions packages/apps-v5/src/commands/ps/type.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
let cli = require('heroku-cli-util')
const { sortBy, compact } = require('lodash')

const costs = { 'Free': 0, 'Eco': 0, 'Hobby': 7, 'Standard-1X': 25, 'Standard-2X': 50, 'Performance-M': 250, 'Performance': 500, 'Performance-L': 500, '1X': 36, '2X': 72, 'PX': 576 }
const costs = { 'Free': 0, 'Eco': 0, 'Hobby': 7, 'Basic': 7, 'Standard-1X': 25, 'Standard-2X': 50, 'Performance-M': 250, 'Performance': 500, 'Performance-L': 500, '1X': 36, '2X': 72, 'PX': 576 }

let emptyFormationErr = (app) => {
return new Error(`No process types on ${app}.
Upload a Procfile to add process types.
https://devcenter.heroku.com/articles/procfile`)
}

async function run(context, heroku) {
async function run (context, heroku) {
let app = context.app

let parse = async function (args) {
Expand Down Expand Up @@ -40,28 +40,28 @@ Types: ${cli.color.yellow(formation.map((f) => f.type).join(', '))}`)

formation = sortBy(formation, 'type')

let dynoTotals = [];
let isShowingEcoCostMessage = false;
let dynoTotals = []
let isShowingEcoCostMessage = false

formation.forEach((d) => {
if (d.size === 'Eco' && d.quantity !== 0) {
isShowingEcoCostMessage = true;
if (d.size === 'Eco') {
isShowingEcoCostMessage = true
}

if (shielded) {
d.size = d.size.replace('Private-', 'Shield-')
}
if(d.size in dynoTotals) {
dynoTotals[d.size] += d.quantity;
if (d.size in dynoTotals) {
dynoTotals[d.size] += d.quantity
} else {
dynoTotals[d.size] = d.quantity;
dynoTotals[d.size] = d.quantity
}
});
})

dynoTotals = Object.keys(dynoTotals).map((k) => ({
type: cli.color.green(k),
type: cli.color.green(k),
total: cli.color.yellow(dynoTotals[k])
}));
}))

formation = formation.map((d) => ({
type: cli.color.green(d.type),
Expand All @@ -70,10 +70,9 @@ Types: ${cli.color.yellow(formation.map((f) => f.type).join(', '))}`)
'cost/mo': costs[d.size] ? '$' + (costs[d.size] * d.quantity).toString() : ''
}))


if (formation.length === 0) throw emptyFormationErr()

cli.styledHeader('Dyno Types');
cli.styledHeader('Dyno Types')
cli.table(formation, {
columns: [
{ key: 'type' },
Expand All @@ -83,7 +82,7 @@ Types: ${cli.color.yellow(formation.map((f) => f.type).join(', '))}`)
]
})

cli.styledHeader('Dyno Totals');
cli.styledHeader('Dyno Totals')

cli.table(dynoTotals, {
columns: [
Expand Down Expand Up @@ -111,7 +110,7 @@ let cmd = {
Called with no arguments shows the current dyno size.
Called with one argument sets the size.
Where SIZE is one of free|eco|hobby|standard-1x|standard-2x|performance
Where SIZE is one of eco|basic|standard-1x|standard-2x|performance
Called with 1..n TYPE=SIZE arguments sets the quantity per type.
`,
Expand Down
2 changes: 1 addition & 1 deletion packages/apps-v5/src/error_info.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ module.exports = [
},
{
'name': 'H82',
'title': 'Free dyno quota exhausted',
'title': "You've used up your dyno hour pool",
'level': 'info'
},
{
Expand Down
Loading

0 comments on commit 0f52326

Please sign in to comment.