
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
The better Ruby client for Heroku API, built on top of official
heroku.rb
gem.
Add this line to your application's Gemfile:
gem 'ruroku'
And then execute:
$ bundle
Or install it yourself as:
$ gem install ruroku
Start by initiating a connection with Heroku API:
heroku = Ruroku::API.new api_key: YOUR_HEROKU_API_KEY
(You can leave out :api_key
if ENV['HEROKU_API_KEY']
is set
instead.)
Now you can interact with Heroku API using Ruroku.
Each API object has apps associated with the Heroku account. You can
access an Array of all the associated apps with #apps
:
heroku.apps
# => [#<App>, #<App>, #<App>]
app = heroku.apps.first
To get specific app:
app = heroku.app 'app-name'
# or:
app = heroku.apps['app-name']
# or even:
app = heroku['app-name']
And access its properties such as:
id
name
stack
git_url
slug_size
repo_size
dynos
workers
Maintenance mode can be turned on and off:
app.maintenance!
app.no_maintenance!
Also, imagine you've created another app after you you queried
heroku.app
. To refresh collection of apps (or other collections:
addons, config vars, collaborators, and so on), just call #reload
on
collection:
apps.reload
To get a list of addons used by a particular app:
addons = app.addons
# => [#<Addon>, #<Addon>, #<Addon>]
addon = app.addons.first
It's possible perform several actions on addon collections:
# Add an addon
addons.add 'addon:plan'
# Remove an addon
addons.delete 'addon-name'
# Upgrade an addon
addons.upgrade 'addon:new-plan'
Each addon object is associated with the application. You can delete
addons from the app by calling #delete
method on the addon object as
well:
addon.delete!
List all app collaborators:
collaborators = app.collaborators
get a specific collaborator:
collaborators['guy@me.com']
and
# Add a collaborator
collaborators.add 'email@me.com'
# Remove a collaborator
collaborators.delete 'email@me.com'
# or
collaborator.delete!
List all app config vars:
config_vars = app.config_vars
Add or delete a config var:
config_vars.add 'KEY' => 'value'
config_vars.delete 'KEY'
# or:
config_var.delete!
They can also be updated like that:
config_var.value = 'new value'
Get/set a specific var:
config_vars['DEBUG'] # => false
config_vars['DEBUG'] = true
And it'll instantly get updated.
Access domains used by the application:
domains = app.domains
Same as with other collection objects, they can be added or deleted:
domains.add 'domain.com'
domains.delete 'domain.com'
# or:
domain.delete!
Get current application processes:
processes = app.processes
You can also run, restart, scale, and stop method collections:
processes.run 'rake evolve'
processes.restart
processes.scale 'worker', 10
processes.stop 'ps' => 'run.1'
processes.stop 'type' => 'worker'
And access specific processes/process groups:
processes['web.1']
processes['web']
List all app releases:
releases = app.releases
Get specific release:
releases[2]
releases['v2']
Or a range of releases:
releases[1..10]
And rollback to any release:
releases.rollback 'v1'
release.rollback
List stacks, available for the app:
app.stacks
Migrate the app to available stack:
stacks.migrate 'stack-name'
Get the Array of String log lines:
app.logs
Get User object associtaed with current heroku account:
heroku.user
Access all keys:
keys = heroku.keys
Add a key:
keys.add 'content of id_rsa.pub here...'
Delete specific key:
keys.delete 'email@me.com'
key.delete!
Delete all keys:
keys.delete_all
For practice or testing you can also use a simulated Heroku:
require 'ruroku'
heroku = Ruroku::API.new api_key: API_KEY, mock: true
After that commands should still behave the same, but they will only modify some local data instead of updating the state of things on Heroku.
git checkout -b my-new-feature
)git commit -am 'Added some feature'
)git push origin my-new-feature
)Released under the MIT license.
FAQs
Unknown package
We found that ruroku demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.