Module: Initd::Export
- Included in:
- Foreman::Export::Initd, Foreman::Export::InitdMonit
- Defined in:
- lib/initd/export.rb
Instance Method Summary collapse
- #cleanup ⇒ Object
- #concurrency(name) ⇒ Object
- #export_file(path, contents) ⇒ Object
- #export_path ⇒ Object
- #path(name) ⇒ Object
- #remove(path) ⇒ Object
- #setup ⇒ Object
Instance Method Details
#cleanup ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/initd/export.rb', line 13 def cleanup Dir.glob export_path.join("#{app}-*") do |filename| filename = Pathname.new(filename) contents = File.new(filename, 'r').read next unless contents.match(/# Autogenerated by foreman/) next if @exported.include? filename say 'removing ' + filename.to_s remove filename end end |
#concurrency(name) ⇒ Object
34 35 36 |
# File 'lib/initd/export.rb', line 34 def concurrency(name) engine.formation[name] end |
#export_file(path, contents) ⇒ Object
28 29 30 31 32 |
# File 'lib/initd/export.rb', line 28 def export_file (path, contents) write_file(path, contents) File.chmod(0755, path) @exported.push path end |
#export_path ⇒ Object
3 4 5 |
# File 'lib/initd/export.rb', line 3 def export_path Pathname.new(location). end |
#path(name) ⇒ Object
38 39 40 |
# File 'lib/initd/export.rb', line 38 def path(name) export_path.join("#{app}-#{name}") end |
#remove(path) ⇒ Object
24 25 26 |
# File 'lib/initd/export.rb', line 24 def remove path File.unlink path end |
#setup ⇒ Object
7 8 9 10 11 |
# File 'lib/initd/export.rb', line 7 def setup @exported = [] say "creating: #{export_path}" FileUtils.mkdir_p(export_path) end |