Class: Conjure::Service::RailsApplication
- Inherits:
-
Object
- Object
- Conjure::Service::RailsApplication
- Defined in:
- lib/conjure/service/rails_application.rb
Instance Method Summary collapse
- #codebase ⇒ Object
- #database ⇒ Object
- #deploy ⇒ Object
- #docker ⇒ Object
-
#initialize(options) ⇒ RailsApplication
constructor
A new instance of RailsApplication.
- #name_from_origin(origin) ⇒ Object
- #rails ⇒ Object
Constructor Details
#initialize(options) ⇒ RailsApplication
Returns a new instance of RailsApplication.
4 5 6 7 8 9 10 |
# File 'lib/conjure/service/rails_application.rb', line 4 def initialize() @origin = [:origin] @name = name_from_origin @origin @branch = [:branch] || "master" @environment = "production" @test = [:test] end |
Instance Method Details
#codebase ⇒ Object
29 30 31 |
# File 'lib/conjure/service/rails_application.rb', line 29 def codebase @codebase ||= Service::RailsCodebase.new docker, @origin, @branch, @name, @environment end |
#database ⇒ Object
25 26 27 |
# File 'lib/conjure/service/rails_application.rb', line 25 def database codebase.database end |
#deploy ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/conjure/service/rails_application.rb', line 12 def deploy Log.info "[deploy] Deploying #{@name}:#{@branch} to #{@environment}" unless @test codebase.install rails.run Log.info "[deploy] Application deployed to #{docker.ip_address}" end end |
#docker ⇒ Object
21 22 23 |
# File 'lib/conjure/service/rails_application.rb', line 21 def docker @docker ||= Service::DockerHost.new "#{@name}-#{@environment}" end |
#name_from_origin(origin) ⇒ Object
37 38 39 |
# File 'lib/conjure/service/rails_application.rb', line 37 def name_from_origin(origin) origin.match(/\/([^.]+)\.git$/)[1] end |
#rails ⇒ Object
33 34 35 |
# File 'lib/conjure/service/rails_application.rb', line 33 def rails @rails ||= Service::RailsServer.new docker, @name, @environment end |