Can someone please break down the very very beginnings of how to run a Gemfile. I've read the Bundler webiste and it says I have to type "Gem Install Bundler" then source "https://rubygems.org". Everytime I do that I get an error message saying "Source is not recognised as an internal or external command, operable program or batch file. I've tried creating an empty gemfile first by typing "bundle init" but when I type my source, I get the error message. I also found some literature about telling it to look in github and tried to direct it to the actual project in github but it gave me the same error message.
有人可以打破如何运行Gemfile的最开始。我已经阅读了Bundler网站,它说我必须输入“Gem Install Bundler”然后输入“https://rubygems.org”。每当我这样做时,我收到一条错误消息,说“源不被识别为内部或外部命令,可操作程序或批处理文件。我已经尝试通过键入”bundle init“来创建一个空的gemfile但是当我输入我的源时,我收到了错误消息。我还发现了一些关于告诉它查看github的文献,并试图将它指向github中的实际项目,但它给了我相同的错误消息。
I am completely new to coding but have to run some gems off a file in github to test my answers on some questions I've been given. There's a gemfile on the github page with this in it:
我对编码完全不熟悉,但是必须在github中的一个文件中运行一些宝石,以便在我给出的一些问题上测试我的答案。 github页面上有一个gemfile,里面有:
source 'https://rubygems.org'
gem rspec
gem pry
Any help for an absolute beginner is much appreciated.
对绝对初学者的任何帮助都非常感谢。
2 个解决方案
#1
0
You need to use source 'http://rubygems.org'
not https://
which isn't supported yet
你需要使用源代码'http://rubygems.org'而不是https://这是不支持的
#2
0
Run
gem install bundler
then you can author a Gemfile
like
那么你可以创建像Gemfile一样的
source 'https://rubygems.org'
gem 'rspec'
gem 'pry'
after this, you may run
在此之后,你可能会跑
bundle install
and as an outcome rspec and pry gems will be installed in your system.
作为结果,rspec和pry gems将安装在您的系统中。
You have more information about Gemfiles in Bundler official documentation.
您在Bundler官方文档中有关于Gemfiles的更多信息。
Also, bear in mind that you are installing those gems system-wide, this might cause dependency problems and/or version problems if you have more projects where those gems are required. If that is the case, I recommend you using something to control Ruby versions and gemsets, for example RVM.
另外,请记住,您正在系统范围内安装这些gem,如果您有更多需要这些gem的项目,这可能会导致依赖性问题和/或版本问题。如果是这种情况,我建议您使用一些东西来控制Ruby版本和gemsets,例如RVM。
#1
0
You need to use source 'http://rubygems.org'
not https://
which isn't supported yet
你需要使用源代码'http://rubygems.org'而不是https://这是不支持的
#2
0
Run
gem install bundler
then you can author a Gemfile
like
那么你可以创建像Gemfile一样的
source 'https://rubygems.org'
gem 'rspec'
gem 'pry'
after this, you may run
在此之后,你可能会跑
bundle install
and as an outcome rspec and pry gems will be installed in your system.
作为结果,rspec和pry gems将安装在您的系统中。
You have more information about Gemfiles in Bundler official documentation.
您在Bundler官方文档中有关于Gemfiles的更多信息。
Also, bear in mind that you are installing those gems system-wide, this might cause dependency problems and/or version problems if you have more projects where those gems are required. If that is the case, I recommend you using something to control Ruby versions and gemsets, for example RVM.
另外,请记住,您正在系统范围内安装这些gem,如果您有更多需要这些gem的项目,这可能会导致依赖性问题和/或版本问题。如果是这种情况,我建议您使用一些东西来控制Ruby版本和gemsets,例如RVM。