-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: add custom cli type that accept both bool and hashes * chore: hash values may also be a bool * chore: separate reindex task * chore: move delete and update by query to proper location * chore: rename health file to cluster * feat: add tasks to the cluster api * feat: improve the index reset task by polling the task id * chore: bump version
- Loading branch information
Showing
25 changed files
with
414 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: .. | ||
specs: | ||
esse (0.4.0.rc2) | ||
esse (0.4.0.rc3) | ||
multi_json | ||
thor (>= 0.19) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# frozen_string_literal: true | ||
|
||
module Esse | ||
module CLI | ||
module Parser | ||
FALSEY = [false, 'false', 'FALSE', 'f', 'F'].freeze | ||
TRUTHY = [true, 'true', 'TRUE', 't', 'T'].freeze | ||
HASH_MATCHER = /([\w\.\-]+)\:([^\s]+)/.freeze | ||
HASH_SEPARATOR = /[\s]+/.freeze | ||
ARRAY_SEPARATOR = /[\,]+/.freeze | ||
|
||
class BoolOrHash | ||
def initialize(key, default: nil) | ||
@key = key | ||
@default = default | ||
end | ||
|
||
def parse(input) | ||
return true if TRUTHY.include?(input) | ||
return false if FALSEY.include?(input) | ||
return input if input.is_a?(Hash) | ||
return @default if input.nil? | ||
return true if @key.to_s == input | ||
return @default unless HASH_MATCHER.match?(input) | ||
|
||
compact_hash = input.to_s.split(HASH_SEPARATOR).each_with_object({}) do |pair, hash| | ||
key, val = pair.match(HASH_MATCHER).captures | ||
hash[key.to_sym] = may_array(val) | ||
end | ||
return @default if compact_hash.empty? | ||
|
||
Esse::HashUtils.explode_keys(compact_hash) | ||
end | ||
|
||
private | ||
|
||
def may_array(value) | ||
return may_bool(value) unless ARRAY_SEPARATOR.match?(value) | ||
|
||
value.split(ARRAY_SEPARATOR).map { |v| may_bool(v) } | ||
end | ||
|
||
def may_bool(value) | ||
return true if TRUTHY.include?(value) | ||
return false if FALSEY.include?(value) | ||
|
||
value | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.