Class: Groundskeeper::Project
- Inherits:
-
Object
- Object
- Groundskeeper::Project
- Defined in:
- lib/groundskeeper/project.rb
Overview
Accesses project details stored in the home directory.
Constant Summary collapse
- DETAILS_PATH =
"~/.project_details/projects.yml"
- SERVERS_PATH =
"~/.project_details/servers.yml"
- JIRA_PREFIX_KEY =
"jira_prefix"
- PROJECT_NAME_KEY =
"name"
- FULL_DNS_KEY =
"full_dns"
- RVM_RUBY_VERSION_KEY =
"ruby_version"
- SENTRY_DSN_KEY =
"sentry_dsn"
- SENTRY_PROJECT_KEY =
"sentry_project"
- SMTP_DOMAIN =
"smtp_domain"
- SSL_CERTIFICATE_FILE_KEY =
"SSLCertificateFile"
- SSL_CERTIFICATE_CHAIN_FILE_KEY =
"SSLCertificateChainFile"
- SSL_CERTIFICATE_KEY_FILE_KEY =
"SSLCertificateKeyFile"
- WHENEVER_KEY =
"uses_whenever"
Instance Attribute Summary collapse
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#git ⇒ Object
readonly
Returns the value of attribute git.
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
-
#servers ⇒ Object
readonly
Returns the value of attribute servers.
Class Method Summary collapse
Instance Method Summary collapse
-
#deploy_to ⇒ Object
:nocov:.
- #full_dns(stage) ⇒ Object
-
#initialize(projects_yaml:, servers_yaml:, repository_name:, git: nil) ⇒ Project
constructor
:nocov:.
- #jira_prefix ⇒ Object
- #project_name ⇒ Object
-
#repo_url ⇒ Object
:nocov:.
-
#rvm_ruby_version ⇒ Object
:nocov:.
-
#sentry_dsn ⇒ Object
:nocov:.
-
#sentry_project ⇒ Object
:nocov:.
-
#server_config(stage) ⇒ Object
:nocov:.
-
#smtp_domain ⇒ Object
:nocov:.
-
#ssl_certificate_chain_file(stage) ⇒ Object
:nocov:.
-
#ssl_certificate_file(stage) ⇒ Object
:nocov:.
-
#ssl_certificate_key_file(stage) ⇒ Object
:nocov:.
-
#tags ⇒ Object
:nocov:.
-
#uses_whenever? ⇒ Boolean
:nocov:.
Constructor Details
#initialize(projects_yaml:, servers_yaml:, repository_name:, git: nil) ⇒ Project
:nocov:
42 43 44 45 46 47 48 |
# File 'lib/groundskeeper/project.rb', line 42 def initialize(projects_yaml:, servers_yaml:, repository_name:, git: nil) projects = YAML.safe_load(projects_yaml) || {} @details = projects[repository_name] || {} @servers = YAML.safe_load(servers_yaml) || {} @repo_name = repository_name @git = git end |
Instance Attribute Details
#details ⇒ Object (readonly)
Returns the value of attribute details.
9 10 11 |
# File 'lib/groundskeeper/project.rb', line 9 def details @details end |
#git ⇒ Object (readonly)
Returns the value of attribute git.
9 10 11 |
# File 'lib/groundskeeper/project.rb', line 9 def git @git end |
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
9 10 11 |
# File 'lib/groundskeeper/project.rb', line 9 def repo_name @repo_name end |
#servers ⇒ Object (readonly)
Returns the value of attribute servers.
9 10 11 |
# File 'lib/groundskeeper/project.rb', line 9 def servers @servers end |
Class Method Details
.available_applications ⇒ Object
:nocov:
35 36 37 38 39 |
# File 'lib/groundskeeper/project.rb', line 35 def self.available_applications yaml = Document.new(DETAILS_PATH).read projects = YAML.safe_load(yaml) || {} projects.keys.join(", ") end |
.build(repository_name) ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/groundskeeper/project.rb', line 25 def self.build(repository_name) new( projects_yaml: Document.new(DETAILS_PATH).read, servers_yaml: Document.new(SERVERS_PATH).read, repository_name: repository_name, git: Git.build ) end |
Instance Method Details
#deploy_to ⇒ Object
:nocov:
121 122 123 |
# File 'lib/groundskeeper/project.rb', line 121 def deploy_to "/var/www/apps/#{repo_name}" end |
#full_dns(stage) ⇒ Object
58 59 60 |
# File 'lib/groundskeeper/project.rb', line 58 def full_dns(stage) details.dig(FULL_DNS_KEY, stage.to_s) || "" end |
#jira_prefix ⇒ Object
54 55 56 |
# File 'lib/groundskeeper/project.rb', line 54 def jira_prefix details[JIRA_PREFIX_KEY] || "" end |
#project_name ⇒ Object
50 51 52 |
# File 'lib/groundskeeper/project.rb', line 50 def project_name details[PROJECT_NAME_KEY] || "" end |
#repo_url ⇒ Object
:nocov:
115 116 117 |
# File 'lib/groundskeeper/project.rb', line 115 def repo_url git.origin_url end |
#rvm_ruby_version ⇒ Object
:nocov:
69 70 71 |
# File 'lib/groundskeeper/project.rb', line 69 def rvm_ruby_version details[RVM_RUBY_VERSION_KEY] || "" end |
#sentry_dsn ⇒ Object
:nocov:
75 76 77 |
# File 'lib/groundskeeper/project.rb', line 75 def sentry_dsn details[SENTRY_DSN_KEY] || "" end |
#sentry_project ⇒ Object
:nocov:
80 81 82 |
# File 'lib/groundskeeper/project.rb', line 80 def sentry_project details[SENTRY_PROJECT_KEY] || "" end |
#server_config(stage) ⇒ Object
:nocov:
109 110 111 |
# File 'lib/groundskeeper/project.rb', line 109 def server_config(stage) servers[full_dns(stage)] end |
#smtp_domain ⇒ Object
:nocov:
63 64 65 |
# File 'lib/groundskeeper/project.rb', line 63 def smtp_domain details[SMTP_DOMAIN] || "" end |
#ssl_certificate_chain_file(stage) ⇒ Object
:nocov:
91 92 93 |
# File 'lib/groundskeeper/project.rb', line 91 def ssl_certificate_chain_file(stage) details.dig(SSL_CERTIFICATE_CHAIN_FILE_KEY, stage.to_s) || "" end |
#ssl_certificate_file(stage) ⇒ Object
:nocov:
85 86 87 |
# File 'lib/groundskeeper/project.rb', line 85 def ssl_certificate_file(stage) details.dig(SSL_CERTIFICATE_FILE_KEY, stage.to_s) || "" end |
#ssl_certificate_key_file(stage) ⇒ Object
:nocov:
97 98 99 |
# File 'lib/groundskeeper/project.rb', line 97 def ssl_certificate_key_file(stage) details.dig(SSL_CERTIFICATE_KEY_FILE_KEY, stage.to_s) || "" end |
#tags ⇒ Object
:nocov:
127 128 129 |
# File 'lib/groundskeeper/project.rb', line 127 def git. end |
#uses_whenever? ⇒ Boolean
:nocov:
103 104 105 |
# File 'lib/groundskeeper/project.rb', line 103 def uses_whenever? details[WHENEVER_KEY] == true end |