Class: PoolParty::Extra::Deployments

Inherits:
Object
  • Object
show all
Defined in:
lib/poolparty/extra/deployments.rb

Class Method Summary collapse

Class Method Details

.include_deployment(filename) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/poolparty/extra/deployments.rb', line 6

def self.include_deployment(filename)
  return nil unless ::File.file? filename
  name = ::File.basename(filename, ::File.extname(filename))
  contents = open(filename).read

  plugin_klass = PoolParty::PluginModel::PluginModel.new(name)
  plugin_klass.class_eval "    def enable\n      puts \"Called enable\"\n      \#{contents}\n    end\n  EOE\n  plugin_klass\nend\n"

.include_deployments(dir) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/poolparty/extra/deployments.rb', line 21

def self.include_deployments(dir)
  return nil unless ::File.directory? dir
  Dir["#{dir}/*"].each do |fi|
    include_deployment fi
  end
  dir
end