Class: GpmCli

Inherits:
Thor show all
Defined in:
lib/gpm/cli.rb

Constant Summary collapse

INCLUDE_FILES_PARAM =
"include-files".to_sym

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.supported_sourcesObject



6
7
8
# File 'lib/gpm/cli.rb', line 6

def self.supported_sources
  ["gem","bundler", "war", "maven"]
end

.supported_targetsObject



9
10
11
# File 'lib/gpm/cli.rb', line 9

def self.supported_targets
  ["deb"]
end

Instance Method Details

#package(file_or_directory) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/gpm/cli.rb', line 24

def package(file_or_directory)
  raise "Only #{self.class.supported_sources.join(", ")} sources at the moment" unless self.class.supported_sources.include? options.source
  raise "Only deb target at the moment" unless self.class.supported_targets.include? options.target
  package_options = {}
  {:workdir => :work_dir , :destination => :destination, :owner => :owner, :group => :group, :buildnumber => :build_number, INCLUDE_FILES_PARAM => :include_files}.each do |in_field, out_field|
    package_options[out_field] = options[in_field] if options[in_field]
  end

  PackagingTask.create(file_or_directory, options.source, options.target, package_options).run
end