lib/tane/helpers/init_helper.rb in tane-0.0.1 vs lib/tane/helpers/init_helper.rb in tane-0.0.2
- old
+ new
@@ -7,11 +7,11 @@
if bushido_app_exists?
update_app
else
app = create_app
make_app_bushido_dir
- save_envs(get_app_envs(app['name']))
+ save_envs(get_app_envs(app['app']['name']))
save_emails
end
term.say "Finished successfully! Check out .bushido/tane.yml for the env vars if you care, or .bushido/emails/#{example_email_template.keys.first}.yml to create email templates to test with"
end
@@ -21,23 +21,19 @@
end
# TODO: Replace envs_template with values retrieved from Bushido side
def save_envs(env_vars)
if File.exists?('.bushido/tane.yml')
- if not term.agree('.bushido/tane.yml already exists! Are you sure you want to overwrite it?')
- return
- end
+ return if not term.agree('.bushido/tane.yml already exists! Are you sure you want to overwrite it? Y/N')
end
File.open('.bushido/tane.yml', 'w+') { |file| file.puts YAML.dump(envs_template(env_vars)) }
end
def save_emails
if File.exists?("#{email_templates_path}/#{example_email_template.keys.first}")
- if not term.agree("#{example_email_template.keys.first} already exists! Are you sure you want to overwrite it?")
- return
- end
+ return if not term.agree("#{example_email_template.keys.first} already exists! Are you sure you want to overwrite it? Y/N")
end
File.open("#{email_templates_path}/#{example_email_template.keys.first}", "w") do |file|
file.puts email_template_explanation
file.puts YAML.dump(example_email_template)
@@ -45,18 +41,18 @@
end
def envs_template(app_envs)
envs = {}
env_var_keys = [
- 'APP_TLD', 'BUNDLE_WITHOUT', 'BUSHIDO_APP', 'BUSHIDO_APP_KEY',
- 'BUSHIDO_DOMAIN', 'BUSHIDO_EVENTS', 'BUSHIDO_HOST', 'BUSHIDO_NAME',
- 'BUSHIDO_PROJECT_NAME', 'BUSHIDO_SALT', 'BUSHIDO_SUBDOMAIN',
- 'B_SQL_DB', 'B_SQL_PASS', 'B_SQL_USER', 'DATABASE_URL',
- 'HOSTING_PLATFORM', 'LANG', 'PUBLIC_URL', 'RACK_ENV',
- 'RAILS_ENV', 'S3_ACCESS_KEY_ID', 'S3_ARN', 'S3_BUCKET',
- 'SHARED_DATABASE_URL', 'S3_PREFIX', 'S3_SECRET_ACCESS_KEY',
+ 'APP_TLD', 'BUNDLE_WITHOUT', 'BUSHIDO_APP', 'BUSHIDO_APP_KEY',
+ 'BUSHIDO_DOMAIN', 'BUSHIDO_EVENTS', 'BUSHIDO_HOST', 'BUSHIDO_NAME',
+ 'BUSHIDO_PROJECT_NAME', 'BUSHIDO_SALT', 'BUSHIDO_SUBDOMAIN',
+ 'B_SQL_DB', 'B_SQL_PASS', 'B_SQL_USER', 'DATABASE_URL',
+ 'HOSTING_PLATFORM', 'LANG', 'PUBLIC_URL', 'RACK_ENV',
+ 'RAILS_ENV', 'S3_ACCESS_KEY_ID', 'S3_ARN', 'S3_BUCKET',
+ 'SHARED_DATABASE_URL', 'S3_PREFIX', 'S3_SECRET_ACCESS_KEY', 'STS_SESSION_TOKEN',
'SMTP_AUTHENTICATION', 'SMTP_DOMAIN', 'SMTP_PASSWORD',
- 'SMTP_PORT', 'SMTP_SERVER', 'SMTP_TLS', 'SMTP_USER'
+ 'SMTP_PORT', 'SMTP_SERVER', 'SMTP_TLS', 'SMTP_USER'
]
env_var_keys.each { |env_var_key| envs[env_var_key] = app_envs[env_var_key] }
envs
end