Class: Conjure::Service::RailsCodebase
- Inherits:
-
Object
- Object
- Conjure::Service::RailsCodebase
- Defined in:
- lib/conjure/service/rails_codebase.rb
Instance Method Summary collapse
- #branch ⇒ Object
- #configure_database ⇒ Object
- #configure_logs ⇒ Object
- #database ⇒ Object
- #database_yml ⇒ Object
- #gem_names ⇒ Object
-
#initialize(target, github_url, branch, rails_environment) ⇒ RailsCodebase
constructor
A new instance of RailsCodebase.
- #install ⇒ Object
- #repository_link ⇒ Object
- #volume ⇒ Object
Constructor Details
#initialize(target, github_url, branch, rails_environment) ⇒ RailsCodebase
Returns a new instance of RailsCodebase.
4 5 6 7 8 9 |
# File 'lib/conjure/service/rails_codebase.rb', line 4 def initialize(target, github_url, branch, rails_environment) @github_url = github_url @branch = branch @rails_environment = rails_environment @target = target end |
Instance Method Details
#branch ⇒ Object
24 25 26 |
# File 'lib/conjure/service/rails_codebase.rb', line 24 def branch @branch ||= repository_link.branch end |
#configure_database ⇒ Object
47 48 49 50 |
# File 'lib/conjure/service/rails_codebase.rb', line 47 def configure_database Log.info "[ repo] Generating database.yml" volume.write "config/database.yml", database_yml end |
#configure_logs ⇒ Object
52 53 54 55 56 |
# File 'lib/conjure/service/rails_codebase.rb', line 52 def configure_logs Log.info "[ repo] Configuring application logger" setup = 'Rails.logger = Logger.new "#{Rails.root}/log/#{Rails.env}.log"' volume.write "config/initializers/z_conjure_logger.rb", setup end |
#database ⇒ Object
62 63 64 |
# File 'lib/conjure/service/rails_codebase.rb', line 62 def database @database ||= Database.new :target => @target, :codebase => self end |
#database_yml ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/conjure/service/rails_codebase.rb', line 11 def database_yml { @rails_environment => { "adapter" => database.adapter_name, "database" => database.name, "encoding" => "utf8", "host" => database.ip_address, "username" => "root", "template" => "template0", } }.to_yaml end |
#gem_names ⇒ Object
58 59 60 |
# File 'lib/conjure/service/rails_codebase.rb', line 58 def gem_names volume.read("Gemfile").scan(/gem ['"]([^'"]+)['"]/).flatten end |
#install ⇒ Object
28 29 30 31 32 |
# File 'lib/conjure/service/rails_codebase.rb', line 28 def install repository_link.update configure_database configure_logs end |
#repository_link ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/conjure/service/rails_codebase.rb', line 34 def repository_link @repository_link ||= RepositoryLink.new( :volume => volume, :branch => @branch, :origin_url => @github_url, :public_key => Conjure.identity.public_key_data.gsub("\n", "\\n"), ) end |