Module: Wisp
- Defined in:
- lib/wisp-schema.rb,
lib/version.rb
Overview
Provides factory methods that will return the correct schemer instance to use depending on whether or not the given wisp version is stable or a canary
Defined Under Namespace
Classes: NotSupportedAction
Constant Summary
collapse
- VERSION =
"1.16.2"
- STABLE_VERSION =
"1.16.2"
- CANARY_VERSION =
"2.0.0"
- SCHEMA_PATH =
File.expand_path("../wisp.json", __dir__)
- NOUNS_PATH =
File.expand_path("../nouns.json", __dir__)
- CANARY_SCHEMA_PATH =
File.expand_path("../canary-wisp.json", __dir__)
- CANARY_NOUNS_PATH =
File.expand_path("../canary-nouns.json", __dir__)
- ACTIONS =
[
"ai_confirmation",
"click",
"close_tab",
"comment",
"conditional_observe",
"double_click",
"drag_and_drop",
"fill",
"hover",
"navigate",
"observe",
"refresh",
"scroll",
"select",
"send_key",
"tester_confirmation",
"tester_instruction",
"type",
"wait",
].freeze
- SEMANTIC_STABLE_VERSION =
Semantic::Version.new(STABLE_VERSION)
Class Method Summary
collapse
Class Method Details
.action_schemer(_raw_version, action) ⇒ Object
66
67
68
69
70
|
# File 'lib/wisp-schema.rb', line 66
def action_schemer(_raw_version, action)
raise NotSupportedAction unless ACTIONS.include?(action)
JSONSchemer.schema(Pathname.new(File.expand_path("../stable/actions/#{action}.json", __dir__)))
end
|
.embedded_test_schemer(_raw_version) ⇒ Object
78
79
80
|
# File 'lib/wisp-schema.rb', line 78
def embedded_test_schemer(_raw_version)
JSONSchemer.schema(Pathname.new(File.expand_path("../stable/embeddings/embedded_test.json", __dir__)))
end
|
.is_canary?(raw_version) ⇒ Boolean
43
44
45
|
# File 'lib/wisp-schema.rb', line 43
def is_canary?(raw_version)
Semantic::Version.new(raw_version) > SEMANTIC_STABLE_VERSION
end
|
.nouns_schemer(raw_version) ⇒ Object
57
58
59
60
61
62
63
|
# File 'lib/wisp-schema.rb', line 57
def nouns_schemer(raw_version)
if is_canary?(raw_version)
JSONSchemer.schema(Pathname.new(Wisp::CANARY_NOUNS_PATH))
else
JSONSchemer.schema(Pathname.new(Wisp::NOUNS_PATH))
end
end
|
.verbs_schemer(_raw_version) ⇒ Object
73
74
75
|
# File 'lib/wisp-schema.rb', line 73
def verbs_schemer(_raw_version)
JSONSchemer.schema(Pathname.new(File.expand_path("../stable/verbs.json", __dir__)))
end
|
.wisp_schemer(raw_version) ⇒ Object
48
49
50
51
52
53
54
|
# File 'lib/wisp-schema.rb', line 48
def wisp_schemer(raw_version)
if is_canary?(raw_version)
JSONSchemer.schema(Pathname.new(Wisp::CANARY_SCHEMA_PATH))
else
JSONSchemer.schema(Pathname.new(Wisp::SCHEMA_PATH))
end
end
|