hola-leco 0.0.10 → 0.0.11
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 +4 -4
- data/lib/hola-leco/util.rb +37 -0
- data/lib/hola-leco.rb +16 -10
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eea5b8a2ebf4f5eddbe5c35b63b50c2732484de
|
4
|
+
data.tar.gz: 6d0e9ce3bdb03f0e0c1abacee28c304e097ace1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26791da6455db60f9721564a80086f73257d977cf9fc845f1ec786dc268bbc407d22f89fb6cda7b402bf62968837fd206497635c1e5f82e09aa9df658cf33e41
|
7
|
+
data.tar.gz: 84bbf8db29a40134dcdf6f6f1c69be5a7af891aaacffe470960a2f1e80d157e7391ae0db4774143cb1be5239fbfde1222c2beadf010812d7d3dfd5bc9db0caf8
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# module Hola
|
2
|
+
module Util
|
3
|
+
extend self
|
4
|
+
def get_options
|
5
|
+
config_dir = File.join(".", "config")
|
6
|
+
config_file_path = nil
|
7
|
+
%w[trackers.yml trackers.yml.erb].each do |config_file|
|
8
|
+
path = File.join(config_dir, config_file)
|
9
|
+
config_file_path ||= path if File.exist?(path)
|
10
|
+
end
|
11
|
+
|
12
|
+
opts = parse_config(config_file_path) if config_file_path
|
13
|
+
puts opts
|
14
|
+
opts
|
15
|
+
end
|
16
|
+
|
17
|
+
def parse_config(path)
|
18
|
+
opts = YAML.load(ERB.new(File.read(path)).result) || {}
|
19
|
+
|
20
|
+
if opts.respond_to? :deep_symbolize_keys!
|
21
|
+
opts.deep_symbolize_keys!
|
22
|
+
else
|
23
|
+
symbolize_keys_deep!(opts)
|
24
|
+
end
|
25
|
+
|
26
|
+
opts
|
27
|
+
end
|
28
|
+
|
29
|
+
def symbolize_keys_deep!(hash)
|
30
|
+
hash.keys.each do |k|
|
31
|
+
symkey = k.respond_to?(:to_sym) ? k.to_sym : k
|
32
|
+
hash[symkey] = hash.delete k
|
33
|
+
symbolize_keys_deep! hash[symkey] if hash[symkey].is_a? Hash
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
# end
|
data/lib/hola-leco.rb
CHANGED
@@ -1,16 +1,22 @@
|
|
1
1
|
require 'bcrypt'
|
2
|
-
|
3
|
-
|
2
|
+
require "fileutils"
|
3
|
+
require "erb"
|
4
|
+
require "yaml"
|
5
|
+
require "hola-leco/util"
|
4
6
|
|
5
7
|
class Hola
|
6
|
-
|
7
|
-
#
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
include Util
|
9
|
+
# include Singleton
|
10
|
+
@@options = nil
|
11
|
+
|
12
|
+
def self.greet(name)
|
13
|
+
puts "hello #{name}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.options
|
17
|
+
@@options = Util.get_options if !@@options
|
18
|
+
@@options
|
19
|
+
end
|
14
20
|
|
15
21
|
def self.hi(language = "english")
|
16
22
|
my_password = BCrypt::Password.create("my password")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hola-leco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Quaranto
|
@@ -66,6 +66,7 @@ extra_rdoc_files: []
|
|
66
66
|
files:
|
67
67
|
- lib/hola-leco.rb
|
68
68
|
- lib/hola-leco/translator.rb
|
69
|
+
- lib/hola-leco/util.rb
|
69
70
|
homepage: https://rubygems.org/gems/hola
|
70
71
|
licenses:
|
71
72
|
- MIT
|