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'
相关推荐
How to Build a Web Dynpro Application
Quantitative Trading - How to Build Your Own Algorithmic Trading Business.
How to build up a high performance team, experts will give you much instructions..
ASP.NET Core 1.1 For Beginners How to Build a MVC Website 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载...
Beowulf集群的简要介绍,适合中小企业和资金不多又需要高速度运算的公司。做简单的搜索网站,在安排硬件和软件环境时也用得上。
Basic Concepts – What’s control in WPF? – Control Principles? – ContentModel – ContentPresenter & ItemsPresenter Build a ColorPicker control
本书是互联网产品经理必读刊物,讲述了如何打造让用户上瘾的产品。
A key feature of RFID-based systems is their very short range: Typical systems are designed to operate at a range of 5-10cm. Despite this very short nominal range, K r and Wool predicted that a rogue...
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
使用Haskell和Monad技术实现一个解释器。又学Monad也学解释器。
How to build a DNA search engine like Google?
How to Build a Ubuntu Linux host under VirtualBox
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 Build a FreeBSD-STABLE firewall with IPFILTER.pdf
How To Write A Dissertation
How to Build Blockchain App How to Build Blockchain App
如何从头开始构建autoML,Bridging WebML to model-driven engineering: From document type definitions to meta object facility,Meta-models are a prerequisite for model-driven engineering (MDE) in general...
高清彩版 ASP.NET Core 2.0 MVC & Razor Pages for Beginners How to Build a Website