lib/setup.rb in forj-0.0.33 vs lib/setup.rb in forj-0.0.34
- old
+ new
@@ -19,10 +19,12 @@
require 'require_relative'
require 'highline/import'
require_relative 'yaml_parse.rb'
include YamlParse
+require_relative 'helpers.rb'
+include Helpers
#
# Setup module call the hpcloud functions
#
module Setup
@@ -38,10 +40,11 @@
def setup_credentials
hpcloud_os_user = ask('Enter hpcloud username: ')
hpcloud_os_key = ask('Enter hpcloud password: ') { |q| q.echo = '*'}
home = File.expand_path('~')
+ Helpers.create_directory('%s/.cache/forj/' % [home])
creds = '%s/.cache/forj/creds' % [home]
values = {:credentials => {:hpcloud_os_user=> hpcloud_os_user, :hpcloud_os_key=> hpcloud_os_key}}
YamlParse.dump_values(values, creds)
@@ -65,15 +68,12 @@
os_user = local_template[:credentials][:hpcloud_os_user]
os_key = local_template[:credentials][:hpcloud_os_key]
File.open(cloud_fog, 'w') {|file|
- file.write('HPCLOUD_OS_USER=%s' % [os_user])
- file.write("\n")
- file.write('HPCLOUD_OS_KEY=%s' % [os_key])
- file.write("\n")
- file.write('DNS_KEY=%s' % [access_key])
- file.write("\n")
+ file.write('HPCLOUD_OS_USER=%s' % [os_user] + "\n")
+ file.write('HPCLOUD_OS_KEY=%s' % [os_key] + "\n")
+ file.write('DNS_KEY=%s' % [access_key] + "\n")
file.write('DNS_SECRET=%s' % [secret_key])
}
command = 'cat %s | gzip -c | base64 -w0 > %s.g64' % [cloud_fog, cloud_fog]
Kernel.system(command)
\ No newline at end of file