Method: Gem::Commands::PristineCommand#initialize

Defined in:
lib/rubygems/commands/pristine_command.rb

#initializePristineCommand

Returns a new instance of PristineCommand.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/rubygems/commands/pristine_command.rb', line 11

def initialize
  super "pristine",
        "Restores installed gems to pristine condition from files located in the gem cache",
        version: Gem::Requirement.default,
        extensions: true,
        extensions_set: false,
        all: false

  add_option("--all",
             "Restore all installed gems to pristine",
             "condition") do |value, options|
    options[:all] = value
  end

  add_option("--skip=gem_name",
             "used on --all, skip if name == gem_name") do |value, options|
    options[:skip] ||= []
    options[:skip] << value
  end

  add_option("--[no-]extensions",
             "Restore gems with extensions",
             "in addition to regular gems") do |value, options|
    options[:extensions_set] = true
    options[:extensions]     = value
  end

  add_option("--only-missing-extensions",
             "Only restore gems with missing extensions") do |value, options|
    options[:only_missing_extensions] = value
  end

  add_option("--only-executables",
             "Only restore executables") do |value, options|
    options[:only_executables] = value
  end

  add_option("--only-plugins",
             "Only restore plugins") do |value, options|
    options[:only_plugins] = value
  end

  add_option("-E", "--[no-]env-shebang",
             "Rewrite executables with a shebang",
             "of /usr/bin/env") do |value, options|
    options[:env_shebang] = value
  end

  add_option("-i", "--install-dir DIR",
             "Gem repository to get gems restored") do |value, options|
    options[:install_dir] = File.expand_path(value)
  end

  add_option("-n", "--bindir DIR",
             "Directory where executables are",
             "located") do |value, options|
    options[:bin_dir] = File.expand_path(value)
  end

  add_version_option("restore to", "pristine condition")
end