Module: Strata::CLI::Utils
- Defined in:
- lib/strata/cli/utils.rb,
lib/strata/cli/utils/git.rb,
lib/strata/cli/utils/archive.rb,
lib/strata/cli/utils/test_reporter.rb,
lib/strata/cli/utils/import_manager.rb,
lib/strata/cli/utils/version_checker.rb,
lib/strata/cli/utils/deployment_monitor.rb,
lib/strata/cli/utils/yaml_import_resolver.rb
Defined Under Namespace
Modules: Archive, Git, ImportManager, VersionChecker, YamlImportResolver Classes: DeploymentMonitor, TestReporter
Class Method Summary collapse
- .exit_error_if_not_strata! ⇒ Object
-
.url_safe_str(str) ⇒ Object
Convert a given string to a Strata compliant slug or url friendly ID.
-
.yaml_block_matcher(key) ⇒ Object
Match a YAML block given a key.
Class Method Details
.exit_error_if_not_strata! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/strata/cli/utils.rb', line 18 def exit_error_if_not_strata! return if CLI.config.strata_project? Output.print_error("ERROR: This is not a valid strata project") exit 1 end |
.url_safe_str(str) ⇒ Object
Convert a given string to a Strata compliant slug or url friendly ID.
14 15 16 |
# File 'lib/strata/cli/utils.rb', line 14 def url_safe_str(str) str.downcase.strip.gsub(/\s+/, "-").gsub(/[^\w-]/, "") end |
.yaml_block_matcher(key) ⇒ Object
Match a YAML block given a key. It should match a block like so:
key:
attribute: value
attr_2: val
another_key: another_val
This should match just the ‘key’ block above.
38 39 40 |
# File 'lib/strata/cli/utils.rb', line 38 def yaml_block_matcher(key) /^#{key}:.*?(?=^\S|\z)/m end |