git-safe 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: 2b7839df797b7a01ee24bafccc8f6086ed5142ffbe7d7cf5901899a410e895d6
4
- data.tar.gz: 0032cd4ceed5039f1e0e3b60cb872ec8a68aa3cbfe17e745198b2842c19cb329
3
+ metadata.gz: 8a0b6c1caa45fd00e0efe0b635aa4cbdc50f8668e79c026d670a1f2acde51311
4
+ data.tar.gz: f713c7662244c7af08dc51aafef385a2cf1e5a024b86933792a3ffcfa208aa39
5
5
  SHA512:
6
- metadata.gz: 68d399eb56a55c992bcc12f7d4bf7e3f87b1a2b3a670e93bffba1d27703d70d3ee117eb28a6a66a1a90671cca2242d1f40720a4040366d951735562d8df9fa5c
7
- data.tar.gz: 9ab7a7a5e919e57787702a2300dacdb006a35339a6a1d0fa6850d6360178ce1f23328ea4df45a5e364ac64de5f1eb1b46a9fcf8a64655ab1bdebb1d32a9ac977
6
+ metadata.gz: 38e7580cc42dd60935067ea391761b673365d0e841b35b74365c4239b091ddf874c9a5f79630c6e9db81cff2139e27bd93f93b9ba29ff5cbd6110b7c1947cbd1
7
+ data.tar.gz: 515f5f954b357bf43ae07acd9eb3bf6c73b317654cb1221bc463a2551316b4e77f2baa9fb4dbf09d4ea1de71c9f5491c7415588ed596122ff883ba4a9d2fcd4d
@@ -0,0 +1,16 @@
1
+ version: 2.1
2
+ orbs:
3
+ ruby: circleci/ruby@0.1.2
4
+
5
+ jobs:
6
+ build:
7
+ docker:
8
+ - image: circleci/ruby:2.6.3-stretch-node
9
+ executor: ruby/default
10
+ steps:
11
+ - checkout
12
+ - run:
13
+ name: Which bundler?
14
+ command: bundle -v
15
+ - ruby/bundle-install
16
+
data/.gitignore CHANGED
@@ -10,3 +10,4 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  spec/support/working-dirs/*
13
+ *.gem
@@ -0,0 +1,5 @@
1
+ ## v0.2.0 (2020-11-10)
2
+ * [#1](https://github.com/perryqh/git-safe-ruby/pull/1) introducing reset_to_remote to fix push -force
3
+
4
+ ## v0.1.0 (2020-02-21)
5
+ * Initial release
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- git-safe (0.1.0)
4
+ git-safe (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{A concurrent-safe way to perform multiple ssh configuration git operations against "origin".}
13
13
  spec.description = %q{Some applications need to access git "origin" from multiple threads or processes with different security access approaches. This gem makes it possible}
14
- spec.homepage = "https://github.com/perrqh/git-safe-ruby"
14
+ spec.homepage = "https://rubygems.org/gems/git-safe"
15
15
 
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
@@ -64,6 +64,10 @@ module GitSafe
64
64
  execute_git_cmd("git #{git_locale} merge #{to_merge_name}")
65
65
  end
66
66
 
67
+ def reset_local_to_remote(remote_name)
68
+ execute_git_cmd("git #{git_locale} reset --hard #{remote_name}")
69
+ end
70
+
67
71
  def push(remote: 'origin', branch: 'master', force: false)
68
72
  force_flag = force ? '-f ' : ''
69
73
  execute_git_cmd("git #{git_locale} push #{force_flag}#{remote} #{branch}")
@@ -119,7 +123,7 @@ module GitSafe
119
123
  end
120
124
  end
121
125
 
122
- def clone_or_fetch_and_merge(remote_uri, branch: 'master', remote_name: 'origin', depth: nil, force_fresh_clone: false, git_config: {})
126
+ def clone_or_fetch_and_merge(remote_uri, branch: 'master', remote_name: 'origin', depth: nil, force_fresh_clone: false, reset_to_remote: false, git_config: {})
123
127
  delete_work_tree if force_fresh_clone
124
128
 
125
129
  unless has_remote?
@@ -129,7 +133,11 @@ module GitSafe
129
133
  config_set(git_config)
130
134
  fetch
131
135
  checkout(branch: branch)
132
- merge("#{remote_name}/#{branch}")
136
+ if reset_to_remote
137
+ reset_local_to_remote("#{remote_name}/#{branch}")
138
+ else
139
+ merge("#{remote_name}/#{branch}")
140
+ end
133
141
  end
134
142
 
135
143
  def git_config
@@ -1,3 +1,3 @@
1
1
  module GitSafe
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-safe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Perry Hertler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-30 00:00:00.000000000 Z
11
+ date: 2020-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -88,9 +88,11 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
+ - ".circleci/config.yml"
91
92
  - ".gitignore"
92
93
  - ".rspec"
93
94
  - ".travis.yml"
95
+ - CHANGELOG.md
94
96
  - Gemfile
95
97
  - Gemfile.lock
96
98
  - README.md
@@ -105,10 +107,10 @@ files:
105
107
  - lib/git-safe/ssh_tempfile.rb
106
108
  - lib/git-safe/version.rb
107
109
  - lib/git_safe.rb
108
- homepage: https://github.com/perrqh/git-safe-ruby
110
+ homepage: https://rubygems.org/gems/git-safe
109
111
  licenses: []
110
112
  metadata: {}
111
- post_install_message:
113
+ post_install_message:
112
114
  rdoc_options: []
113
115
  require_paths:
114
116
  - lib
@@ -124,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
126
  version: '0'
125
127
  requirements: []
126
128
  rubygems_version: 3.0.3
127
- signing_key:
129
+ signing_key:
128
130
  specification_version: 4
129
131
  summary: A concurrent-safe way to perform multiple ssh configuration git operations
130
132
  against "origin".