hola-sergio 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4935ea18f89669ffcac7f2ff89a84a70a53bf2d3
4
- data.tar.gz: f5663eff985cff823423f6309ac9004023767d53
3
+ metadata.gz: 82255fbc80dd5b1b96d7c8b76ac8b96e5aa6f94b
4
+ data.tar.gz: 0710c8c8a2384c6f9dd94d2d147e9cbf79891d20
5
5
  SHA512:
6
- metadata.gz: 8b030e1038dc60dc733a65218eb7b69104c288ee1777da35adf2b51c767d8e8f86c74b9e0b1ebad5cb78126c1a51efbb29446616bcc422e3e027c3efa378c192
7
- data.tar.gz: 3a7a9e91c6b015a81ead6822b39bfbab49f04e975467240c644ef67971d9a59f121d68fc91ae0711d409cfc4d78ce2a1318ec1da6b5360c0db9bab6ecadc5c33
6
+ metadata.gz: 5bb659663285fbfef7ab064ccbaec7f3e50a3d12cc53c546765309a5acd62dbcc401f6b9efc610aef612c5c6e7522ad70de6e8f415e30efd97cbee7d6bea042f
7
+ data.tar.gz: b766c9098e6ab1ce5aa091a0c9b308d62c4065e21b2edfdaf965295da6c6cf3c94fc1b6a807251f1d6c3cdaff37460b7d7b48478e082dc7428a44d861b16c0d6
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2019 Sergio Romero
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ Software), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,148 @@
1
+ make your own gem https://guides.rubygems.org/make-your-own-gem/ [gem1]
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'
146
+
147
+
148
+
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require 'rake/testtask'
2
+
3
+ Rake::TestTask.new do |t|
4
+ t.libs << 'test'
5
+ end
6
+
7
+ desc 'run tests'
8
+ task :default => :test
data/bin/hola ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hola-sergio'
4
+ puts Hola.hi(ARGV[0])
data/lib/hola-sergio.rb CHANGED
@@ -1,5 +1,8 @@
1
1
  class Hola
2
- def self.hi
3
- puts "Hello world!"
2
+ def self.hi(language="english")
3
+ translator=Translator.new(language)
4
+ translator.hi
4
5
  end
5
6
  end
7
+
8
+ require 'hola-sergio/translator'
@@ -0,0 +1,13 @@
1
+ class Hola::Translator
2
+ def initialize(language)
3
+ @language=language
4
+ end
5
+ def hi
6
+ case @language
7
+ when "spanish"
8
+ "hola mundo"
9
+ else
10
+ "hello world"
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,34 @@
1
+ hola-sergio(1) -- the first gem of s-e-r-g-i-o
2
+ ==============================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ gem hola
7
+
8
+ ## DESCRIPTION
9
+
10
+ A simple hello world gem, from a very special man
11
+
12
+ If you would be a real seeker after truth,
13
+ it is necessary that at least once in your life you doubt,
14
+ as far as possible, all things
15
+
16
+ ## INSTALL
17
+
18
+ gem install hola-sergio
19
+
20
+ ## QUICKSTART
21
+
22
+ gem hola
23
+
24
+ ## THANKS
25
+
26
+ * God
27
+
28
+ ## COPYRIGHT
29
+
30
+ hola-sergio is Copyright (C) 2019 Sergio Romero
31
+
32
+ ## SEE ALSO
33
+
34
+ <https://guides.rubygems.org/make-your-own-gem/>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hola-sergio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergio Romero
@@ -10,13 +10,23 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2010-04-28 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: A simple hello world gem, from a very special programmer
14
- email: nick@quaran.to
15
- executables: []
13
+ description: |2
14
+ If you would be a real seeker after truth,
15
+ it is necessary that at least once in your life you doubt,
16
+ as far as possible, all things
17
+ email: sergioro@nmsu.edu
18
+ executables:
19
+ - hola
16
20
  extensions: []
17
21
  extra_rdoc_files: []
18
22
  files:
23
+ - bin/hola
24
+ - lib/hola-sergio/translator.rb
19
25
  - lib/hola-sergio.rb
26
+ - man/hola-sergioro.1.ronn
27
+ - README.md
28
+ - Rakefile
29
+ - LICENSE
20
30
  homepage: http://rubygems.org/gem/hola-sergio
21
31
  licenses:
22
32
  - wtfpl
@@ -40,5 +50,5 @@ rubyforge_project:
40
50
  rubygems_version: 2.0.14.1
41
51
  signing_key:
42
52
  specification_version: 4
43
- summary: Hola!
53
+ summary: A simple hello world gem, from a very special man
44
54
  test_files: []