Sha256: c6e0b52e7548d3230060e1ddc5efb5c11631a0c2efecfb31b4c01dccf2f5b801

Contents?: true

Size: 1.26 KB

Versions: 5

Compression:

Stored size: 1.26 KB

Contents

require 'aruba/cucumber'
$:.push "#{File.dirname(__FILE__)}/../../lib/"
require 'nexus_cli'
require 'rspec'

module ArubaOverrides
  def detect_ruby(cmd)
    processor, platform, *rest = RUBY_PLATFORM.split("-")
    if platform =~ /w32$/ && cmd =~ /^nexus-cli /
      "ruby -I../../lib -S ../../bin/#{cmd}"
    else
      "#{cmd}"
    end
  end
end

World(ArubaOverrides)

Before do
  @aruba_timeout_seconds = 10
end

def get_overrides_string
  @overrides_string ||= "url:http://localhost:8081/nexus repository:releases username:admin password:admin123"
end

def get_overrides
  @overrides ||= {'url' => 'http://localhost:8081/nexus', 'repository' => 'releases', 'username' => 'admin', 'password' => 'admin123'}
end

def create_step_overrides(overrides)
  overrides_hash = overrides.split(" ").inject({}) do |overrides_hash, override|
    key, value = override.split(":")
    overrides_hash[key] = value
    overrides_hash
  end

  step_overrides = get_overrides.merge(overrides_hash)
  step_overrides.to_a.inject("") do |overrides_string, pair|
    overrides_string << pair.join(":")
    overrides_string << " "
  end
end

def temp_dir
  @tmpdir ||= Dir.mktmpdir
end

def nexus_remote
  @nexus_remote ||= NexusCli::Factory.create(get_overrides)
end

at_exit do
  FileUtils.rm_rf(temp_dir)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nexus_cli-1.0.2 features/support/env.rb
nexus_cli-1.0.1 features/support/env.rb
nexus_cli-1.0.0 features/support/env.rb
nexus_cli-0.9.1 features/support/env.rb
nexus_cli-0.9.0 features/support/env.rb