开发者

How to check your gem list on heroku

开发者 https://www.devze.com 2023-02-08 09:04 出处:网络
I know the command that works to do this, but I don\'t understand why. What is `...` doing in this context.

I know the command that works to do this, but I don't understand why. What is `...` doing in this context.

I know I can run:

开发者_高级运维heroku console
`gem list`

or

heroku console
`gem list`.split("\n")

to get a nice output, but I don't understand what these are doing. Why the ``?


I've updated this in-case someone happens to come across heroku console as it's been disabled.

heroku run gem list

Show gems installed via :git

heroku run bundle show


The back ticks effectively making a system call and return the response that was written to stdout. Take a look at the Kernel ruby docs for more info.


heroku console is basically running an irb console on the remote computer, so you're in a ruby console when you do it. The backticks (`) are a standard way to run a system command in ruby.


In Ruby, you can run a system command either by using Kernel#exec or by placing the contents in backticks. This is the same as typing gem list on the command line and getting the result back as a string.


For example

heroku run 'gem list' 

Becouse

heroku console

is removed from heroku

0

精彩评论

暂无评论...
验证码 换一张
取 消