Class: Rsm::Install::Nginx
- Inherits:
-
Base
- Object
- Thor::Group
- Base
- Rsm::Install::Nginx
- Defined in:
- lib/tasks/install/nginx.rb
Constant Summary
Constant Summary
Constants inherited from Base
Constants included from Actions
Instance Attribute Summary (collapse)
-
- (Object) auth_basic
readonly
Returns the value of attribute auth_basic.
-
- (Object) auth_basic_realm
readonly
Returns the value of attribute auth_basic_realm.
-
- (Object) auth_basic_user_file
readonly
Returns the value of attribute auth_basic_user_file.
-
- (Object) domain
readonly
Returns the value of attribute domain.
-
- (Object) rewrite_www
readonly
Returns the value of attribute rewrite_www.
-
- (Object) upstream_name
readonly
Returns the value of attribute upstream_name.
Attributes inherited from Base
#server, #socket_per_worker, #worker_processes
Instance Method Summary (collapse)
- - (Object) enable_nginx_site
- - (Object) nginx_config_include_vhosts
- - (Object) nginx_server_config
- - (Object) set_destination_root
Methods inherited from Base
#set_server, #set_worker_processes, source_root, template_path
Methods included from Actions
#application_root, #downloaded_file, #fetch_temporary_archive, #run_ruby_binary, #unpack_compressed_archive
Instance Attribute Details
- (Object) auth_basic (readonly)
Returns the value of attribute auth_basic
4 5 6 |
# File 'lib/tasks/install/nginx.rb', line 4 def auth_basic @auth_basic end |
- (Object) auth_basic_realm (readonly)
Returns the value of attribute auth_basic_realm
4 5 6 |
# File 'lib/tasks/install/nginx.rb', line 4 def auth_basic_realm @auth_basic_realm end |
- (Object) auth_basic_user_file (readonly)
Returns the value of attribute auth_basic_user_file
4 5 6 |
# File 'lib/tasks/install/nginx.rb', line 4 def auth_basic_user_file @auth_basic_user_file end |
- (Object) domain (readonly)
Returns the value of attribute domain
4 5 6 |
# File 'lib/tasks/install/nginx.rb', line 4 def domain @domain end |
- (Object) rewrite_www (readonly)
Returns the value of attribute rewrite_www
4 5 6 |
# File 'lib/tasks/install/nginx.rb', line 4 def rewrite_www @rewrite_www end |
- (Object) upstream_name (readonly)
Returns the value of attribute upstream_name
4 5 6 |
# File 'lib/tasks/install/nginx.rb', line 4 def upstream_name @upstream_name end |
Instance Method Details
- (Object) enable_nginx_site
44 45 46 |
# File 'lib/tasks/install/nginx.rb', line 44 def enable_nginx_site link_file "#{destination_root}/sites-available.d/#{domain}.conf", "sites-enabled.d/#{domain}.conf" unless FileTest.symlink?("#{destination_root}/sites-enabled.d/#{domain}.conf") end |
- (Object) nginx_config_include_vhosts
18 19 20 21 22 23 |
# File 'lib/tasks/install/nginx.rb', line 18 def nginx_config_include_vhosts include_str = "include sites-enabled.d/*.conf;" unless File.read("#{destination_root}/nginx.conf").include?(include_str) inject_into_file "nginx.conf", "#{include_str}\n", :after => "index index.html;\n" end end |
- (Object) nginx_server_config
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/tasks/install/nginx.rb', line 25 def nginx_server_config @domain = [:domain] unless @domain @domain = `hostname -f`.strip @domain = "#{name}.#{@domain}" end @rewrite_www = [:rewrite_www] @auth_basic = [:auth_basic] @auth_basic_realm = [:auth_basic_realm] @auth_basic_realm = name.to_s.capitalize unless @auth_basic_realm @auth_basic_user_file = [:auth_basic_user_file] @upstream_name = "#{domain}_server" template "nginx-server.conf.erb", "sites-available.d/#{domain}.conf" end |
- (Object) set_destination_root
14 15 16 |
# File 'lib/tasks/install/nginx.rb', line 14 def set_destination_root self.destination_root = [:nginx_root] end |