Skip to content

Commit 7be6b5e

Browse files
committed
Fix list parameter parsing
Broke in thor v1.3.0 rails/thor#784
1 parent ddc56ec commit 7be6b5e

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

lib/cldr/thor.rb

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ def download
3737

3838
desc "export [--locales=de fr-FR en-ZA] [--components=Numbers Plurals] [--target=#{Cldr::Export::DEFAULT_TARGET}] [--merge/--no-merge]",
3939
"Export CLDR data by locales and components to target dir"
40-
option :locales, aliases: [:l], type: :array, banner: "de fr-FR en-ZA", enum: Cldr::Export::Data::RAW_DATA.locales
41-
option :components, aliases: [:c], type: :array, banner: "Numbers Plurals", enum: Cldr::Export::Data.components
40+
option :locales, aliases: [:l], type: :array, banner: "de fr-FR en-ZA", enum: Cldr::Export::Data::RAW_DATA.locales.map(&:to_s)
41+
option :components, aliases: [:c], type: :array, banner: "Numbers Plurals", enum: Cldr::Export::Data.components.map(&:to_s)
4242
option :target, aliases: [:t], type: :string, default: Cldr::Export::DEFAULT_TARGET, banner: Cldr::Export::DEFAULT_TARGET
4343
option :draft_status,
4444
aliases: [:d],
@@ -53,17 +53,11 @@ def export
5353

5454
formatted_options = options.dup.symbolize_keys
5555

56-
# We do this validation, since thor doesn't
57-
# https://github.com/rails/thor/issues/783
5856
if formatted_options.key?(:locales)
59-
formatted_options[:locales] = formatted_options[:locales].map(&:to_sym) if formatted_options.key?(:locales)
60-
unknown_locales = formatted_options[:locales] - Cldr::Export::Data::RAW_DATA.locales
61-
raise ArgumentError, "Unknown locales: #{unknown_locales.map { |l| "`#{l}`" }.join(", ")}" unless unknown_locales.empty?
57+
formatted_options[:locales] = formatted_options[:locales].map(&:to_sym)
6258
end
6359
if formatted_options.key?(:components)
64-
formatted_options[:components] = formatted_options[:components].map(&:to_sym) if formatted_options.key?(:components)
65-
unknown_components = formatted_options[:components] - Cldr::Export::Data.components
66-
raise ArgumentError, "Unknown components: #{unknown_components.join(", ")}" unless unknown_components.empty?
60+
formatted_options[:components] = formatted_options[:components].map(&:to_sym)
6761
end
6862

6963
if formatted_options.key?(:draft_status)

ruby-cldr.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Gem::Specification.new do |s|
147147
s.add_runtime_dependency("nokogiri", [">= 0"])
148148
s.add_runtime_dependency("psych", [">= 4.0.0"])
149149
s.add_runtime_dependency("rubyzip", [">= 0"])
150-
s.add_runtime_dependency("thor", [">= 0"])
150+
s.add_runtime_dependency("thor", [">= 1.3.0"])
151151
s.add_development_dependency("jeweler", [">= 0"])
152152
s.add_development_dependency("pry", [">= 0"])
153153
s.add_development_dependency("pry-nav", [">= 0"])
@@ -165,6 +165,6 @@ Gem::Specification.new do |s|
165165
s.add_dependency("ruby-lsp", [">= 0"])
166166
s.add_dependency("rubyzip", [">= 0"])
167167
s.add_dependency("test-unit", [">= 0"])
168-
s.add_dependency("thor", [">= 0"])
168+
s.add_dependency("thor", [">= 1.3.0"])
169169
end
170170
end

0 commit comments

Comments
 (0)