Class: Nginx::Runner

Inherits:
Thor
  • Object
show all
Defined in:
lib/nginx_config.rb

Instance Method Summary collapse

Instance Method Details

#add(dir, opts) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/nginx_config.rb', line 21

def add(dir,opts)
  
  if File.directory?(dir)
    dir = File.expand_path(dir)
    
    setup(opts)
    site_name = File.basename( dir )
    
    `mkdir #{dir}/config` unless File.directory?(dir+'/config')
    
    if !File.exists?(dir+'/config/nginx.yml') || opts['force']
      open(dir + '/config/nginx.yml', 'w+').write(ERB.new(File.read(Nginx::Template['site.yml']), nil, '>').result(binding))
      
      
      # add site to system wide config.
      
      
    end
    
  end
end

#generate(opts) ⇒ Object



45
46
# File 'lib/nginx_config.rb', line 45

def generate(opts)
end

#setup(opts) ⇒ Object



12
13
14
15
16
17
# File 'lib/nginx_config.rb', line 12

def setup(opts)
  unless system_config_exists? && !opts['force']
    # TODO Refactor this to a new method
    `cp #{Nginx::Template['dot.nginx-config']} ~/.nginx-config`
  end
end