git-projects 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/git-projects.rb +0 -0
- data/lib/git-projects/version.rb +1 -1
- data/lib/helpers/git_project.rb +7 -7
- data/lib/helpers/git_project_config.rb +4 -6
- data/lib/helpers/git_project_remote.rb +17 -2
- data/lib/helpers/project.rb +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0d3460f9fc31b8d0e3f12f125d3fe7a3f6f1ea5
|
4
|
+
data.tar.gz: 0a20d5d089c2013fb1ec5d7c50e8fadf36fa9535
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb218234f1e950915c16546e4cb9d5bbb8f0eb4bce0ecfa34477295347662a982e0538b1fbaf9b124c002b69b547df6b7e1cb48678d8923cf4ca1d5fc4844267
|
7
|
+
data.tar.gz: 8225526d267a0544ee86e0355652b71730c9a6d2d6d4e4416199c5fea9ff1e48654022e62b56304cd71aa82d8d35fa242611a59c111fcab1e8462b508ea73ae4
|
data/lib/git-projects.rb
CHANGED
File without changes
|
data/lib/git-projects/version.rb
CHANGED
data/lib/helpers/git_project.rb
CHANGED
@@ -64,11 +64,10 @@ class GitProject
|
|
64
64
|
# 2. Add all other remotes unless it is origin
|
65
65
|
def create_project_and_remotes(k, v)
|
66
66
|
puts "root_dir isn't defined for #{k}" unless v['root_dir']
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
GitProject.
|
71
|
-
g = GitProject.clone(v.values[0], k, v['root_dir'])
|
67
|
+
GitProject.dir_or_symlink_exist?(v['root_dir'])
|
68
|
+
root_dir = GitProject.real_root_dir(v['root_dir'])
|
69
|
+
GitProject.create_root_dir(root_dir)
|
70
|
+
g = GitProject.clone(v.values[0], k, root_dir)
|
72
71
|
GitProject.add_remote(g, v) if g
|
73
72
|
end
|
74
73
|
|
@@ -76,8 +75,9 @@ class GitProject
|
|
76
75
|
def fetch_all(group = nil)
|
77
76
|
@project.all(group).each do |k, v|
|
78
77
|
puts "Fetching changes for #{k}".green
|
79
|
-
GitProject.
|
80
|
-
|
78
|
+
root_dir = GitProject.real_root_dir(v['root_dir'])
|
79
|
+
GitProject.create_root_dir(root_dir)
|
80
|
+
working_dir = "#{root_dir}/#{k}"
|
81
81
|
g = Git.open(working_dir) || Git.init(working_dir)
|
82
82
|
GitProject.fetch(g)
|
83
83
|
end
|
@@ -23,13 +23,11 @@ module GitProjectConfig
|
|
23
23
|
|
24
24
|
# Check for the config
|
25
25
|
def check_config
|
26
|
-
|
27
|
-
puts "Checking repositories. If things go wrong,
|
26
|
+
puts "Checking repositories. If things go wrong,
|
28
27
|
update #{ENV['GIT_PROJECTS']}".green
|
29
|
-
|
30
|
-
|
31
|
-
export GIT_PROJECTS=/path/to/git_projects.yml"
|
32
|
-
end
|
28
|
+
|
29
|
+
fail "Please add the path your git projects config. \n
|
30
|
+
export GIT_PROJECTS=/path/to/git_projects.yml" unless ENV['GIT_PROJECTS']
|
33
31
|
end
|
34
32
|
|
35
33
|
# Create YAML file
|
@@ -6,14 +6,29 @@ module GitProjectRemote
|
|
6
6
|
|
7
7
|
# Check/ add new remotes
|
8
8
|
module ClassMethods
|
9
|
+
# Check if symbolic link or directory exists
|
10
|
+
def dir_or_symlink_exist?(path)
|
11
|
+
symbolic_link_exists = (File.symlink?(path) && File.readlink(path))
|
12
|
+
unless File.directory?(path) || symbolic_link_exists
|
13
|
+
puts "The dir #{path} does not exist"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
# Get real root_dir
|
18
|
+
def real_root_dir(path)
|
19
|
+
return File.readlink(path) if File.symlink?(path)
|
20
|
+
path
|
21
|
+
end
|
22
|
+
|
9
23
|
# Clone unless dir exists
|
10
24
|
def clone(url, name, path)
|
25
|
+
path = real_root_dir(path)
|
11
26
|
r = "#{path}/#{name}"
|
12
|
-
|
27
|
+
g = Git.open(r)
|
28
|
+
if g
|
13
29
|
puts 'Already cloned '.yellow + "#{url}".blue
|
14
30
|
else
|
15
31
|
Git.clone(url, name, path: path) || Git.init(r)
|
16
|
-
g = Git.open(r)
|
17
32
|
puts "Cloning #{url} as #{name} into #{path}".green
|
18
33
|
end
|
19
34
|
g
|
data/lib/helpers/project.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-projects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Katherine Pe
|
7
|
+
- Katherine G. Pe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|