hola-sergio 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -145
- data/lib/hola-sergio.rb +8 -6
- data/lib/hola-sergio/version.rb +2 -2
- data/man/hola-sergioro.1 +51 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 694d8e86afb282f49b932c8f0fa786faa4fdd390ef7943837ae879a94df8c407
|
4
|
+
data.tar.gz: be4293d52d87525b81e1b128bca4bcef2a356462de7f30c0794b7c22f5620dc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c03a127df8d967641786a6588d80544bd4ca709023729ca07bdc23989a08f2b3d2711b80757e1493ff933e398af40213e1e151440524e741f5179cb725559ef
|
7
|
+
data.tar.gz: 314b253db61083fb71cb13b97b808d15231f6a19ce766d1842fb75c86f558a715fb6d1ee60752f202c2b89cf5dd25be9832f4e9270527f0a0fcbaa671c3fba46
|
data/README.md
CHANGED
@@ -1,148 +1,7 @@
|
|
1
|
-
|
2
|
-
-it is a convention to use dashes instead of underscores for gem names
|
3
|
-
(as you can see by searching for these two symbols in rubygems.org)
|
4
|
-
-Code for your package is placed within the ./lib . the convention is to
|
5
|
-
have one ruby file with the *same* name as your gem, since that gets
|
6
|
-
loaded when
|
7
|
-
require 'gem-name'
|
8
|
-
is run. That one file will define *all* your setup and API
|
9
|
-
-the .gemspec defines what's in the gem, who made it, and its version.
|
10
|
-
it is also your *interface* to RubyGems.org. *all* the info you see on a
|
11
|
-
gem page comes from the gemspec. the order of the fields dont matter but
|
12
|
-
it is a convention to at least include these information
|
13
|
-
s.name
|
14
|
-
s.version
|
15
|
-
s.date
|
16
|
-
s.summary
|
17
|
-
s.homepage
|
18
|
-
s.email
|
19
|
-
s.authors
|
20
|
-
s.files
|
21
|
-
s.descrition
|
22
|
-
-The description can be as long as you want. if it matches /^== [A-Z]/
|
23
|
-
then the description will be run through RDoc's markup formatter for
|
24
|
-
display on rubygems.org. be aware that other consumers of the data might
|
25
|
-
not understand markup
|
26
|
-
-two examples of how to add files in your gemspec [1]:
|
27
|
-
s.files = ['lib/hola-sergio.rb']
|
28
|
-
s.files = Dir.glob("{bin,lib,man}/**/*") + %w( README.md Rakefile LICENSE )
|
29
|
-
the first one only includes a single file in your gem. the second
|
30
|
-
includes many files. the second one is superior, and is called *dynamic
|
31
|
-
gemspec*.
|
32
|
-
-note how we use Dir.glob above. the *powerful* thing about gemspec is
|
33
|
-
that it is all ruby, so you can wrap scripts to generate the file names
|
34
|
-
and bump the version number. there are many fileds the gemspec can contain.
|
35
|
-
-after you created a gemspec, you can build a gem from it. then you can
|
36
|
-
install the generated gem locally to test it:
|
37
|
-
gem build gem-name.gemspec
|
38
|
-
gem install ./gem-name-0.0.0.gem
|
39
|
-
-Now you can share your gem with the rest of the Ruby community.
|
40
|
-
Publishing your gem out to RubyGems.org only takes one command, provided
|
41
|
-
that you have an account on the site. To setup your computer with your
|
42
|
-
RubyGems account:
|
43
|
-
$ curl -u sergioro https://rubygems.org/api/v1/api_key.yaml > ~/.gem/credentials; chmod 0600 ~/.gem/credentials
|
44
|
-
Enter host password for user 'sergioro':
|
45
|
-
Alternatively might want to simply try entering the above URL in your
|
46
|
-
browser’s address bar. Your browser will ask you to login to rubygems.org
|
47
|
-
Enter your username and password. Your browser will now try to download
|
48
|
-
the file api_key.yaml. Save it in ~/.gem and call it ‘credentials’
|
49
|
-
-now you can push out the gem:
|
50
|
-
gem push gem-name-0.0.0.gem
|
51
|
-
-having everything in one file doesn' scale well, so distribute your
|
52
|
-
source code in several files. the gem's root file is in charge of
|
53
|
-
loading code for the gem. the other files for a gem are usually placed
|
54
|
-
in a directory of the same name of the gem inside of `lib`. *important*
|
55
|
-
if you add new files to your gem dont forget to add them in the gemspec.
|
56
|
-
To automate the updating of gemspec you can use any of Rake, Bundler,
|
57
|
-
Hoe, Jeweler, or just a *dynamc gemspec* see [1] above
|
58
|
-
-when testing ruby gems in `irb` you should include the `-Ilib` flag
|
59
|
-
like so:
|
60
|
-
irb -Ilib -rmy-gem
|
61
|
-
this is so b/c RubyGems includes the lib directory for you, so end users
|
62
|
-
don’t need to worry about configuring their load paths. However, if
|
63
|
-
you’re running the code outside of RubyGems, you have to configure
|
64
|
-
things yourself. It’s possible to manipulate the $LOAD_PATH from within
|
65
|
-
the code itself, but that’s considered an anti-pattern in most cases.
|
66
|
-
-gems can also expose one or many executables file to your shell's PATH.
|
67
|
-
examples are `rake` and `prettify_json.rb`.
|
68
|
-
-adding an executable is easy, you just need to place the file in your
|
69
|
-
gem's `bin` directory and add it to the list oof executables in gemspec:
|
70
|
-
mkdir bin
|
71
|
-
touch bin/hola
|
72
|
-
chmod a+x bin/hola
|
73
|
-
-finally to get hola's executable included when you push the gem, add it
|
74
|
-
in the gemspec:
|
75
|
-
s.executables << 'hola'
|
76
|
-
this will create a commandl ine utility in the user's `~/bin/` directory.
|
77
|
-
you can add more executables in your gem's bin directory if you need to,
|
78
|
-
there's an executables array field on the gemspec, e.g.
|
79
|
-
s.executables = %w(hola adios)
|
80
|
-
-you **should** change the gem's version when pushing up a new realese.
|
81
|
-
-testing your gem is *extremely* important, not only does it help assure
|
82
|
-
you taht your ocde works, but it helps others know that your gem does
|
83
|
-
its job. Rubysts tend to view a solid test suite as one of the main
|
84
|
-
reasons for trusting a gem.
|
85
|
-
-some tools to speed up testing: minitest, rspec
|
86
|
-
-to add some tests to your gem create a `Rakefile` and a `test` directory
|
87
|
-
-to test hola do any of these:
|
88
|
-
rake test
|
89
|
-
rake
|
90
|
-
-by default msot gems use `rdoc` to generate docs. for a tutorial of how
|
91
|
-
to markup your code with rdoc:
|
92
|
-
<http://docs.seattlerb.org/rdoc/RDoc/Markup.html>
|
93
|
-
other good gems for documenting are yard. when you push a gem,
|
94
|
-
rubydoc.info generates yardocs automtically from your gem
|
95
|
-
-nice blog from a rubyst:
|
96
|
-
<http://rubylearning.com/blog/2010/10/06/gem-sawyer-modern-day-ruby-warrior/>
|
97
|
-
|
98
|
-
nice thing about ruby is its hackish Vim-Bash-like syntax. and its
|
99
|
-
community is much more hackish and less scientific than python. also
|
100
|
-
ruby gems remind me of vim scripts
|
101
|
-
|
102
|
-
Using Rdoc https://www.mikeperham.com/2010/12/16/using-rdoc/
|
103
|
-
One longstanding weakness with the Ruby community is subpar
|
104
|
-
documentation. I think many Rubyists tend to look down on actual API
|
105
|
-
documentation, preferring instead to just read source code directly.
|
106
|
-
I've been guilty of this too and I think some of this is due simply to
|
107
|
-
unfamiliarity with *RDoc*.
|
108
|
-
|
109
|
-
how to create man pages for my ruby gem?
|
110
|
-
You would write a manpage for a Ruby executable the same way that
|
111
|
-
you would write a manpage for any other program:
|
112
|
-
-write it in some markup language and translate to roff. popular
|
113
|
-
translators are (e.g ronn, pandoc)
|
114
|
-
OR
|
115
|
-
-just write it directly in ROFF.
|
116
|
-
the former is preferred b/c roff syntax is a pain in the arse. also
|
117
|
-
ronn is used/recommended in gem-man and ronn is written in ruby
|
118
|
-
There is no way to install manpages from RubyGems (what would
|
119
|
-
it do with that on Windows, for example?) but if you want to ship a
|
120
|
-
manpage simply add a ./man directory in your gem root directory.
|
121
|
-
e.g. the gem 'gem-man' contains:
|
122
|
-
|
123
|
-
What is Ruby's double-colon `::`? [so]
|
124
|
-
"::" is basically a namespace resolution operator. It allows you to access
|
125
|
-
items in modules, or class-level items in classes. For example, say you
|
126
|
-
had this setup:
|
127
|
-
module SomeModule
|
128
|
-
module InnerModule
|
129
|
-
class MyClass
|
130
|
-
CONSTANT = 4
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
You could access CONSTANT from outside the module as
|
135
|
-
SomeModule::InnerModule::MyClass::CONSTANT.
|
136
|
-
So `class Parsers::AdfParser` is in practice equivalent to:
|
137
|
-
module Parsers
|
138
|
-
class AdfParser
|
139
|
-
For this to work properly, and the file to be autoloaded its location
|
140
|
-
should be parsers/adf_parser.rb,
|
141
|
-
|
142
|
-
add this to ~/.irbrc
|
143
|
-
https://til.hashrocket.com/posts/09139e5206-enable-commands-history-on-rails-console-and-irb
|
144
|
-
IRB.conf[:SAVE_HISTORY]=200
|
145
|
-
IRB.conf[:HISTORY_FILE]='~/.irb_history'
|
1
|
+
## SYNOPSIS
|
146
2
|
|
3
|
+
Hola Mundo.
|
147
4
|
|
5
|
+
## DESCRIPTION
|
148
6
|
|
7
|
+
My first gem.
|
data/lib/hola-sergio.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
require "hola-sergio/version"
|
2
2
|
require "hola-sergio/translator"
|
3
3
|
|
4
|
-
module
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
4
|
+
module HolaSergio
|
5
|
+
end
|
6
|
+
|
7
|
+
class Hola
|
8
|
+
include HolaSergio
|
9
|
+
def self.hi(language="english")
|
10
|
+
translator=Translator.new(language)
|
11
|
+
translator.hi
|
10
12
|
end
|
11
13
|
end
|
data/lib/hola-sergio/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
module
|
2
|
-
VERSION = "0.1.
|
1
|
+
module HolaSergio
|
2
|
+
VERSION = "0.1.2"
|
3
3
|
end
|
data/man/hola-sergioro.1
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "HOLA\-SERGIO" "1" "March 2019" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBhola\-sergio\fR \- the first gem of s\-e\-r\-g\-i\-o
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
.
|
11
|
+
.nf
|
12
|
+
|
13
|
+
gem hola
|
14
|
+
.
|
15
|
+
.fi
|
16
|
+
.
|
17
|
+
.SH "DESCRIPTION"
|
18
|
+
.
|
19
|
+
.nf
|
20
|
+
|
21
|
+
A simple hello world gem, from a very special man
|
22
|
+
|
23
|
+
If you would be a real seeker after truth,
|
24
|
+
it is necessary that at least once in your life you doubt,
|
25
|
+
as far as possible, all things
|
26
|
+
.
|
27
|
+
.fi
|
28
|
+
.
|
29
|
+
.SH "INSTALL"
|
30
|
+
gem install hola\-sergio
|
31
|
+
.
|
32
|
+
.SH "QUICKSTART"
|
33
|
+
.
|
34
|
+
.nf
|
35
|
+
|
36
|
+
gem hola
|
37
|
+
.
|
38
|
+
.fi
|
39
|
+
.
|
40
|
+
.SH "THANKS"
|
41
|
+
.
|
42
|
+
.IP "\(bu" 4
|
43
|
+
God
|
44
|
+
.
|
45
|
+
.IP "" 0
|
46
|
+
.
|
47
|
+
.SH "COPYRIGHT"
|
48
|
+
hola\-sergio is Copyright (C) 2019 Sergio Romero
|
49
|
+
.
|
50
|
+
.SH "SEE ALSO"
|
51
|
+
\fIhttps://guides\.rubygems\.org/make\-your\-own\-gem/\fR
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hola-sergio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergio Romero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
If you would be a real seeker after truth,
|
@@ -27,10 +27,11 @@ files:
|
|
27
27
|
- lib/hola-sergio.rb
|
28
28
|
- lib/hola-sergio/translator.rb
|
29
29
|
- lib/hola-sergio/version.rb
|
30
|
+
- man/hola-sergioro.1
|
30
31
|
- man/hola-sergioro.1.ronn
|
31
32
|
homepage: https://github.com/sergioro9/hola-sergio
|
32
33
|
licenses:
|
33
|
-
-
|
34
|
+
- MIT
|
34
35
|
metadata: {}
|
35
36
|
post_install_message:
|
36
37
|
rdoc_options: []
|