Class: GitPusshuTen::Environment
- Inherits:
-
Object
- Object
- GitPusshuTen::Environment
- Includes:
- Helpers::Environment::Installers, Helpers::Environment::Packages, Helpers::Environment::SCP, Helpers::Environment::SSH, Helpers::Environment::SSHKeys, Helpers::Environment::User
- Defined in:
- lib/gitpusshuten/environment.rb
Instance Attribute Summary collapse
-
#configuration ⇒ Object
Stores the configuration.
Instance Method Summary collapse
-
#app_dir ⇒ Object
Returns the root of the application.
-
#app_name ⇒ Object
Returns the name of the application.
-
#c ⇒ Object
Shorthand for the configuration object.
-
#delete! ⇒ Object
Deletes the current environment (application).
-
#home_dir ⇒ Object
Users home directory.
-
#initialize(configuration) ⇒ Environment
constructor
Initializes the environment with the provided configuration.
-
#name ⇒ Object
Returns the name of the environment.
-
#sanitized_app_name ⇒ Object
Takes the application name from the configuration and replaces spaces with underscores and downcases capitalized characters.
Methods included from Helpers::Environment::Installers
#ensure_aptitude_installed!, #install!, #install_gitconfig!, #install_pushand!, #installed?, #uninstall!
Methods included from Helpers::Environment::User
#add_user!, #add_user_to_sudoers!, #remove_user!, #user_exists?, #user_in_sudoers?
Methods included from Helpers::Environment::Packages
#clean_up_packages!, #download_packages!
Methods included from Helpers::Environment::SSHKeys
#authorized_root_ssh_keys, #authorized_ssh_keys, #has_ssh_key?, #install_root_ssh_key!, #install_ssh_key!, #root_ssh_key_installed?, #ssh_key, #ssh_key_installed?, #ssh_key_path
Methods included from Helpers::Environment::SSH
#directory?, #execute_as_root, #execute_as_user, #file?
Methods included from Helpers::Environment::SCP
Constructor Details
#initialize(configuration) ⇒ Environment
Initializes the environment with the provided configuration
22 23 24 |
# File 'lib/gitpusshuten/environment.rb', line 22 def initialize(configuration) @configuration = configuration end |
Instance Attribute Details
#configuration ⇒ Object
Stores the configuration
18 19 20 |
# File 'lib/gitpusshuten/environment.rb', line 18 def configuration @configuration end |
Instance Method Details
#app_dir ⇒ Object
Returns the root of the application
52 53 54 |
# File 'lib/gitpusshuten/environment.rb', line 52 def app_dir File.join(home_dir, "#{sanitized_app_name}.#{name}") end |
#app_name ⇒ Object
Returns the name of the application
46 47 48 |
# File 'lib/gitpusshuten/environment.rb', line 46 def app_name c.application end |
#c ⇒ Object
Shorthand for the configuration object
28 29 30 |
# File 'lib/gitpusshuten/environment.rb', line 28 def c configuration end |
#delete! ⇒ Object
Deletes the current environment (application)
65 66 67 |
# File 'lib/gitpusshuten/environment.rb', line 65 def delete! execute_as_user("rm -rf #{app_dir}") end |
#home_dir ⇒ Object
Users home directory
40 41 42 |
# File 'lib/gitpusshuten/environment.rb', line 40 def home_dir c.path end |
#name ⇒ Object
Returns the name of the environment
34 35 36 |
# File 'lib/gitpusshuten/environment.rb', line 34 def name c.environment end |
#sanitized_app_name ⇒ Object
Takes the application name from the configuration and replaces spaces with underscores and downcases capitalized characters
59 60 61 |
# File 'lib/gitpusshuten/environment.rb', line 59 def sanitized_app_name app_name.gsub(' ', '_').downcase end |