Class: Hap::Generators::Haproxy
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Hap::Generators::Haproxy
- Includes:
- Helpers
- Defined in:
- lib/hap/generators/haproxy.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
10 11 12 |
# File 'lib/hap/generators/haproxy.rb', line 10 def self.source_root File.dirname(__FILE__) end |
Instance Method Details
#convert_to_profile ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/hap/generators/haproxy.rb', line 22 def convert_to_profile if to.production? copy_file target_file, target_file.gsub( File.basename(target_file), "haproxy.cfg" ) prepend_file target_file do "#!/bin/bash\n" "cat > haproxy.cfg <<EOF\n" end append_file target_file do "\nEOF" end end end |
#create_cfg_file ⇒ Object
14 15 16 |
# File 'lib/hap/generators/haproxy.rb', line 14 def create_cfg_file template "templates/config/#{Hap::FRONT_END}/haproxy.cfg.erb", target_file end |
#fix_port ⇒ Object
18 19 20 |
# File 'lib/hap/generators/haproxy.rb', line 18 def fix_port gsub_file target_file, "$PORT", "5000" unless to.production? end |