shalom 0.2.1 → 1.0.0
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/.gitignore +5 -0
- data/Gemfile +1 -0
- data/LICENSE.txt +7 -0
- data/README.md +6 -0
- data/Rakefile +5 -0
- data/bin/console +4 -0
- data/lib/data/languages.json +7 -0
- data/lib/greeter.rb +23 -0
- data/runner.rb +13 -0
- data/shalom.gemspec +20 -0
- data/spec/test_shalom.rb +10 -0
- metadata +75 -8
- data/lib/shalom.rb +0 -8
- data/lib/shalom/translator.rb +0 -18
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 434a1b5fe42574a58f2b3db542bbb6217f793024
|
|
4
|
+
data.tar.gz: 6429005b2fb3d147e0f10961e44e3c5c2124a399
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 370c4f60ad8215228b6c2745b4ad53ab32887406c293924c5dc5d8146772e11dc9345bd2735927f27e80ebb091467d906dfa1723d6931fdd09714c103cf9f006
|
|
7
|
+
data.tar.gz: 70ca92269b8c23c8f1bd5232d9ee4a0cb731eaa1fa9b44f842019af2c205ff492af1da78f38321a32d062ead4361078ca4915ba9a895a898c65ac2477046964c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
gemspec
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2018 Dmitri McGuckin
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
data/Rakefile
ADDED
data/bin/console
ADDED
data/lib/greeter.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
class Greeter
|
|
2
|
+
attr_reader :languages
|
|
3
|
+
|
|
4
|
+
def initialize(file_path = (__dir__ + '/data/languages.json'))
|
|
5
|
+
@languages = load_languages file_path
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def greet_in(language, vlad, say)
|
|
9
|
+
language = language.to_s.downcase
|
|
10
|
+
raise ArgumentError, "#{language.upcase} LANGUAGE NOT FOUND!" if @languages[language].nil?
|
|
11
|
+
string = @languages[language.to_s.downcase].to_s.chomp
|
|
12
|
+
string << ", vlad." if vlad
|
|
13
|
+
puts string if say
|
|
14
|
+
string
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
private
|
|
18
|
+
|
|
19
|
+
def load_languages(file_path)
|
|
20
|
+
raise IOError, "BAD FILE: #{file_path}" unless File.file? file_path
|
|
21
|
+
JSON.load File.open(file_path)
|
|
22
|
+
end
|
|
23
|
+
end
|
data/runner.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require_relative 'lib/greeter'
|
|
2
|
+
|
|
3
|
+
class Shalom < Thor
|
|
4
|
+
desc 'greet_in', 'Translates the word hello to the language of your choice, returns the string.'
|
|
5
|
+
option :language, type: :string, aliases: 'l', default: 'english', banner: 'Specifies language, default is English.'
|
|
6
|
+
option :vlad, type: :boolean, aliases: 'v', banner: 'Greets Vlad specifically.'
|
|
7
|
+
option :say, type: :boolean, aliases: 's', banner: 'Prints the message to standard IO as well as returning the greeting string'
|
|
8
|
+
def greet_in
|
|
9
|
+
Greeter.new.greet_in options[:language], options[:vlad], options[:say]
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
Shalom.start
|
data/shalom.gemspec
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Gem::Specification.new do |spec|
|
|
2
|
+
spec.name = 'shalom'
|
|
3
|
+
spec.version = '1.0.0'
|
|
4
|
+
spec.date = '2018-08-02'
|
|
5
|
+
spec.summary ='Say hello!'
|
|
6
|
+
spec.description = 'Say hello in new languages!'
|
|
7
|
+
spec.authors = ['Dmitri McGuckin']
|
|
8
|
+
spec.email = 'dmitri.mcguckin@dat.com'
|
|
9
|
+
spec.files = `git ls-files -z`.split("\x00").reject { |file| file.match(%r{^(test|spec|features)/}) }
|
|
10
|
+
spec.homepage = 'https://rubygems.org/gems/shalom'
|
|
11
|
+
spec.license = 'MIT'
|
|
12
|
+
spec.bindir = 'bin'
|
|
13
|
+
spec.executables << 'console'
|
|
14
|
+
spec.test_files = 'spec/test_shalom.rb'
|
|
15
|
+
|
|
16
|
+
spec.add_runtime_dependency 'json', '~> 2.1'
|
|
17
|
+
spec.add_runtime_dependency 'thor', '~> 0.20'
|
|
18
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
|
19
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
|
20
|
+
end
|
data/spec/test_shalom.rb
ADDED
metadata
CHANGED
|
@@ -1,24 +1,90 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: shalom
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dmitri McGuckin
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-
|
|
12
|
-
dependencies:
|
|
11
|
+
date: 2018-08-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: json
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '2.1'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '2.1'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: thor
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '0.20'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '0.20'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: bundler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.16'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.16'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rake
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '12.3'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '12.3'
|
|
13
69
|
description: Say hello in new languages!
|
|
14
70
|
email: dmitri.mcguckin@dat.com
|
|
15
|
-
executables:
|
|
71
|
+
executables:
|
|
72
|
+
- console
|
|
16
73
|
extensions: []
|
|
17
74
|
extra_rdoc_files: []
|
|
18
75
|
files:
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
76
|
+
- ".gitignore"
|
|
77
|
+
- Gemfile
|
|
78
|
+
- LICENSE.txt
|
|
79
|
+
- README.md
|
|
80
|
+
- Rakefile
|
|
81
|
+
- bin/console
|
|
82
|
+
- lib/data/languages.json
|
|
83
|
+
- lib/greeter.rb
|
|
84
|
+
- runner.rb
|
|
85
|
+
- shalom.gemspec
|
|
86
|
+
- spec/test_shalom.rb
|
|
87
|
+
homepage: https://rubygems.org/gems/shalom
|
|
22
88
|
licenses:
|
|
23
89
|
- MIT
|
|
24
90
|
metadata: {}
|
|
@@ -42,4 +108,5 @@ rubygems_version: 2.6.14.1
|
|
|
42
108
|
signing_key:
|
|
43
109
|
specification_version: 4
|
|
44
110
|
summary: Say hello!
|
|
45
|
-
test_files:
|
|
111
|
+
test_files:
|
|
112
|
+
- spec/test_shalom.rb
|
data/lib/shalom.rb
DELETED
data/lib/shalom/translator.rb
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
class Translator
|
|
2
|
-
def initialize(language)
|
|
3
|
-
@language = language
|
|
4
|
-
end
|
|
5
|
-
|
|
6
|
-
def hi
|
|
7
|
-
case @language
|
|
8
|
-
when 'yiddish'
|
|
9
|
-
'Shalom'
|
|
10
|
-
when 'english'
|
|
11
|
-
'Hello'
|
|
12
|
-
when 'spanish'
|
|
13
|
-
'Hola'
|
|
14
|
-
else
|
|
15
|
-
raise ArgumentError, "INVALID SET LANGUAGE"
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|