repo_tools 0.1.1 → 0.2.0
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/puller.rb +5 -20
- data/lib/repo_tools/version.rb +1 -1
- data/lib/tasks/test.rake +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6216a245d5b171c079ced2f72c1405f097db730
|
4
|
+
data.tar.gz: fc84db3fbcc912c5d1556b48ce3994162ed95e29
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0eb961b9ed642e8d7edeaffedd750f3846d81f19b6880e49e97bac03b9355ca4012f184bc2f04d242cd95d38b231a271eab1b3f207e8f0d18ae865ff6a3e5422
|
7
|
+
data.tar.gz: 0471af6f680bb482c174b73a99a3310c9429d395b3264f6d14be97ea6fbd52e0c5066ede8605b1da83b74022db2ab1c1b559e1347c5a10e124bd4b0f8d04d0e7
|
data/lib/repo_tools/puller.rb
CHANGED
@@ -1,18 +1,16 @@
|
|
1
1
|
module RepoTools; class Puller
|
2
2
|
|
3
|
-
attr_reader :ssh_clone_url
|
3
|
+
attr_reader :ssh_clone_url
|
4
4
|
|
5
|
-
def initialize(
|
6
|
-
@ssh_clone_url = ssh_clone_url
|
7
|
-
@
|
8
|
-
@environment = environment
|
5
|
+
def initialize(args)
|
6
|
+
@ssh_clone_url = args.fetch(:ssh_clone_url)
|
7
|
+
@destination_dirname = args.fetch(:destination_dirname)
|
9
8
|
end
|
10
9
|
|
11
10
|
def clean_and_clone
|
12
11
|
return if git_status_checker.up_to_date?
|
13
12
|
FileUtils.rm_rf destination_dirname
|
14
13
|
clone
|
15
|
-
log_clone
|
16
14
|
end
|
17
15
|
|
18
16
|
def git_status_checker
|
@@ -23,14 +21,8 @@ module RepoTools; class Puller
|
|
23
21
|
`git clone #{ssh_clone_url} #{destination_dirname}`
|
24
22
|
end
|
25
23
|
|
26
|
-
def log_clone
|
27
|
-
File.open(log, 'a') do |f|
|
28
|
-
f.puts "[#{Time.now.utc.iso8601}]: #{project_name} was cloned"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
24
|
def destination_dirname
|
33
|
-
p = Pathname.new(
|
25
|
+
p = Pathname.new(@destination_dirname)
|
34
26
|
FileUtils.mkdir_p(p.dirname)
|
35
27
|
p
|
36
28
|
end
|
@@ -39,12 +31,5 @@ module RepoTools; class Puller
|
|
39
31
|
ssh_clone_url.match(/\/((\w|\-)+)/)[1]
|
40
32
|
end
|
41
33
|
|
42
|
-
def log
|
43
|
-
p = Pathname.new(project_root).join('log', environment).join("#{project_name}.log")
|
44
|
-
FileUtils.mkdir_p(p.dirname)
|
45
|
-
FileUtils.touch(p)
|
46
|
-
p
|
47
|
-
end
|
48
|
-
|
49
34
|
end; end
|
50
35
|
|
data/lib/repo_tools/version.rb
CHANGED
data/lib/tasks/test.rake
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
desc '
|
1
|
+
desc 'clone a git repo locally to make sure repo_tools is working'
|
2
2
|
task :puller_test do
|
3
3
|
root = Dir.pwd
|
4
|
-
|
4
|
+
args = {
|
5
|
+
ssh_clone_url: "git@github.com:MrPowers/frontend-generators.git",
|
6
|
+
destination_dirname: "#{root}/test/"
|
7
|
+
}
|
8
|
+
puller = RepoTools::Puller.new(args)
|
5
9
|
puller.clean_and_clone
|
6
10
|
end
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MrPowers
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|