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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7dec72ae6bb5183f89ae4b799295efd416e0581a
4
- data.tar.gz: 065b20fe77309864c2af673561a1a0d3be90ded2
3
+ metadata.gz: 434a1b5fe42574a58f2b3db542bbb6217f793024
4
+ data.tar.gz: 6429005b2fb3d147e0f10961e44e3c5c2124a399
5
5
  SHA512:
6
- metadata.gz: 6271b5f00f7c3ed374499ce5eb0f7ea5874d34a5e7c79a2b36d22e500851b0ac934f35a9851bb7b4b9aa9fbb073f01137a0f6b4b73470af5e5d6a2db64904b6b
7
- data.tar.gz: fe38b8394dc26a91d701974b93852fd50d72713302aef7e31a6e4d7b84b88e38224b0e94e5aecc6f2950b9854249713fca924f8407be34c51365b87d335a1d9c
6
+ metadata.gz: 370c4f60ad8215228b6c2745b4ad53ab32887406c293924c5dc5d8146772e11dc9345bd2735927f27e80ebb091467d906dfa1723d6931fdd09714c103cf9f006
7
+ data.tar.gz: 70ca92269b8c23c8f1bd5232d9ee4a0cb731eaa1fa9b44f842019af2c205ff492af1da78f38321a32d062ead4361078ca4915ba9a895a898c65ac2477046964c
@@ -0,0 +1,5 @@
1
+ # Specific Files
2
+ **/*.lock
3
+
4
+ # Specific Directories
5
+ **/.idea
data/Gemfile ADDED
@@ -0,0 +1 @@
1
+ gemspec
@@ -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.
@@ -0,0 +1,6 @@
1
+ # Shalom
2
+ #### Say helo in new languages
3
+
4
+ ###Usage
5
+
6
+ For a local interactive console, run `./bin/console`
@@ -0,0 +1,5 @@
1
+ task default: %w[test]
2
+
3
+ task :spec do
4
+ ruby 'spec/test_shalom.rb'
5
+ end
@@ -0,0 +1,4 @@
1
+ #!/c/Ruby24-x64/bin/ruby
2
+ require 'shalom' # Production console
3
+ # require_relative '../runner' # Development console
4
+ Shalom.start(ARGV)
@@ -0,0 +1,7 @@
1
+ {
2
+ "english": "hello",
3
+ "arabic": "marhabaan",
4
+ "spanish": "hola",
5
+ "french": "Bonjour",
6
+ "yiddish": "hela"
7
+ }
@@ -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
@@ -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
@@ -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
@@ -0,0 +1,10 @@
1
+ require 'rspec'
2
+ require_relative '../lib/greeter'
3
+
4
+ RSpec.describe Greeter do
5
+ context 'When translating hello' do
6
+ pending
7
+ it 'in English, it should say Hello back' do
8
+ end
9
+ end
10
+ end
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.2.1
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-07-19 00:00:00.000000000 Z
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
- - lib/shalom.rb
20
- - lib/shalom/translator.rb
21
- homepage: https://duckduckgo.com
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
@@ -1,8 +0,0 @@
1
- require 'shalom/translator'
2
-
3
- class Shalom
4
- def self.hi(lang = 'english')
5
- translator = Translator.new lang
6
- translator.hi
7
- end
8
- end
@@ -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