repo_tools 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/repo_tools/git_status_checker.rb +28 -0
- data/lib/repo_tools/puller.rb +5 -0
- data/lib/repo_tools/version.rb +1 -1
- data/lib/repo_tools.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 926c107e9eb4b6a7208322ea7ca32dbf6ab31212
|
4
|
+
data.tar.gz: 31baca717a1ed231df15a940f66af2c3f8fff815
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15d5485262dbfef94959734756d5caa9e2c21fdab103fa1d96bb2bfb42ae0778c3df298161a6d5faf5011e271bf6bcb64b6a20382f24c11c949f84578ec16b67
|
7
|
+
data.tar.gz: d7c34a817258f3c0b70c3b721fa92974a7c3da7f562d3391b9f8c2be85611fb509c21093161aca6f136730b7e9a1c87210f5833a56a1910828ddef7bb32f4ecd
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module RepoTools; class GitStatusChecker
|
2
|
+
|
3
|
+
attr_reader :git_dirname
|
4
|
+
|
5
|
+
def initialize(git_dirname)
|
6
|
+
@git_dirname = git_dirname
|
7
|
+
end
|
8
|
+
|
9
|
+
def up_to_date?
|
10
|
+
return false unless git_initialized?
|
11
|
+
local_sha == remote_sha
|
12
|
+
end
|
13
|
+
|
14
|
+
def git_initialized?
|
15
|
+
return false unless File.directory?(git_dirname)
|
16
|
+
Dir.foreach(git_dirname).any? {|f| f == ".git"}
|
17
|
+
end
|
18
|
+
|
19
|
+
def local_sha
|
20
|
+
`git --git-dir #{git_dirname}/.git rev-parse master`
|
21
|
+
end
|
22
|
+
|
23
|
+
def remote_sha
|
24
|
+
`git --git-dir #{git_dirname}/.git rev-parse origin/master`
|
25
|
+
end
|
26
|
+
|
27
|
+
end; end
|
28
|
+
|
data/lib/repo_tools/puller.rb
CHANGED
@@ -9,11 +9,16 @@ module RepoTools; class Puller
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def clean_and_clone
|
12
|
+
return if git_status_checker.up_to_date?
|
12
13
|
FileUtils.rm_rf destination_dirname
|
13
14
|
clone
|
14
15
|
log_clone
|
15
16
|
end
|
16
17
|
|
18
|
+
def git_status_checker
|
19
|
+
GitStatusChecker.new(destination_dirname)
|
20
|
+
end
|
21
|
+
|
17
22
|
def clone
|
18
23
|
`git clone #{ssh_clone_url} #{destination_dirname}`
|
19
24
|
end
|
data/lib/repo_tools/version.rb
CHANGED
data/lib/repo_tools.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repo_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MrPowers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- bin/console
|
71
71
|
- bin/setup
|
72
72
|
- lib/repo_tools.rb
|
73
|
+
- lib/repo_tools/git_status_checker.rb
|
73
74
|
- lib/repo_tools/puller.rb
|
74
75
|
- lib/repo_tools/version.rb
|
75
76
|
- repo_tools.gemspec
|