This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(framework): "Padrino" support added
Resolves #44 Signed-off-by: Igor Rzegocki <igor@rzegocki.pl>
- Loading branch information
Showing
8 changed files
with
151 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# frozen_string_literal: true | ||
module Drivers | ||
module Framework | ||
class Padrino < Drivers::Framework::Base | ||
adapter :padrino | ||
allowed_engines :padrino | ||
output filter: [ | ||
:migrate, :migration_command, :deploy_environment, :assets_precompile, :assets_precompilation_command | ||
] | ||
|
||
def raw_out | ||
super.merge( | ||
deploy_environment: { 'RACK_ENV' => globals[:environment], 'DATABASE_URL' => database_url }, | ||
assets_precompile: node['deploy'][app['shortname']]['framework']['assets_precompile'] | ||
) | ||
end | ||
|
||
def deploy_before_restart | ||
assets_precompile if out[:assets_precompile] | ||
end | ||
|
||
private | ||
|
||
def assets_precompile | ||
output = out | ||
deploy_to = deploy_dir(app) | ||
env = environment.merge('HOME' => node['deployer']['home']) | ||
|
||
context.execute 'assets:precompile' do | ||
command output[:assets_precompilation_command] | ||
user node['deployer']['user'] | ||
cwd File.join(deploy_to, 'current') | ||
group www_group | ||
environment env | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
require 'spec_helper' | ||
|
||
describe Drivers::Framework::Padrino do | ||
it 'receives and exposes app and node' do | ||
driver = described_class.new(dummy_context(node), aws_opsworks_app) | ||
|
||
expect(driver.app).to eq aws_opsworks_app | ||
expect(driver.send(:node)).to eq node | ||
expect(driver.options).to eq({}) | ||
end | ||
|
||
it 'returns proper out data' do | ||
expect(described_class.new(dummy_context(node), aws_opsworks_app).out).to eq( | ||
assets_precompile: nil, | ||
assets_precompilation_command: 'bundle exec rake assets:precompile', | ||
deploy_environment: { | ||
'RACK_ENV' => 'staging', | ||
'DATABASE_URL' => 'sqlite:///srv/www/dummy_project/current/db/dummy_project_staging.sqlite' | ||
}, | ||
migration_command: 'rake db:migrate', | ||
migrate: false | ||
) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters