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 +4 -4
- data/.circleci/config.yml +16 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/git-safe.gemspec +1 -1
- data/lib/git-safe/git.rb +10 -2
- data/lib/git-safe/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a0b6c1caa45fd00e0efe0b635aa4cbdc50f8668e79c026d670a1f2acde51311
|
4
|
+
data.tar.gz: f713c7662244c7af08dc51aafef385a2cf1e5a024b86933792a3ffcfa208aa39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
data/CHANGELOG.md
ADDED
data/Gemfile.lock
CHANGED
data/git-safe.gemspec
CHANGED
@@ -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://
|
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.
|
data/lib/git-safe/git.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/git-safe/version.rb
CHANGED
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.
|
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
|
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://
|
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".
|