Class: Avm::EacRubyBase1::Rubygems::Providers::RubygemsOrg

Inherits:
Base
  • Object
show all
Defined in:
lib/avm/eac_ruby_base1/rubygems/providers/rubygems_org.rb

Constant Summary collapse

DEFAULT_ROOT_HTTP_URL =
'https://rubygems.org'.to_uri

Instance Method Summary collapse

Methods inherited from Base

#push_gem, #to_s

Constructor Details

#initialize(root_http_url = DEFAULT_ROOT_HTTP_URL) ⇒ RubygemsOrg

Returns a new instance of RubygemsOrg.

Parameters:

  • (defaults to: DEFAULT_ROOT_HTTP_URL)


11
12
13
# File 'lib/avm/eac_ruby_base1/rubygems/providers/rubygems_org.rb', line 11

def initialize(root_http_url = DEFAULT_ROOT_HTTP_URL)
  super
end

Instance Method Details

#gem_versions(gem_name) ⇒ Enumerable<Hash>

Returns:



16
17
18
19
20
21
22
# File 'lib/avm/eac_ruby_base1/rubygems/providers/rubygems_org.rb', line 16

def gem_versions(gem_name)
  ::EacEnvs::Http::Request.new
    .url(root_http_url + "/api/v1/versions/#{gem_name}.json")
    .response.body_data_or_raise
rescue EacEnvs::Http::Response => e
  e.status == 404 ? [] : raise(e)
end

#push_gem_command_args(gem_package_path) ⇒ Enumerable<String>

Parameters:

Returns:



26
27
28
29
30
31
32
# File 'lib/avm/eac_ruby_base1/rubygems/providers/rubygems_org.rb', line 26

def push_gem_command_args(gem_package_path)
  command = ['gem', 'push', gem_package_path]
  unless ::Avm::Launcher::Context.current.publish_options[:confirm]
    command = %w[echo] + command + %w[(Dry-run)]
  end
  command
end