habluhablu 0.2.8 → 0.3.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
  SHA256:
3
- metadata.gz: 34250c63152fd8c1edef7805706653e8d7519f82e2d9eb0b2a1a4c46ed45b205
4
- data.tar.gz: 1b952efb739c4e058012099bb48d8f8b4cbed95fc068fc76f2150d9b80e6e111
3
+ metadata.gz: 74cc8fdd9b2fe0b2cb45b4457eec91c27745560026c457856b068d47f8d9ea47
4
+ data.tar.gz: 12e305f318399b37b365bb6914e14a47dd09ef17b98bffe0c4a476ca1cd8c436
5
5
  SHA512:
6
- metadata.gz: 0a1a9023550540129a30498896da86f1d1e4f8c8f1554757496fe9be0411150e03235ac27321f97bbc53d64daf502b2f2eaea32ffc3e4e5cd21b2000fe6b2356
7
- data.tar.gz: ec5787b1a724896153d520bb97b2a196d06351c0dbbd4b68fa11f385b3f984a629ecadc17965ee7afcbbcea7e24f4c6b080a5c2f9295c0e39627df8a44a1347e
6
+ metadata.gz: 5d4e5b984fb6bcf5948dca8fefddfa391fbb3b17efc8a1e8957f0e0b1150e88c9a8f45e32fe2675e6c53613c3b3d34175a01bdbab3cb13e30c6414b493f4fcf9
7
+ data.tar.gz: edd8228e983a65532bea4d576df2be32f9693c97b60943b242d3d3c74b3b3f41bece5faf1855b52988636f1ede4ef8e8e404774f7839f2cb34499fb433a70cd8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- habluhablu (0.2.8)
4
+ habluhablu (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,46 @@
1
+ ---
2
+ es:
3
+ date:
4
+ months_names:
5
+ - Enero
6
+ - Febrero
7
+ - Marzo
8
+ - Abril
9
+ - Mayo
10
+ - Junio
11
+ - Julio
12
+ - Agosto
13
+ - Septiembre
14
+ - Octubre
15
+ - Noviembre
16
+ - Dieciembre
17
+ abbr_month_names:
18
+ - Ene
19
+ - Feb
20
+ - Mar
21
+ - Abr
22
+ - May
23
+ - Jun
24
+ - Jul
25
+ - Ago
26
+ - Set
27
+ - Oct
28
+ - Nov
29
+ - Dic
30
+ welcome: Bienvenido
31
+ registration: Regístrate
32
+ log_in: Iniciar sesión
33
+ log_in_with: Iniciar sesión con %{replace}
34
+ log_out: Cerrar la sesión
35
+ email_address: Dirección de correo electrónico
36
+ username: Nombre de usuario
37
+ password: Contraseña
38
+ remember_me: Recordarme
39
+ forgot_password: "¿Has olvidado tu contraseña?"
40
+ do_not_have_account: "¿No tienes una cuenta?"
41
+ lorem: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
42
+ incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
43
+ exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute
44
+ irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
45
+ pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
46
+ deserunt mollit anim id est laborum.
@@ -0,0 +1,16 @@
1
+ ---
2
+ iw:
3
+ welcome: שלום
4
+ registration: הירשם
5
+ log_in: להתחבר
6
+ log_in_with: "%{replace}התחבר ל"
7
+ log_out: להתנתק
8
+ email_address: אימייל
9
+ username: שם משתמש
10
+ password: סיסמה
11
+ remember_me: זכור אותי
12
+ forgot_password: שכחת את הסיסמא?
13
+ do_not_have_account: אין לך חשבון?
14
+ lorem: כדי יסוד מונחים מועמדים של, דת דפים מאמרשיחהצפה זאת. אתה דת שונה כלשהו, גם
15
+ אחר ליום בשפות, או ניווט פולנית לחיבור ארץ. ויש בקלות ואמנות אירועים או, אל אינו
16
+ כלכלה שתי.
data/exe/habluhablu CHANGED
@@ -11,30 +11,11 @@ OptionParser.new do |opts|
11
11
  opts.on("-l", "--language SYMBOL", "Symbol of the language you want to generate file for (en, es, ...).")
12
12
  opts.on("-m", "--multi SYMBOLS", "Symbols of languages you want to generate files for (en es pl ar)")
13
13
  opts.on("-k", "--keyword KEYWORD", "Add your own keyword for all language files (.yml).")
14
+ opts.on("-s", "--sample FILES", "Add your own sample for language files (.yml).")
14
15
  end.parse!(into: args)
15
16
 
16
- if args[:multi].nil?
17
- if args[:keyword].nil?
18
- Habluhablu.hablu(args[:language])
19
- if File.exist?("config/locales/#{args[:language]}.yml")
20
- puts "..."
21
- sleep 0.5
22
- puts "Everything was generated successfully!"
23
- else
24
- puts "Something went wrong!"
25
- end
26
- else
27
- Habluhablu.keyword(args[:keyword])
28
- puts "..."
29
- sleep 0.5
30
- puts "Everything was added successfully!"
31
- end
32
- else
33
- languages_array = args[:multi].split("_")
34
- languages_array.each do |language|
35
- Habluhablu.hablu(language)
36
- end
37
- if File.exist?("config/locales/#{languages_array.last}.yml")
17
+ information = lambda do |param|
18
+ if File.exist?("config/locales/#{param}.yml")
38
19
  puts "..."
39
20
  sleep 0.5
40
21
  puts "Everything was generated successfully!"
@@ -42,3 +23,26 @@ else
42
23
  puts "Something went wrong!"
43
24
  end
44
25
  end
26
+
27
+ if args[:sample].nil?
28
+ if args[:multi].nil?
29
+ if args[:keyword].nil?
30
+ Habluhablu.hablu(args[:language])
31
+ information.call(args[:language])
32
+ else
33
+ Habluhablu.keyword(args[:keyword])
34
+ puts "..."
35
+ sleep 0.5
36
+ puts "Everything was added successfully!"
37
+ end
38
+ else
39
+ languages_array = args[:multi].split("_")
40
+ languages_array.each do |language|
41
+ Habluhablu.hablu(language)
42
+ end
43
+ information.call(languages_array.last)
44
+ end
45
+ else
46
+ Habluhablu.render_sample(args[:sample])
47
+ information.call("sample")
48
+ end
data/lib/habluhablu.rb CHANGED
@@ -14,6 +14,13 @@ module Habluhablu
14
14
  end
15
15
  end
16
16
 
17
+ # Cutom error with helpful message
18
+ class NoSampleError < Error
19
+ def initialize
20
+ super("There is no sample.yml file!")
21
+ end
22
+ end
23
+
17
24
  # Cutom error with helpful message
18
25
  class GemI18nError < Error
19
26
  def initialize
@@ -49,4 +56,17 @@ module Habluhablu
49
56
  end
50
57
  end
51
58
  end
59
+
60
+ def self.render_sample(languages)
61
+ raise NoSampleError.new unless File.exist?("config/locales/sample.yml")
62
+
63
+ languages = languages.split("_")
64
+ languages.each do |language|
65
+ File.open("config/locales/sample.yml", "r") do |f|
66
+ File.open("config/locales/#{language}.yml", "a+") do |fl|
67
+ fl.write(f.read)
68
+ end
69
+ end
70
+ end
71
+ end
52
72
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Habluhablu
4
- VERSION = "0.2.8"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: habluhablu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Gramatowski
@@ -31,6 +31,8 @@ files:
31
31
  - Rakefile
32
32
  - bin/console
33
33
  - bin/setup
34
+ - config/locales/es.yml
35
+ - config/locales/iw.yml
34
36
  - exe/habluhablu
35
37
  - habluhablu.gemspec
36
38
  - lib/habluhablu.rb