Class: Conjure::Instance
- Inherits:
-
Object
- Object
- Conjure::Instance
- Defined in:
- lib/conjure/instance.rb
Defined Under Namespace
Classes: Collection
Class Method Summary collapse
Instance Method Summary collapse
- #application_name ⇒ Object
- #branch ⇒ Object
- #codebase ⇒ Object
- #create ⇒ Object
- #database ⇒ Object
- #deploy ⇒ Object
-
#initialize(options) ⇒ Instance
constructor
A new instance of Instance.
- #ip_address ⇒ Object
- #name ⇒ Object
- #origin ⇒ Object
- #rails_environment ⇒ Object
- #rails_server ⇒ Object
- #server ⇒ Object
- #server_name ⇒ Object
- #shell ⇒ Object
- #status ⇒ Object
- #target ⇒ Object
Constructor Details
#initialize(options) ⇒ Instance
Returns a new instance of Instance.
3 4 5 6 7 8 |
# File 'lib/conjure/instance.rb', line 3 def initialize() @origin = [:origin] @branch = [:branch] @rails_environment = [:rails_environment] @server = [:server] end |
Class Method Details
.where(options = {}) ⇒ Object
10 11 12 |
# File 'lib/conjure/instance.rb', line 10 def self.where( = {}) Collection.new() end |
Instance Method Details
#application_name ⇒ Object
70 71 72 |
# File 'lib/conjure/instance.rb', line 70 def application_name Application.new(:origin => @origin).name end |
#branch ⇒ Object
30 31 32 |
# File 'lib/conjure/instance.rb', line 30 def branch @branch ||= codebase.branch end |
#codebase ⇒ Object
50 51 52 |
# File 'lib/conjure/instance.rb', line 50 def codebase @codebase ||= Service::RailsCodebase.new target, origin, @branch, rails_environment end |
#create ⇒ Object
38 39 40 41 |
# File 'lib/conjure/instance.rb', line 38 def create @server_name = Service::CloudServer.ensure_unique_name(server_name) deploy end |
#database ⇒ Object
34 35 36 |
# File 'lib/conjure/instance.rb', line 34 def database codebase.database end |
#deploy ⇒ Object
43 44 45 46 47 48 |
# File 'lib/conjure/instance.rb', line 43 def deploy Log.info "[deploy] Deploying #{branch} to #{rails_environment}" codebase.install rails_server.run Log.info "[deploy] Application deployed to #{ip_address}" end |
#ip_address ⇒ Object
22 23 24 |
# File 'lib/conjure/instance.rb', line 22 def ip_address @server.ip_address end |
#name ⇒ Object
78 79 80 |
# File 'lib/conjure/instance.rb', line 78 def name server.name end |
#origin ⇒ Object
14 15 16 |
# File 'lib/conjure/instance.rb', line 14 def origin @origin ||= @server.name.split("-")[0] end |
#rails_environment ⇒ Object
18 19 20 |
# File 'lib/conjure/instance.rb', line 18 def rails_environment @rails_environment ||= @server.name.split("-")[1] end |
#rails_server ⇒ Object
54 55 56 |
# File 'lib/conjure/instance.rb', line 54 def rails_server @rails_server ||= Service::RailsServer.new target, rails_environment end |
#server ⇒ Object
62 63 64 |
# File 'lib/conjure/instance.rb', line 62 def server @server ||= Service::CloudServer.new(server_name) end |
#server_name ⇒ Object
58 59 60 |
# File 'lib/conjure/instance.rb', line 58 def server_name @server_name ||= "#{application_name}-#{rails_environment}" end |
#shell ⇒ Object
26 27 28 |
# File 'lib/conjure/instance.rb', line 26 def shell rails_server.base_image end |
#status ⇒ Object
74 75 76 |
# File 'lib/conjure/instance.rb', line 74 def status "running" end |