Module: ElmInstall::Utils
- Defined in:
- lib/elm_install/utils.rb
Overview
This module contains utility functions.
Constant Summary collapse
- CONVERTERS =
{ /v<(?!=)(.*)/ => '<', /(.*)<=v/ => '>=', /v<=(.*)/ => '<=', /(.*)<v/ => '>' }.freeze
Class Method Summary collapse
- .log_with_dot(message) ⇒ Object
- .package_version_path(package, version) ⇒ Object
- .transform_constraint(constraint) ⇒ Object
- .transform_package(key) ⇒ Object
Class Method Details
.log_with_dot(message) ⇒ Object
22 23 24 |
# File 'lib/elm_install/utils.rb', line 22 def log_with_dot() puts ' ● '.green + end |
.package_version_path(package, version) ⇒ Object
26 27 28 29 |
# File 'lib/elm_install/utils.rb', line 26 def package_version_path(package, version) package_name = GitCloneUrl.parse(package).path [package_name, File.join('elm-stuff', 'packages', package_name, version)] end |
.transform_constraint(constraint) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/elm_install/utils.rb', line 13 def transform_constraint(constraint) constraint.gsub!(/\s/, '') CONVERTERS.map do |regexp, prefix| match = constraint.match(regexp) "#{prefix} #{match[1]}" if match end.compact end |
.transform_package(key) ⇒ Object
31 32 33 34 35 36 |
# File 'lib/elm_install/utils.rb', line 31 def transform_package(key) GitCloneUrl.parse(key) key rescue "[email protected]:#{key}" end |