Class: Avm::Stereotypes::EacUbuntuBase0::Apache::Site
- Inherits:
-
Object
- Object
- Avm::Stereotypes::EacUbuntuBase0::Apache::Site
- Defined in:
- lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb
Instance Method Summary collapse
- #available? ⇒ Boolean
- #available_path ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #enabled? ⇒ Boolean
- #enabled_path ⇒ Object
- #remove ⇒ Object
- #remove_available ⇒ Object
- #remove_disabled ⇒ Object
- #write(content) ⇒ Object
Instance Method Details
#available? ⇒ Boolean
16 17 18 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 16 def available? apache.host_env.file(available_path).exist? end |
#available_path ⇒ Object
12 13 14 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 12 def available_path ::File.join(apache.etc_root, 'sites-available', "#{name}.conf") end |
#disable ⇒ Object
20 21 22 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 20 def disable apache.host_env.command('sudo', 'a2dissite', name).execute! end |
#enable ⇒ Object
24 25 26 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 24 def enable apache.host_env.command('sudo', 'a2ensite', name).execute! end |
#enabled? ⇒ Boolean
32 33 34 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 32 def enabled? apache.host_env.file(enabled_path).exist? end |
#enabled_path ⇒ Object
28 29 30 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 28 def enabled_path ::File.join(apache.etc_root, 'sites-enabled', "#{name}.conf") end |
#remove ⇒ Object
36 37 38 39 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 36 def remove remove_disabled remove_available end |
#remove_available ⇒ Object
41 42 43 44 45 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 41 def remove_available raise 'Remove enabled before' if enabled? apache.host_env.command('sudo', 'rm', '-f', available_path).execute! if available? end |
#remove_disabled ⇒ Object
47 48 49 50 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 47 def remove_disabled disable if enabled? apache.host_env.command('sudo', 'rm', '-f', enabled_path).execute! if enabled? end |
#write(content) ⇒ Object
52 53 54 55 56 |
# File 'lib/avm/stereotypes/eac_ubuntu_base0/apache/site.rb', line 52 def write(content) ::EacRubyUtils::Envs.local.command('echo', content).pipe( apache.host_env.command('sudo', 'tee', available_path) ).execute! end |