Class: Gem::Commands::DebCommand

Inherits:
Gem::Command
  • Object
show all
Includes:
InstallUpdateOptions, LocalRemoteOptions, VersionOption
Defined in:
lib/commands/deb.rb

Instance Method Summary collapse

Constructor Details

#initializeDebCommand

Returns a new instance of DebCommand.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/commands/deb.rb', line 27

def initialize
  defaults = Gem::DependencyInstaller::DEFAULT_OPTIONS.merge({
    :generate_rdoc => false,
    :generate_ri   => true,
    :format_executable => false,
    :test => false,
    :version => Gem::Requirement.default,
  })

  super 'deb', 'Convert a rubygem to debian package', defaults

  add_install_update_options
  add_local_remote_options
  add_version_option

  @templates_dir = File.dirname(__FILE__)+"/../templates"
  @install_dir = Dir.tmpdir+"/gemdeb_home"
  @current_dir = Dir.getwd

  FileUtils.mkpath(@install_dir)
end

Instance Method Details

#argumentsObject



19
20
21
# File 'lib/commands/deb.rb', line 19

def arguments
  "GEM       gem to convert"
end

#descriptionObject



15
16
17
# File 'lib/commands/deb.rb', line 15

def description
  'Convert a rubygem to debian package'
end

#executeObject



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/commands/deb.rb', line 49

def execute
  install_options = {
    :env_shebang => options[:env_shebang],
    :domain => options[:domain],
    :force => options[:force],
    :format_executable => options[:format_executable],
    :ignore_dependencies => options[:ignore_dependencies],
    :install_dir => @install_dir,
    :security_policy => options[:security_policy],
    :wrappers => options[:wrappers],
    :bin_dir => "#{@install_dir}/bin",
    :development => options[:development]
  }

  get_all_gem_names.each do |gem_name|
    installer = Gem::DependencyInstaller.new(install_options)
    installer.install gem_name, options[:version]

    installer.installed_gems.each do |spec|
      generate_deb_for(spec)
    end
  end
end

#usageObject



23
24
25
# File 'lib/commands/deb.rb', line 23

def usage
  "#{program_name} GEM"
end