github_bitbucket_deployer 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 26db8331ec93b1bfcca69796b62706b44bde7df7
4
- data.tar.gz: ab86f9d0b91833e8b4c23dc516ddab529b1f409c
3
+ metadata.gz: d6b737dfce5c4760aea2c32fe585d5abd944c3d0
4
+ data.tar.gz: 7094e876a2bbe279d65b7c0e08de58ec15f28cef
5
5
  SHA512:
6
- metadata.gz: cd08ab565ec6cc99721f810869843ed9db8af8d9022d688fb3440f383d49913ad0467b5ca588e3352a959e2e39bf5a5993de7442ba611324d36f056adb91ac28
7
- data.tar.gz: 2fec783ed7da9e3a094f3f71e8a9aa155156468477edbc69fe2a1dddec82ce4250fc459e47257ca07bc061e336c7b23147798976f6e7b5a84386c05e8907bf6b
6
+ metadata.gz: 60c62c6c1a2a8895a78dde75cdc21773d3cdcf83a268660066c738c269ada89c0132c85f2eb251e3dcede6a7c9f256a868e4f8fdb4a76ca2006e247de5a729a9
7
+ data.tar.gz: 73ca648da3ebbe5c09dd3d48d8ef555f2f0a8448c8ab3789c57a63f3c19acd0dbaa3f8dd83560eb8a1a4169d6648a46ae1f55feea02bfa1c1b03c0776afcbae4
@@ -5,7 +5,7 @@ require 'github_bitbucket_deployer/clone_logger_fix'
5
5
 
6
6
  module GithubBitbucketDeployer
7
7
  class Git
8
- attr_reader :bitbucket_repo_url, :git_repo_name, :id_rsa, :repo_dir, :logger
8
+ attr_reader :bitbucket_repo_url, :git_repo_name, :id_rsa, :repo_dir, :logger, :force
9
9
 
10
10
  def initialize(options)
11
11
  @bitbucket_repo_url = options[:bitbucket_repo_url]
@@ -13,6 +13,7 @@ module GithubBitbucketDeployer
13
13
  @id_rsa = options[:id_rsa]
14
14
  @logger = options[:logger]
15
15
  @repo_dir = options[:repo_dir]
16
+ @force = options.fetch(:force, true)
16
17
  end
17
18
 
18
19
  def push_app_to_bitbucket(remote = 'bitbucket', branch = 'master')
@@ -49,7 +50,7 @@ module GithubBitbucketDeployer
49
50
  def push(remote, branch)
50
51
  logger.info("git push: deploying #{repo.dir} to " \
51
52
  "#{repo.remote(remote).url} from branch #{branch}")
52
- run { repo.push(remote, branch, force: true) }
53
+ run { repo.push(remote, branch, force: force) }
53
54
  end
54
55
 
55
56
  def add_remote(remote = 'bitbucket')
@@ -1,3 +1,3 @@
1
1
  module GithubBitbucketDeployer
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
@@ -4,6 +4,7 @@ describe GithubBitbucketDeployer::Git do
4
4
  include GitHelpers
5
5
 
6
6
  let(:git) { described_class.new(options) }
7
+ let(:gentle_git) { described_class.new(gentle_options) }
7
8
 
8
9
  let(:options) do
9
10
  { bitbucket_repo_url: bitbucket_repo_url,
@@ -13,6 +14,8 @@ describe GithubBitbucketDeployer::Git do
13
14
  repo_dir: repo_dir }
14
15
  end
15
16
 
17
+ let(:gentle_options) { options.merge(force: false) }
18
+
16
19
  let(:bitbucket_repo_url) { 'git@bitbucket.org:g5dev/some_repo.git' }
17
20
  let(:git_repo_name) { 'some_repo' }
18
21
  let(:local_repo_folder) { Zlib.crc32(git_repo_name) }
@@ -71,6 +74,14 @@ describe GithubBitbucketDeployer::Git do
71
74
  it 'sets the repo_dir' do
72
75
  expect(git.repo_dir).to eq(repo_dir)
73
76
  end
77
+
78
+ it 'defaults to a forced push' do
79
+ expect(git.force).to be true
80
+ end
81
+
82
+ it 'can also be gentle' do
83
+ expect(gentle_git.force).to be false
84
+ end
74
85
  end
75
86
 
76
87
  describe '#push_app_to_bitbucket', :fakefs do
@@ -103,6 +114,12 @@ describe GithubBitbucketDeployer::Git do
103
114
  .with('bitbucket', 'master', force: true)
104
115
  push_app
105
116
  end
117
+
118
+ it 'can also be gentle' do
119
+ expect(git_repo).to receive(:push)
120
+ .with('bitbucket', 'master', force: false)
121
+ gentle_git.push_app_to_bitbucket
122
+ end
106
123
  end
107
124
 
108
125
  context 'when local repo does not exist' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_bitbucket_deployer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jessica Lynn Suttles
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-11-04 00:00:00.000000000 Z
12
+ date: 2016-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: git
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
166
  version: '0'
167
167
  requirements: []
168
168
  rubyforge_project:
169
- rubygems_version: 2.4.8
169
+ rubygems_version: 2.5.1
170
170
  signing_key:
171
171
  specification_version: 4
172
172
  summary: Deploys public and private Github repos to bitbucket