lib/commands/create.rb in dockersitter-0.3.0 vs lib/commands/create.rb in dockersitter-0.4.0
- old
+ new
@@ -46,16 +46,14 @@
option :subdomain,
:desc => "the subdomain for this app",
:type => :string
def app(app_name)
- subdomain = options[:subdomain] ? options[:subdomain] : app_name.gsub(/\s/,"-").downcase
- puts config[:host]
+ subdomain = options.fetch(subdomain,app_name.gsub(/\s/,"-").downcase)
@domain = "#{subdomain}.#{config[:host]}"
@app_name = app_name
- @user_email = config[:email]
- @user_name = config[:name]
+ @user_email,@user_name = config.values_at(:email,:name)
app_path = "#{apps_dir}/#{@app_name}"
template "docker-compose.yml.erb","#{app_path}/docker-compose.yml"
empty_directory "#{app_path}/administration/installation"
empty_directory "#{app_path}/administration/hooks/backup.d"
empty_directory "#{app_path}/administration/hooks/restore.d"
@@ -72,11 +70,13 @@
end
append_to_file "#{routine_dir}/backup_routine", "docker_mgr backup_app #{app_name}"
create_file "#{vhost_dir}/#{app_name}"
if options[:cert]
- app_cert = "#{cert_dir}/#{@domain}"
- puts `openssl req -x509 -newkey rsa:4096 -subj '/CN=#{config[:host]}' -nodes -keyout #{app_cert}.key -out #{app_cert}.crt`
+ FileUtils.cd "#{admin_dir}/ca" do
+ puts "#{admin_dir}/ca/sign.sh"
+ puts `./sign.sh #{@domain}`
+ end
end
end
desc "image IMAGE_NAME","creates a new image."
def image(image_name)