(Ruby Gems)
Every language has its package manager which helps it by providing libraries and a standard format to distribute Ruby program. It is a type of tool which is developed to easily facilitate the installation of Gems. The command-line tool is the interface used by Ruby gems which provide service in installing and managing libraries.
每种语言都有其包管理器,可通过提供库和标准格式来分发Ruby程序来帮助它。 它是一种开发用于轻松安装Gems的工具。 命令行工具是Ruby gem使用的界面,可在安装和管理库时提供服务。
(Structure of Gems)
Every gem is identical by a version, platform and obviously, a name. The architecture of CPU, Type of Operating System and version are few of the factors which decide the working criteria of Gem.
每个宝石在版本,平台和名称上都是相同的。 CPU的体系结构,操作系统的类型和版本是决定Gem工作标准的因素很少。
Each gem comprises of:
每个宝石包括:
- Documentation
文献资料 - Code
码 - Gemspec i.e. Gem specification
Gemspec,即Gem规范
The organisation of code follows the structure which is mentioned below:
代码的组织遵循以下结构:
Now let us understand each term in a single line.
现在让我们在一行中了解每个术语。
- The bin directory contains the binary file.
bin目录包含二进制文件。 - The code for the gem is being stored by lib directory.
gem的代码由lib目录存储。 - The testing is conducted by the test directory.
测试由测试目录执行。 - Generation of code and automation of test id done by Rake which used Rakefile.
使用Rakefile的Rake完成代码的生成和测试ID的自动化。 - README simply comprises documentation for most of the gems.
自述文件仅包含大多数宝石的文档。 - Information like the purpose of the gem, the time gem was created, author gem belongs to, is contained by Gem specification also known as gemspec.
诸如宝石的目的,宝石的创建时间,作者的宝石所属之类的信息包含在宝石规范(也称为gemspec)中。
(Using Gems)
Gem contains files to install along with package information. The practice of building gems directly is known as Rake. The gems are generally built from ".gemspec"
宝石包含要安装的文件以及软件包信息。 直接建造宝石的做法被称为耙 。 宝石通常是从“ .gemspec”文件构建的。 让我们了解以下出于各种目的列出的gem命令:
For installation, type the following in the terminal,
要进行安装,请在终端中键入以下内容:
gem install mygem
For uninstallation, use the following command,
要卸载,请使用以下命令,
gem uninstall mygem
For listing installed gems, type the following,
要列出已安装的宝石,请键入以下内容,
gem list
For listing available gem, write the following,
要列出可用的宝石,请输入以下内容:
gem list -r
In order to create RDoc documentation for all gems, type the following,
为了为所有gem创建RDoc文档,请键入以下内容,
gem rdoc -all
For adding a trusted certificate, type the following command,
要添加受信任的证书,请键入以下命令,
gem cert -a
If you want to download but you do not want to install the downloaded gem at that instant, for meeting that purpose type the following,
如果您要下载但不想在那一刻安装已下载的gem,为达到该目的,请键入以下内容,
gem fetch mygem
If you want to search the gems which are available for use, type the following command,
如果要搜索可用的宝石,请键入以下命令,
gem search (STRING) --remote
We have got a gem command which is available to provide help in building and maintaining ".gemspec" or ".gem" files. This process is known by the name of package building. If you want to build a .gem file from .gemspec
“ .gemspec”或“ .gem”文件。 此过程称为打包构建的名称。 如果你想从.gemspec文件建立一个.gem文件,宝石终端上使用以下命令,
gem build (gem_name).gemspec
ruby宝石区块链最新消息