Skip to content

Instantly share code, notes, and snippets.

Mateusz Leszczyński mleszcz

Block or report user

Report or block mleszcz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View deploy.rb
set :capose_file, ["docker-compose.yml"]
set :capose_commands, ["run --rm app bundle install", "up -d"]
View .docker-compose.yml
version: '3'
services:
db:
image: postgres
volumes:
- postgres-data:/var/lib/postgresql/data
app: &app
build: .
image: some-app
command: bundle exec rails s -p 3000 -b '0.0.0.0'
View deploy.rb
#
# Test the app before deployment
#
desc "Check if the application is releasable => run tests"
before :deploy, :test_app do
unless system("bundle install") &&
system("bundle exec rake db:drop db:create db:migrate db:seed") &&
system("bundle exec rake")
puts "===> FIX SPECS AND RETRY <==="
exit
@mleszcz
mleszcz / auto-deploying.md
Created Jun 4, 2018 — forked from nickbclifford/auto-deploying.md
How to automatically deploy code to a server using Travis CI
View auto-deploying.md

Auto-Deploying via Travis CI

Because Travis CI can automatically execute scripts after successfully (or unsuccessfully!) executing tests, it is an obvious choice for a deployment tool. In order to deploy to a Git repository on a remote server, the process generally is as follows:

  • Set up SSH keys
  • Add the server's copy of the repository as a Git remote
  • Push to the remote
  • SSH into the server and execute any installation/compilation/miscellaneous commands

Before even touching .travis.yml...

Users

View solid-5-dip-correct-2.rb
# higher level
class Copy
def self.call(reader, writer)
writer.call(reader.call)
end
end
# lower level
Copy.call(WriteToSSD, ReadFromSSD)
View solid-5-dip-correct-1.rb
# higher level
class Copy
def self.call(reader, writer)
writer.call(reader.call)
end
end
# lower level
Copy.call(WriteToHDD, ReadFromHDD)
View solid-5-dip-2.rb
# higher level
class Copy
def self.call
WriteToSSD.call(ReadFromSSD.call)
end
end
# lower level
Copy.call
View solid-5-dip-1.rb
# higher level
class Copy
def self.call
WriteToHDD.call(ReadFromHDD.call)
end
end
# lower level
Copy.call
View solid-3-lsp-fail-use-case.rb
shapes = [ Rectangle.new, Square.new ]
shapes.each { |shape| shape.set_width(100) }
View solid-3-lsp-square-fail.rb
class Square < Rectangle
def set_width(width)
@width = width
@height = height
some_ui_width_related_callbacks
some_ui_height_related_callbacks
end
def set_height(height)
set_width(height)
You can’t perform that action at this time.