Sha256: 8f2f3794105050a9752878bdc4b89203534edd7d3862e3883d85d92938756fc8

Contents?: true

Size: 1.07 KB

Versions: 20

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Extension
  module Features
    class ArgoDependencies
      def self.node_installed(min_major:, min_minor: nil)
        -> (context) do
          out, status = CLI::Kit::System.capture2('node', '-v')
          context.abort(context.message('features.argo.dependencies.node.node_not_installed')) unless status.success?

          min_version = 'v' + min_major .to_s + '.' + (min_minor.nil? ? 'x' : min_minor.to_s) + '.x'
          version = out.strip
          parsed_version = version.match(/v(?<major>\d+).(?<minor>\d+).(?<patch>\d+)/)

          unless min_major.nil? || parsed_version[:major].to_i >= min_major
            context.abort(context.message('features.argo.dependencies.node.version_too_low', version, min_version))
          end

          return if parsed_version[:major].to_i > min_major

          unless min_minor.nil? || parsed_version[:minor].to_i >= min_minor
            context.abort(context.message('features.argo.dependencies.node.version_too_low', version, min_version))
          end
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
shopify-cli-1.6.0 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.5.0 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.4.1 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.4.0 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.3.1 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.3.0 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.2.0 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.1.2 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.1.1 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.1.0 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.0.5 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.0.4 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.0.3 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.0.2 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.0.1 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-1.0.0 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-0.9.3 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-0.9.2 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-0.9.1 lib/project_types/extension/features/argo_dependencies.rb
shopify-cli-0.9.0 lib/project_types/extension/features/argo_dependencies.rb