Module: ForemanGod

Defined in:
lib/foreman_god.rb,
lib/foreman_god/version.rb,
lib/foreman_god/god_config.rb

Defined Under Namespace

Classes: GodConfig

Constant Summary collapse

VERSION =
"0.0.6"

Class Method Summary collapse

Class Method Details

.watch(glob) ⇒ Object

ForemanGod.watch File.dirname(__FILE__) => calls God.watch with the Procfile in the current file’s folder ForemanGod.watch ‘/var/www/*/current/’ => watch all folders matching the glob which contain either a .foreman file or a

Procfile.


9
10
11
12
13
14
15
16
17
# File 'lib/foreman_god.rb', line 9

def self.watch glob
  # We append a backslash so that only folders are matched
  glob += '/' unless glob.end_with? '/'
  Dir[glob].each do |d|
    if File.exists?(File.join(d, 'Procfile')) || File.exists?(File.join(d, '.foreman'))
      watch_dir d
    end
  end
end

.watch_dir(dir) ⇒ Object



19
20
21
22
23
# File 'lib/foreman_god.rb', line 19

def self.watch_dir dir
  config = GodConfig.new(dir)
  config.watch
  config
end