简体   繁体   English

安装RubyPress

[英]Installing RubyPress

I want to use RubyPress in my project. 我想在我的项目中使用RubyPress。 I've been reading the documentation , and it says that I need to: 我一直在阅读文档 ,它说我需要:

  1. Install the gem using gem install rubypress . 使用gem install rubypress
  2. Add "rubypress" to my gem file. 将“ ruby​​press”添加到我的gem文件中。
  3. In a script require 'rubypress' . 在脚本中require 'rubypress'

I am not sure where to add require 'rubypress' , also I do not know if by doing the installation it should make a class or if I have to create one class and then continue with the process. 我不确定在哪里添加require 'rubypress' ,我也不知道通过安装它是否应该创建一个类,或者是否必须创建一个类然后继续该过程。

I need it so that a user can make or edit the posts on WordPress and then the posts can be viewed on my website. 我需要它,以便用户可以在WordPress上制作或编辑帖子,然后可以在我的网站上查看这些帖子。

I hope that someone can help me with that. 我希望有人可以帮助我。

If you are on a Rails project: 如果您在Rails项目中:

  1. Add gem 'rubypress' to your Gemfile. gem 'rubypress'添加到您的Gemfile中。
  2. Run bundle install . 运行bundle install
  3. It should be auto-required and no require should be needed. 它应该是自动要求,不require应该是必要的。 Use it. 用它。

The require statement is intended for external usage only (non-Rails). require语句仅供外部使用(非Rails)。

Ruby on Rails' goal is to be as simple as possible coming out of the box. Ruby on Rails的目标是尽可能地简单易用。 I have no indication of how far along into the process you are, so I'll start from the beginning. 我没有任何迹象表明您的工作进展如何,所以我将从头开始。

To be a little more explicit on zachfeldman's instructions: 在zachfeldman的说明中更明确一点:

Checking Your Install: 检查安装:

Installing rubypress 安装rubypress

In a terminal/command line shell, type gem install rubypress . 在终端/命令行外壳中,键入gem install rubypress This will either work, or it will fail. 这将起作用,否则将失败。 If you get something like gem: Command not found. 如果您得到gem: Command not found.东西gem: Command not found. it means you don't have gem, or maybe even ruby installed. 这意味着您没有宝石,甚至没有安装红宝石。 You will need to go to https://rubygems.org/pages/download and go from there. 您将需要转到https://rubygems.org/pages/download并从那里进行。

If you get back ERROR: could not find gem rubypress locally or in a repository check your spelling, then your internet settings. 如果返回ERROR: could not find gem rubypress locally or in a repository请检查您的拼写,然后检查您的Internet设置。

Otherwise, rubypress should install nicely. 否则,rubypress应该安装良好。

Adding rubypress to your bundler rubypress添加到捆绑器中

In your [path to your app]/gemfile add the line: gem 'rubypress' . [path to your app]/gemfile添加以下行: gem 'rubypress' This should allow you to now access the gem from anywhere inside of your ruby application. 这应该使您现在可以从红宝石应用程序内部的任何位置访问宝石。 If this doesn't exist, you'll need to build a ruby app. 如果不存在,则需要构建一个ruby应用程序。

Inside a Script 脚本内

Anywhere you want to use rubypress , likely a lot of places, you simply add require 'rubypress' to the top of the file, and that should help you get the rubypress functions you need. 您想在任何地方使用rubypress的任何地方,只需在文件顶部添加require 'rubypress' ,那将有助于您获得所需的rubypress函数。

Feel free to comment on where you get stuck, I'll help you walk through. 随意评论您遇到的困难,我会帮助您完成。 The more details, the better. 细节越多越好。

~POS 〜POS

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM