On Github rishijain / rubyconfindia14
Build something, Debug Something, Prosper Something .. Something?
Downloaded from: http://www.ideachampions.com/weblogs/WHY.jpg
Wait.. but what?
Name
Code
Release
Underscores for multiple words
Dash when extending
------------------ ------------------------- ------------------------ | gem name | | Module/Class name | | Require statement | ------------------ ------------------------- ------------------------ | | | ----------------------- ------------------ --------------------------- | hello_world | | HelloWorld | | require 'hello_world' | ----------------------- ------------------ --------------------------- | | | ----------------------- ------------------- ----------------------------- | rails-hello_world | |Rails::HelloWorld| |require 'rails/hello_world'| ----------------------- ------------------- -----------------------------
rubygems.org
Command Line
gem query --remote rails
gem query --remote --name-matches '^rails$'
VERSION 1: Initial class is released
VERSION 2: More features added to class
VERSION 3: Bug fixes in existing methods
VERSION 4: Changes which break earlier code
x.y.z
Patch: 0.0.x
Minor: 0.x.0
Major: x.0.0
VERSION 0.0.1 : Initial class is released
VERSION 0.1.0 : More features added to class
VERSION 0.1.1 : Bug fixes in existing methods
VERSION 1.0.0 : Changes which break earlier code
~>
gem 'rails', '~> 3.0.3' gem 'thin', '~> 1.1'
1. Optimistic Way
1. Pessimistic Way
gem 'your_gem_name', '>= 0.1.0'
gem 'your_gem_name', '>= 0.1.0', '< 1.0'
gem push gemname-0.0.1.gem
1.) Signing ruby gems.
2.) App-store type model.
3.) Ask developers to pay for certificates.
Build a public certificate and a private pem files.
$ gem cert --build you@example.com
Public Cert: gem-public_cert.pem
Private Key: gem-private_key.pem
cd /path/to/your/gem mkdir certs cp ~/.ssh/gem-public_cert.pem certs/yourhandle.pem git add certs/yourhandle.pem
s.cert_chain = ['certs/yourhandle.pem'] s.signing_key = File.expand_path("~/.ssh/gem-private_key.pem")
gem cert --add certs/yourhandle.pem
gem build gemname.gemspec
gem install gemname-version.gem -P HighSecurity
gem install gemname -P HighSecurity
1.) No Security: Well, no security at all. Signed packages are treated like unsigned packages.
2.) Low Security:Expiry of certificate
3.) Medium Security: Validation of certificate + Certificate chains
4.) High Security: Medium Security + un-signed gems restriction
Not scalable as number of gems to install increase.
-------------------------- | rubygems@rubygems.org | -------------------------- | ----------------------------------- | | ---------------------------- ----------------------------- | Varis | | Joffrey | ---------------------------- ----------------------------- | | | | --------------- ---------------- ----------- -------------- | Ned Stark | | Tyron | | Khaleesi | | Rob | --------------- ---------------- ----------- --------------
1. You have a problem.
2. Solution found on stack-overflow (some gem )
3. gem install gem_name
1. Read/Write files.
2. Connect to remote server.
3. Grab passwords
4. Own all your rubygems
and a lot more is possible.
@benjamin_smith
1.) awesome_rails_flash_messages
2.) better_date_to_s
3.) be_truthy
gem fetch gemname gem unpack gemname-0.0.1.gem
Take Away: Dont trust gems blindly !!