From f1f2e22b0472527806ac99487a61b81ac2c23b22 Mon Sep 17 00:00:00 2001 From: Tilmann Singer Date: Thu, 18 Jun 2015 14:51:43 +0200 Subject: [PATCH 01/10] Relax version requirements for net-ssh and net-scp Fixes #73 --- Gemfile.lock | 13 ++++++++----- git-deploy.gemspec | 4 ++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index bc88868..efa6ba3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,18 +1,18 @@ PATH remote: . specs: - git-deploy (0.6.0) - net-scp (~> 1.1.0) - net-ssh (~> 2.6.6) + git-deploy (0.6.1) + net-scp (~> 1.1) + net-ssh (~> 2.6) thor (= 0.14.6) GEM remote: https://rubygems.org/ specs: diff-lcs (1.2.4) - net-scp (1.1.2) + net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (2.6.8) + net-ssh (2.9.1) rspec (2.13.0) rspec-core (~> 2.13.0) rspec-expectations (~> 2.13.0) @@ -29,3 +29,6 @@ PLATFORMS DEPENDENCIES git-deploy! rspec (~> 2.13.0) + +BUNDLED WITH + 1.10.3 diff --git a/git-deploy.gemspec b/git-deploy.gemspec index 76a6c59..27b2d75 100644 --- a/git-deploy.gemspec +++ b/git-deploy.gemspec @@ -5,8 +5,8 @@ Gem::Specification.new do |gem| gem.executables = %w[ git-deploy ] gem.add_dependency 'thor', '0.14.6' - gem.add_dependency 'net-ssh', '~> 2.6.6' - gem.add_dependency 'net-scp', '~> 1.1.0' + gem.add_dependency 'net-ssh', '~> 2.6' + gem.add_dependency 'net-scp', '~> 1.1' gem.summary = "Simple git push-based application deployment" gem.description = "A tool to install useful git hooks on your remote repository to enable push-based, Heroku-like deployment on your host." From 661a04bf57786af51ba13f71eb5518b667d575f8 Mon Sep 17 00:00:00 2001 From: Nathan Reed Date: Thu, 17 Mar 2016 15:49:41 +0800 Subject: [PATCH 02/10] handle ssh urls that use home relative paths (ie. paths starting with ~) It's common for us to have scp style remote urls that use the '~' at the start of the path, to indicate the home directory of the user used at the start of the url. The conversion of these scp style urls to ssh:// urls breaks the path and adds an initial '/' to the `deploy_to` path, causing git-deploy not to work. There is no way (that I know of) to preserve these paths when converting to an ssh:// style uri, so we need to detect this situation and 'correct' the url by removing the initial '/' when getting the path --- lib/git_deploy/configuration.rb | 11 ++++++++++- spec/configuration_spec.rb | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/lib/git_deploy/configuration.rb b/lib/git_deploy/configuration.rb index 25940bc..e9f653d 100644 --- a/lib/git_deploy/configuration.rb +++ b/lib/git_deploy/configuration.rb @@ -9,7 +9,16 @@ module Configuration extend Forwardable def_delegator :remote_url, :host def_delegator :remote_url, :port, :remote_port - def_delegator :remote_url, :path, :deploy_to + + def deploy_to + @deploy_to ||= begin + if remote_url.path.start_with? '/~/' + remote_url.path[1..-1] + else + remote_url.path + end + end + end def remote_user @user ||= begin diff --git a/spec/configuration_spec.rb b/spec/configuration_spec.rb index 5e46594..301609c 100644 --- a/spec/configuration_spec.rb +++ b/spec/configuration_spec.rb @@ -44,6 +44,15 @@ def stub_remote_url(url, remote = options[:remote]) its(:deploy_to) { should eq('/path/to/app') } end + context "scp-style with home" do + before { stub_remote_url 'git@example.com:~/path/to/app' } + + its(:host) { should eq('example.com') } + its(:remote_port) { should be_nil } + its(:remote_user) { should eq('git') } + its(:deploy_to) { should eq('~/path/to/app') } + end + context "pushurl only" do before { remote = options.fetch(:remote) From bdd8cbca50c9609b5d27f847da611f1606d5d4e0 Mon Sep 17 00:00:00 2001 From: Nathan Reed Date: Thu, 17 Mar 2016 19:11:54 +0800 Subject: [PATCH 03/10] minor adjustment to travis-ci config to try and avoid a bundler bug causing the builds to fail https://github.com/bundler/bundler/issues/3558#issuecomment-171347979 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 92dc677..6c203af 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false bundler_args: "--without development" script: bundle exec rspec rvm: From 25e70c1613f0469642d2462f7d0a5246f350325c Mon Sep 17 00:00:00 2001 From: Greg Navis Date: Thu, 29 Sep 2016 13:26:01 +0200 Subject: [PATCH 04/10] Don't display an error when no db/migrate before_restart.rb would make git print an error message when run in a Rails project without db/migrate. The error would be printed to stderr which would result in num_migrations being set to 0 (which is correct). However, printing the error message when there was no error is confusing. This commit introduces a check for the existence of db/migrate. If it exists then git is called. Otherwise num_migrations is set to 0. --- lib/git_deploy/templates/before_restart.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/git_deploy/templates/before_restart.rb b/lib/git_deploy/templates/before_restart.rb index 61dc67c..e048768 100644 --- a/lib/git_deploy/templates/before_restart.rb +++ b/lib/git_deploy/templates/before_restart.rb @@ -21,7 +21,12 @@ def run(cmd) if File.file? 'Rakefile' tasks = [] - num_migrations = `git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z -- db/migrate`.split("\0").size + if File.exist?('db/migrate') + num_migrations = `git diff #{oldrev} #{newrev} --diff-filter=A --name-only -z -- db/migrate`.split("\0").size + else + num_migrations = 0 + end + # run migrations if new ones have been added tasks << "db:migrate" if num_migrations > 0 From d0d61292cca738c2dba5e2277fa19afdeb103a66 Mon Sep 17 00:00:00 2001 From: Jakub Adler Date: Sat, 22 Sep 2018 15:30:19 +0100 Subject: [PATCH 05/10] Update dependency on net-ssh; Use actual version --- git-deploy.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-deploy.gemspec b/git-deploy.gemspec index 27b2d75..124248a 100644 --- a/git-deploy.gemspec +++ b/git-deploy.gemspec @@ -5,7 +5,7 @@ Gem::Specification.new do |gem| gem.executables = %w[ git-deploy ] gem.add_dependency 'thor', '0.14.6' - gem.add_dependency 'net-ssh', '~> 2.6' + gem.add_dependency 'net-ssh', '~> 5.0' gem.add_dependency 'net-scp', '~> 1.1' gem.summary = "Simple git push-based application deployment" From 28c5546f2d51a2663a24543ee44fabe056f658f3 Mon Sep 17 00:00:00 2001 From: Jakub Adler Date: Sat, 22 Sep 2018 15:31:33 +0100 Subject: [PATCH 06/10] Use port 22 for ssh if not specified in repo url --- lib/git_deploy/ssh_methods.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/git_deploy/ssh_methods.rb b/lib/git_deploy/ssh_methods.rb index 34afa6e..b2f345f 100644 --- a/lib/git_deploy/ssh_methods.rb +++ b/lib/git_deploy/ssh_methods.rb @@ -93,7 +93,7 @@ def scp_upload(files) def ssh_connection @ssh ||= begin - ssh = Net::SSH.start(host, remote_user, :port => remote_port) + ssh = Net::SSH.start(host, remote_user, :port => remote_port || 22) at_exit { ssh.close } ssh end From ec45f3a67fb106c3fd077695580dd679501aee36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 22 Mar 2019 16:26:00 +0100 Subject: [PATCH 07/10] Update Gemfile.lock --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index efa6ba3..5010f9d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -3,7 +3,7 @@ PATH specs: git-deploy (0.6.1) net-scp (~> 1.1) - net-ssh (~> 2.6) + net-ssh (~> 5.0) thor (= 0.14.6) GEM @@ -12,7 +12,7 @@ GEM diff-lcs (1.2.4) net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (2.9.1) + net-ssh (5.2.0) rspec (2.13.0) rspec-core (~> 2.13.0) rspec-expectations (~> 2.13.0) @@ -31,4 +31,4 @@ DEPENDENCIES rspec (~> 2.13.0) BUNDLED WITH - 1.10.3 + 2.0.1 From 2848bc969cd6ba3970e35d1b5d87775a8ceb1e04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 22 Mar 2019 16:26:09 +0100 Subject: [PATCH 08/10] Test against Ruby >= 2.3 --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92dc677..ea9f20e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ bundler_args: "--without development" script: bundle exec rspec rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 + - '2.3' + - '2.4' + - '2.5' From 7b2526f6dbd343d8dd42c8c6b53540c9a818a2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 22 Mar 2019 17:04:17 +0100 Subject: [PATCH 09/10] Require Ruby >= 2.2.6 --- git-deploy.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/git-deploy.gemspec b/git-deploy.gemspec index 124248a..5fb07e3 100644 --- a/git-deploy.gemspec +++ b/git-deploy.gemspec @@ -7,6 +7,7 @@ Gem::Specification.new do |gem| gem.add_dependency 'thor', '0.14.6' gem.add_dependency 'net-ssh', '~> 5.0' gem.add_dependency 'net-scp', '~> 1.1' + gem.required_ruby_version = '>= 2.2.6' gem.summary = "Simple git push-based application deployment" gem.description = "A tool to install useful git hooks on your remote repository to enable push-based, Heroku-like deployment on your host." From 744f4c02a356338228e40dc7aa1923c3efda4209 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Fri, 22 Mar 2019 17:12:55 +0100 Subject: [PATCH 10/10] v0.7.0 --- git-deploy.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-deploy.gemspec b/git-deploy.gemspec index 5fb07e3..bd3e65e 100644 --- a/git-deploy.gemspec +++ b/git-deploy.gemspec @@ -1,7 +1,7 @@ # encoding: utf-8 Gem::Specification.new do |gem| gem.name = 'git-deploy' - gem.version = '0.6.1' + gem.version = '0.7.0' gem.executables = %w[ git-deploy ] gem.add_dependency 'thor', '0.14.6'