how to build a ruby gem
1. first you will create a user in rubygem.org (https://rubygems.org/)
2. create the directory structure like this:
$ tree . ├── cc_hola.gemspec └── lib └── cc_hola.rb
you can use any name but you must keep consistency
3. in your .gemspec file
Gem::Specification.new do |s| s.name = 'CcHola' s.version = '0.0.0' s.date = '2014-10-20' s.summary = "A ruby gem build test!" s.description = "A ruby gem build test!" s.authors = ["cckkll"] s.email = '237178842@qq.com' s.files = ["lib/cc_hola.rb"] s.homepage = 'https://github.com/chengyuanheng' end
4. in your .rb file
class CcHola def self.hi puts "Hello World!" end end
5. compiled gem
$ gem build cc_hola.gemspec
Successfully built RubyGem
Name: CcHola
Version: 0.0.0
File: CcHola-0.0.0.gem
$ gem install ccHola-0.0.0.gem
Successfully installed CcHola-0.0.0
1 gem installed
6. test your gem
$ irb > require "cc_hola" => true > CcHola.hi Hello World! => nil
7. release your gem
$ curl -u cckkll https://rubygems.org/api/v1/api_key.yaml >~/.gem/credentials Enter host password for user 'cckkll': $ gem push CcHola-0.0.0.gem Pushing gem to https://rubygems.org... Successfully registered gem: CcHola (0.0.0)
you will find it in your rubygems account and all people can use it by
gem 'CcHola', '~> 0.0.0'
相关推荐
Beowulf集群的简要介绍,适合中小企业和资金不多又需要高速度运算的公司。做简单的搜索网站,在安排硬件和软件环境时也用得上。
### 量化交易:如何构建自己的算法交易业务 #### 核心知识点概述 本文将深入探讨《量化交易:如何构建自己的算法交易业务》一书中的核心知识点。本书由Ernest P. Chan撰写,作为一位在量化交易领域有着丰富经验的...
ASP.NET Core 1.1 Web API For Beginners How To Build a Web API ASP.NET Core 1.1 Web API For Beginners How To Build a Web API ASP.NET Core 1.1 Web API For Beginners How To Build a Web API
ASP.NET Core 1.1 For Beginners: How to Build a MVC Website by Jonas Fagerberg English | 19 May 2017 | ASIN: B071VX7KN4 | 411 Pages | PDF | 6.66 MB Want to learn how to build ASP.NET Core 1.1 MVC Web ...
藏经阁-How to Build a Successful Data Lake.pdf
How To Write A Dissertation
How to Build Blockchain App How to Build Blockchain App
Enterprise Cybersecurity Study Guide How to Build a Successful Cyberdefense Program Against Advanced Threats 英文epub 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请在美国...
Enterprise Cybersecurity Study Guide How to Build a Successful Cyberdefense Program Against Advanced Threats 英文无水印原版pdf 本资源转载自网络,如有侵权,请联系上传者或csdn删除 查看此书详细信息请...
https://github.com/iBotPeaches/Apktool
How to read a book efficiently. Part one The dimensions of reading Part two The third level of reading Part three Approaches to different kinds of reading Part four The ultimate goals of reading
How to Build Big Data Pipelines for Hadoop
How to build compile server with virtualbox & samba
Ruby Performance Optimization: Why Ruby is Slow, and How to Fix It By 作者: Alexander Dymo ISBN-10 书号: 1680500694 ISBN-13 书号: 9781680500691 Edition 版本: 1 出版日期: 2015-11-29 pages 页数: (202) ...
Microsoft-annie wang-How to build inclusive product