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
16 17 18 19 20 21 |
# File 'lib/strata/cli/utils.rb', line 16 def exit_error_if_not_strata! return if CLI.config.strata_project? Thor::Shell::Color.new.say_error "ERROR: This is not a valid strata project", :red exit 1 end |
.url_safe_str(str) ⇒ Object
Convert a given string to a Strata compliant slug or url friendly ID.
12 13 14 |
# File 'lib/strata/cli/utils.rb', line 12 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.
36 37 38 |
# File 'lib/strata/cli/utils.rb', line 36 def yaml_block_matcher(key) /^#{key}:.*?(?=^\S|\z)/m end |