lib/shelly/app.rb in shelly-0.0.12 vs lib/shelly/app.rb in shelly-0.0.13
- old
+ new
@@ -2,14 +2,15 @@
require 'launchy'
module Shelly
class App < Base
DATABASE_KINDS = %w(postgresql mongodb redis none)
- attr_accessor :purpose, :code_name, :databases, :ruby_version, :environment
+ attr_accessor :purpose, :code_name, :databases, :ruby_version, :environment, :git_url
def initialize
@ruby_version = "MRI-1.9.2"
+ @environment = "production"
end
def add_git_remote(force = false)
system("git remote rm #{purpose}") if force
system("git remote add #{purpose} #{git_url}")
@@ -17,18 +18,10 @@
def remote_exists?
IO.popen("git remote").read.split("\n").include?(purpose)
end
- def git_host
- ENV["SHELLY_GIT_HOST"] || "git.shellycloud.com"
- end
-
- def git_url
- "git@#{git_host}:#{code_name}.git"
- end
-
def generate_cloudfile
@email = current_user.email
@databases = databases
template = File.read(cloudfile_template_path)
cloudfile = ERB.new(template, 0, "%<>-")
@@ -41,14 +34,15 @@
def create
attributes = {
:name => code_name,
:code_name => code_name,
- :environment => purpose,
+ :environment => environment,
:ruby_version => ruby_version,
:domain_name => "#{code_name}.shellycloud.com"
}
- shelly.create_app(attributes)
+ response = shelly.create_app(attributes)
+ self.git_url = response["git_url"]
end
def create_cloudfile
content = generate_cloudfile
File.open(cloudfile_path, "a+") { |f| f << content }