Class: Ploy::LocalPackage::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/ploy/localpackage/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(conf) ⇒ Config

Returns a new instance of Config.



6
7
8
# File 'lib/ploy/localpackage/config.rb', line 6

def initialize(conf)
  @conf = conf
end

Class Method Details

.load(conf_source = '.ploy-publisher.yml') ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/ploy/localpackage/config.rb', line 35

def self.load(conf_source = '.ploy-publisher.yml')
  conf = nil
  if (/^---/ =~ conf_source) then
    conf = YAML::load(conf_source)
  else
    conf = YAML::load_file(conf_source)
  end
  lps = []
  if conf.key? "packages"
    conf['packages'].each do |pkg|
      lps.push(self.new(conf.merge(pkg)))
    end
  else
    lps.push(self.new(conf))
  end
  return lps
end

Instance Method Details

#builderObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ploy/localpackage/config.rb', line 10

def builder
  builder = Ploy::LocalPackage::DebBuilder.new(
    :name          => @conf['deploy_name'],
    :sha           => git_revision,
    :branch        => git_branch,
    :timestamp     => git_timestamp,
    :upstart_files => @conf['upstart_files'],
    :dist_dirs     => @conf['dist_dirs'],
    :dist_dir      => @conf['dist_dir'],
    :prefix        => @conf['prefix'],
    :prep_cmd      => @conf['prep_cmd'],
    :postinst      => @conf['postinst']
  );
  return builder
end

#remote_packageObject



26
27
28
29
30
31
32
33
# File 'lib/ploy/localpackage/config.rb', line 26

def remote_package
  return Ploy::Package.new(
    @conf['bucket'],
    @conf['deploy_name'],
    git_branch,
    git_revision
  )
end