monos 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +0 -1
- data/README.md +2 -2
- data/Rakefile +2 -2
- data/lib/mono/base.rb +40 -40
- data/lib/mono/commands/backup.rb +15 -15
- data/lib/mono/commands/env.rb +26 -26
- data/lib/mono/commands/fetch.rb +44 -44
- data/lib/mono/commands/run.rb +47 -47
- data/lib/mono/commands/status.rb +65 -65
- data/lib/mono/commands/sync.rb +53 -53
- data/lib/mono/tool.rb +40 -40
- data/lib/mono/version.rb +1 -1
- metadata +15 -10
- data/lib/sportdb/setup.rb +0 -106
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7785eb99b7c2f8d35ea8b0f11e06ae8cf366f613
|
4
|
+
data.tar.gz: f141af65145dd3b7095f7145314558b6245ad54a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: db773ecea48e74063358fb5c862aaa940bdef1601244e395c54f7f61de7e870525b2c747f77d75c84ff4cd3b4bcdfc221a8eee477085ec56ba426b6ab24f12bd
|
7
|
+
data.tar.gz: 8076d1725422bce4a74dc07d7dd4eec7252b4e5dea8abbb335fd8663f59bbc5295ecf5353c9147fa36a7c79c6827d9b4d43e97029dc0c2f6379f69a9b0fbece2
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# monos - monorepo / mono source tree tools and (startup) scripts
|
2
2
|
|
3
3
|
|
4
|
-
* home :: [github.com/rubycoco/
|
5
|
-
* bugs :: [github.com/rubycoco/
|
4
|
+
* home :: [github.com/rubycoco/git](https://github.com/rubycoco/git)
|
5
|
+
* bugs :: [github.com/rubycoco/git/issues](https://github.com/rubycoco/git/issues)
|
6
6
|
* gem :: [rubygems.org/gems/monos](https://rubygems.org/gems/monos)
|
7
7
|
* rdoc :: [rubydoc.info/gems/monos](http://rubydoc.info/gems/monos)
|
8
8
|
* forum :: [opensport](http://groups.google.com/group/opensport)
|
data/Rakefile
CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'monos' do
|
|
8
8
|
self.summary = "monos - monorepo / mono source tree tools and (startup) scripts"
|
9
9
|
self.description = summary
|
10
10
|
|
11
|
-
self.urls = { home: 'https://github.com/rubycoco/
|
11
|
+
self.urls = { home: 'https://github.com/rubycoco/git' }
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
14
|
self.email = 'opensport@googlegroups.com'
|
@@ -20,7 +20,7 @@ Hoe.spec 'monos' do
|
|
20
20
|
self.licenses = ['Public Domain']
|
21
21
|
|
22
22
|
self.extra_deps = [
|
23
|
-
['gitti', '>= 0.
|
23
|
+
['gitti', '>= 0.6.0' ],
|
24
24
|
['gitti-backup', '>= 0.4.1' ],
|
25
25
|
]
|
26
26
|
|
data/lib/mono/base.rb
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
|
2
|
-
module Mono
|
3
|
-
|
4
|
-
def self.root ## root of single (monorepo) source tree
|
5
|
-
@@root ||= begin
|
6
|
-
## todo/fix:
|
7
|
-
## check if windows - otherwise use /sites
|
8
|
-
## check if root directory exists?
|
9
|
-
if ENV['MOPATH']
|
10
|
-
ENV['MOPATH']
|
11
|
-
elsif Dir.exist?( 'C:/Sites' )
|
12
|
-
'C:/Sites'
|
13
|
-
else
|
14
|
-
'/sites'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.monofile
|
20
|
-
path = if File.exist?( './monorepo.yml' )
|
21
|
-
'./monorepo.yml'
|
22
|
-
elsif File.exist?( './monotree.yml' )
|
23
|
-
'./monotree.yml'
|
24
|
-
elsif File.exist?( './repos.yml' )
|
25
|
-
'./repos.yml'
|
26
|
-
else
|
27
|
-
puts "!! WARN: no mono configuration file (that is, {monorepo,monotree,repos}.yml) found in >#{Dir.getwd}<"
|
28
|
-
nil
|
29
|
-
end
|
30
|
-
|
31
|
-
if path
|
32
|
-
GitRepoSet.read( path )
|
33
|
-
else
|
34
|
-
GitRepoSet.new( {} ) ## return empty set -todo/check: return nil - why? why not?
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end ## module Mono
|
39
|
-
|
40
|
-
|
1
|
+
|
2
|
+
module Mono
|
3
|
+
|
4
|
+
def self.root ## root of single (monorepo) source tree
|
5
|
+
@@root ||= begin
|
6
|
+
## todo/fix:
|
7
|
+
## check if windows - otherwise use /sites
|
8
|
+
## check if root directory exists?
|
9
|
+
if ENV['MOPATH']
|
10
|
+
ENV['MOPATH']
|
11
|
+
elsif Dir.exist?( 'C:/Sites' )
|
12
|
+
'C:/Sites'
|
13
|
+
else
|
14
|
+
'/sites'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.monofile
|
20
|
+
path = if File.exist?( './monorepo.yml' )
|
21
|
+
'./monorepo.yml'
|
22
|
+
elsif File.exist?( './monotree.yml' )
|
23
|
+
'./monotree.yml'
|
24
|
+
elsif File.exist?( './repos.yml' )
|
25
|
+
'./repos.yml'
|
26
|
+
else
|
27
|
+
puts "!! WARN: no mono configuration file (that is, {monorepo,monotree,repos}.yml) found in >#{Dir.getwd}<"
|
28
|
+
nil
|
29
|
+
end
|
30
|
+
|
31
|
+
if path
|
32
|
+
GitRepoSet.read( path )
|
33
|
+
else
|
34
|
+
GitRepoSet.new( {} ) ## return empty set -todo/check: return nil - why? why not?
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
end ## module Mono
|
39
|
+
|
40
|
+
|
data/lib/mono/commands/backup.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
module Mono
|
2
|
-
|
3
|
-
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
-
def self.backup
|
5
|
-
repos = Mono.monofile
|
6
|
-
|
7
|
-
backup = GitBackup.new
|
8
|
-
|
9
|
-
## step 2: pass in all repos to backup by using
|
10
|
-
## 1) git clone --mirror or
|
11
|
-
## 2) git remote update (if local backup already exists)
|
12
|
-
backup.backup( repos )
|
13
|
-
end # method backup
|
14
|
-
|
15
|
-
end # module Mono
|
1
|
+
module Mono
|
2
|
+
|
3
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
+
def self.backup
|
5
|
+
repos = Mono.monofile
|
6
|
+
|
7
|
+
backup = GitBackup.new
|
8
|
+
|
9
|
+
## step 2: pass in all repos to backup by using
|
10
|
+
## 1) git clone --mirror or
|
11
|
+
## 2) git remote update (if local backup already exists)
|
12
|
+
backup.backup( repos )
|
13
|
+
end # method backup
|
14
|
+
|
15
|
+
end # module Mono
|
data/lib/mono/commands/env.rb
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
module Mono
|
2
|
-
|
3
|
-
def self.env ## check environment setup
|
4
|
-
puts "Mono.root (MOPATH): >#{Mono.root}<"
|
5
|
-
puts "MonoCore.root: >#{MonoCore.root}<"
|
6
|
-
puts
|
7
|
-
|
8
|
-
## add ruby version and path - why? why not? e.g.
|
9
|
-
## ruby:
|
10
|
-
## bin: C:/ri330/Ruby2.0.0/bin/ruby.exe
|
11
|
-
## version: ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
|
12
|
-
|
13
|
-
puts "git version:"
|
14
|
-
Git.version
|
15
|
-
## Git.config( 'user.name' )
|
16
|
-
## Git.config( 'user.email', show_origin: true )
|
17
|
-
|
18
|
-
## dump/print all user.* settings e.g. user.name, user.email
|
19
|
-
Git.config( /user/, show_origin: true )
|
20
|
-
|
21
|
-
puts
|
22
|
-
puts "monorepo.yml:"
|
23
|
-
pp Mono.monofile
|
24
|
-
end
|
25
|
-
|
26
|
-
end # module Mono
|
1
|
+
module Mono
|
2
|
+
|
3
|
+
def self.env ## check environment setup
|
4
|
+
puts "Mono.root (MOPATH): >#{Mono.root}<"
|
5
|
+
puts "MonoCore.root: >#{MonoCore.root}<"
|
6
|
+
puts
|
7
|
+
|
8
|
+
## add ruby version and path - why? why not? e.g.
|
9
|
+
## ruby:
|
10
|
+
## bin: C:/ri330/Ruby2.0.0/bin/ruby.exe
|
11
|
+
## version: ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
|
12
|
+
|
13
|
+
puts "git version:"
|
14
|
+
Git.version
|
15
|
+
## Git.config( 'user.name' )
|
16
|
+
## Git.config( 'user.email', show_origin: true )
|
17
|
+
|
18
|
+
## dump/print all user.* settings e.g. user.name, user.email
|
19
|
+
Git.config( /user/, show_origin: true )
|
20
|
+
|
21
|
+
puts
|
22
|
+
puts "monorepo.yml:"
|
23
|
+
pp Mono.monofile
|
24
|
+
end
|
25
|
+
|
26
|
+
end # module Mono
|
data/lib/mono/commands/fetch.rb
CHANGED
@@ -1,44 +1,44 @@
|
|
1
|
-
module Mono
|
2
|
-
|
3
|
-
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
-
def self.fetch
|
5
|
-
repos = Mono.monofile
|
6
|
-
|
7
|
-
count_orgs = 0
|
8
|
-
count_repos = 0
|
9
|
-
|
10
|
-
total_repos = repos.size
|
11
|
-
|
12
|
-
|
13
|
-
repos.each do |org,names|
|
14
|
-
|
15
|
-
org_path = "#{Mono.root}/#{org}"
|
16
|
-
|
17
|
-
names.each do |name|
|
18
|
-
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
19
|
-
|
20
|
-
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
21
|
-
|
22
|
-
Dir.chdir( org_path ) do
|
23
|
-
if Dir.exist?( repo.name )
|
24
|
-
GitProject.open( repo.name ) do |proj|
|
25
|
-
proj.fetch
|
26
|
-
end
|
27
|
-
else
|
28
|
-
puts "!! repo not found / missing"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
count_repos += 1
|
33
|
-
end
|
34
|
-
count_orgs += 1
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
## print stats & changes summary
|
39
|
-
puts
|
40
|
-
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
41
|
-
print "\n"
|
42
|
-
end # method fetch
|
43
|
-
|
44
|
-
end # module Mono
|
1
|
+
module Mono
|
2
|
+
|
3
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
+
def self.fetch
|
5
|
+
repos = Mono.monofile
|
6
|
+
|
7
|
+
count_orgs = 0
|
8
|
+
count_repos = 0
|
9
|
+
|
10
|
+
total_repos = repos.size
|
11
|
+
|
12
|
+
|
13
|
+
repos.each do |org,names|
|
14
|
+
|
15
|
+
org_path = "#{Mono.root}/#{org}"
|
16
|
+
|
17
|
+
names.each do |name|
|
18
|
+
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
19
|
+
|
20
|
+
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
21
|
+
|
22
|
+
Dir.chdir( org_path ) do
|
23
|
+
if Dir.exist?( repo.name )
|
24
|
+
GitProject.open( repo.name ) do |proj|
|
25
|
+
proj.fetch
|
26
|
+
end
|
27
|
+
else
|
28
|
+
puts "!! repo not found / missing"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
count_repos += 1
|
33
|
+
end
|
34
|
+
count_orgs += 1
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
## print stats & changes summary
|
39
|
+
puts
|
40
|
+
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
41
|
+
print "\n"
|
42
|
+
end # method fetch
|
43
|
+
|
44
|
+
end # module Mono
|
data/lib/mono/commands/run.rb
CHANGED
@@ -1,47 +1,47 @@
|
|
1
|
-
module Mono
|
2
|
-
|
3
|
-
def self.run( *args )
|
4
|
-
## todo/fix: use a "standard" argument to pass along hash of repos
|
5
|
-
## (e.g. monorepo.yml or repos.yml ) how? - why? why not?
|
6
|
-
repos = Mono.monofile
|
7
|
-
|
8
|
-
|
9
|
-
cmd = args.join( ' ' )
|
10
|
-
|
11
|
-
count_orgs = 0
|
12
|
-
count_repos = 0
|
13
|
-
|
14
|
-
total_repos = repos.size
|
15
|
-
|
16
|
-
repos.each do |org,names|
|
17
|
-
|
18
|
-
org_path = "#{Mono.root}/#{org}"
|
19
|
-
|
20
|
-
names.each do |name|
|
21
|
-
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
22
|
-
|
23
|
-
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
24
|
-
|
25
|
-
Dir.chdir( org_path ) do
|
26
|
-
if Dir.exist?( repo.name )
|
27
|
-
GitProject.open( repo.name ) do |proj|
|
28
|
-
proj.run( cmd )
|
29
|
-
end
|
30
|
-
else
|
31
|
-
puts "!! repo not found / missing"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
count_repos += 1
|
36
|
-
end
|
37
|
-
count_orgs += 1
|
38
|
-
end
|
39
|
-
|
40
|
-
|
41
|
-
## print stats & changes summary
|
42
|
-
puts
|
43
|
-
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
44
|
-
print "\n"
|
45
|
-
end # method run
|
46
|
-
|
47
|
-
end # module Mono
|
1
|
+
module Mono
|
2
|
+
|
3
|
+
def self.run( *args )
|
4
|
+
## todo/fix: use a "standard" argument to pass along hash of repos
|
5
|
+
## (e.g. monorepo.yml or repos.yml ) how? - why? why not?
|
6
|
+
repos = Mono.monofile
|
7
|
+
|
8
|
+
|
9
|
+
cmd = args.join( ' ' )
|
10
|
+
|
11
|
+
count_orgs = 0
|
12
|
+
count_repos = 0
|
13
|
+
|
14
|
+
total_repos = repos.size
|
15
|
+
|
16
|
+
repos.each do |org,names|
|
17
|
+
|
18
|
+
org_path = "#{Mono.root}/#{org}"
|
19
|
+
|
20
|
+
names.each do |name|
|
21
|
+
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
22
|
+
|
23
|
+
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
24
|
+
|
25
|
+
Dir.chdir( org_path ) do
|
26
|
+
if Dir.exist?( repo.name )
|
27
|
+
GitProject.open( repo.name ) do |proj|
|
28
|
+
proj.run( cmd )
|
29
|
+
end
|
30
|
+
else
|
31
|
+
puts "!! repo not found / missing"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
count_repos += 1
|
36
|
+
end
|
37
|
+
count_orgs += 1
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
## print stats & changes summary
|
42
|
+
puts
|
43
|
+
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
44
|
+
print "\n"
|
45
|
+
end # method run
|
46
|
+
|
47
|
+
end # module Mono
|
data/lib/mono/commands/status.rb
CHANGED
@@ -1,65 +1,65 @@
|
|
1
|
-
module Mono
|
2
|
-
|
3
|
-
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
-
def self.status
|
5
|
-
repos = Mono.monofile
|
6
|
-
|
7
|
-
changes = [] ## track changes
|
8
|
-
|
9
|
-
count_orgs = 0
|
10
|
-
count_repos = 0
|
11
|
-
|
12
|
-
total_repos = repos.size
|
13
|
-
|
14
|
-
repos.each do |org,names|
|
15
|
-
|
16
|
-
org_path = "#{Mono.root}/#{org}"
|
17
|
-
|
18
|
-
names.each do |name|
|
19
|
-
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
20
|
-
|
21
|
-
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
22
|
-
|
23
|
-
Dir.chdir( org_path ) do
|
24
|
-
if Dir.exist?( repo.name )
|
25
|
-
GitProject.open( repo.name ) do |proj|
|
26
|
-
output = proj.changes
|
27
|
-
if output.empty?
|
28
|
-
puts " - no changes -"
|
29
|
-
else
|
30
|
-
changes << ["#{org}@#{name}", :CHANGES, output]
|
31
|
-
end
|
32
|
-
end
|
33
|
-
else
|
34
|
-
puts "!! repo not found / missing"
|
35
|
-
changes << ["#{org}@#{name}", :NOT_FOUND]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
count_repos += 1
|
40
|
-
end
|
41
|
-
count_orgs += 1
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
## print stats & changes summary
|
46
|
-
puts
|
47
|
-
print "#{changes.size} change(s) in "
|
48
|
-
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
49
|
-
print "\n"
|
50
|
-
|
51
|
-
changes.each do |item|
|
52
|
-
puts
|
53
|
-
print "== #{item[0]} - #{item[1]}"
|
54
|
-
case item[1]
|
55
|
-
when :CHANGES
|
56
|
-
print ":\n"
|
57
|
-
print item[2]
|
58
|
-
when :NOT_FOUND
|
59
|
-
print "\n"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
end # method status
|
64
|
-
|
65
|
-
end # module Mono
|
1
|
+
module Mono
|
2
|
+
|
3
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
+
def self.status
|
5
|
+
repos = Mono.monofile
|
6
|
+
|
7
|
+
changes = [] ## track changes
|
8
|
+
|
9
|
+
count_orgs = 0
|
10
|
+
count_repos = 0
|
11
|
+
|
12
|
+
total_repos = repos.size
|
13
|
+
|
14
|
+
repos.each do |org,names|
|
15
|
+
|
16
|
+
org_path = "#{Mono.root}/#{org}"
|
17
|
+
|
18
|
+
names.each do |name|
|
19
|
+
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
20
|
+
|
21
|
+
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
22
|
+
|
23
|
+
Dir.chdir( org_path ) do
|
24
|
+
if Dir.exist?( repo.name )
|
25
|
+
GitProject.open( repo.name ) do |proj|
|
26
|
+
output = proj.changes
|
27
|
+
if output.empty?
|
28
|
+
puts " - no changes -"
|
29
|
+
else
|
30
|
+
changes << ["#{org}@#{name}", :CHANGES, output]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
else
|
34
|
+
puts "!! repo not found / missing"
|
35
|
+
changes << ["#{org}@#{name}", :NOT_FOUND]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
count_repos += 1
|
40
|
+
end
|
41
|
+
count_orgs += 1
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
## print stats & changes summary
|
46
|
+
puts
|
47
|
+
print "#{changes.size} change(s) in "
|
48
|
+
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
49
|
+
print "\n"
|
50
|
+
|
51
|
+
changes.each do |item|
|
52
|
+
puts
|
53
|
+
print "== #{item[0]} - #{item[1]}"
|
54
|
+
case item[1]
|
55
|
+
when :CHANGES
|
56
|
+
print ":\n"
|
57
|
+
print item[2]
|
58
|
+
when :NOT_FOUND
|
59
|
+
print "\n"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end # method status
|
64
|
+
|
65
|
+
end # module Mono
|
data/lib/mono/commands/sync.rb
CHANGED
@@ -1,53 +1,53 @@
|
|
1
|
-
module Mono
|
2
|
-
|
3
|
-
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
-
def self.sync
|
5
|
-
repos = Mono.monofile
|
6
|
-
|
7
|
-
count_orgs = 0
|
8
|
-
count_repos = 0
|
9
|
-
|
10
|
-
total_repos = repos.size
|
11
|
-
|
12
|
-
repos.each do |org,names|
|
13
|
-
org_path = "#{Mono.root}/#{org}"
|
14
|
-
FileUtils.mkdir_p( org_path ) unless Dir.exist?( org_path ) ## make sure path exists
|
15
|
-
|
16
|
-
names.each do |name|
|
17
|
-
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
18
|
-
|
19
|
-
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
20
|
-
|
21
|
-
Dir.chdir( org_path ) do
|
22
|
-
if Dir.exist?( repo.name )
|
23
|
-
GitProject.open( repo.name ) do |proj|
|
24
|
-
if proj.changes?
|
25
|
-
puts "!! WARN - local changes in workdir; skipping fast forward (remote) sync / merge"
|
26
|
-
else
|
27
|
-
proj.fast_forward ## note: use git pull --ff-only (fast forward only - do NOT merge)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
else
|
31
|
-
Git.clone( repo.ssh_clone_url )
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
# todo/fix: add (back) error log !!!!!!!!!!!!
|
37
|
-
# rescue GitError => ex
|
38
|
-
# puts "!! ERROR: #{ex.message}"
|
39
|
-
#
|
40
|
-
# File.open( './errors.log', 'a' ) do |f|
|
41
|
-
# f.write "#{Time.now} -- repo #{org}/#{name} - #{ex.message}\n"
|
42
|
-
# end
|
43
|
-
|
44
|
-
count_repos += 1
|
45
|
-
end
|
46
|
-
count_orgs += 1
|
47
|
-
end
|
48
|
-
|
49
|
-
## print stats
|
50
|
-
puts "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
51
|
-
end # method sync
|
52
|
-
|
53
|
-
end # module Mono
|
1
|
+
module Mono
|
2
|
+
|
3
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
+
def self.sync
|
5
|
+
repos = Mono.monofile
|
6
|
+
|
7
|
+
count_orgs = 0
|
8
|
+
count_repos = 0
|
9
|
+
|
10
|
+
total_repos = repos.size
|
11
|
+
|
12
|
+
repos.each do |org,names|
|
13
|
+
org_path = "#{Mono.root}/#{org}"
|
14
|
+
FileUtils.mkdir_p( org_path ) unless Dir.exist?( org_path ) ## make sure path exists
|
15
|
+
|
16
|
+
names.each do |name|
|
17
|
+
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
18
|
+
|
19
|
+
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
20
|
+
|
21
|
+
Dir.chdir( org_path ) do
|
22
|
+
if Dir.exist?( repo.name )
|
23
|
+
GitProject.open( repo.name ) do |proj|
|
24
|
+
if proj.changes?
|
25
|
+
puts "!! WARN - local changes in workdir; skipping fast forward (remote) sync / merge"
|
26
|
+
else
|
27
|
+
proj.fast_forward ## note: use git pull --ff-only (fast forward only - do NOT merge)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
else
|
31
|
+
Git.clone( repo.ssh_clone_url )
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# todo/fix: add (back) error log !!!!!!!!!!!!
|
37
|
+
# rescue GitError => ex
|
38
|
+
# puts "!! ERROR: #{ex.message}"
|
39
|
+
#
|
40
|
+
# File.open( './errors.log', 'a' ) do |f|
|
41
|
+
# f.write "#{Time.now} -- repo #{org}/#{name} - #{ex.message}\n"
|
42
|
+
# end
|
43
|
+
|
44
|
+
count_repos += 1
|
45
|
+
end
|
46
|
+
count_orgs += 1
|
47
|
+
end
|
48
|
+
|
49
|
+
## print stats
|
50
|
+
puts "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
51
|
+
end # method sync
|
52
|
+
|
53
|
+
end # module Mono
|
data/lib/mono/tool.rb
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
module Mono
|
2
|
-
|
3
|
-
|
4
|
-
class Tool
|
5
|
-
def self.main( args=ARGV )
|
6
|
-
|
7
|
-
## note: for now assume first argument is command
|
8
|
-
## add options later
|
9
|
-
|
10
|
-
cmd = if args.size == 0
|
11
|
-
'status' ## make status "default" command
|
12
|
-
else
|
13
|
-
args.shift ## remove first (head) element
|
14
|
-
end
|
15
|
-
|
16
|
-
## note: allow shortcut for commands
|
17
|
-
case cmd.downcase
|
18
|
-
when 'status', 'stati', 'stat', 'st', 's'
|
19
|
-
Mono.status
|
20
|
-
when 'sync', 'syn', 'sy', ## note: allow aliases such as install, get & up too
|
21
|
-
'get', 'g',
|
22
|
-
'install', 'insta', 'inst', 'ins', 'i',
|
23
|
-
'up', 'u'
|
24
|
-
Mono.sync
|
25
|
-
when 'fetch', 'f'
|
26
|
-
Mono.fetch
|
27
|
-
when 'env', 'e'
|
28
|
-
Mono.env
|
29
|
-
when 'backup', 'back', 'b'
|
30
|
-
Mono.backup
|
31
|
-
when 'run', 'r', 'exec'
|
32
|
-
Mono.run( args )
|
33
|
-
else
|
34
|
-
puts "!! ERROR: unknown command >#{cmd}<"
|
35
|
-
exit 1
|
36
|
-
end
|
37
|
-
|
38
|
-
end # method self.main
|
39
|
-
end # class Tool
|
40
|
-
|
1
|
+
module Mono
|
2
|
+
|
3
|
+
|
4
|
+
class Tool
|
5
|
+
def self.main( args=ARGV )
|
6
|
+
|
7
|
+
## note: for now assume first argument is command
|
8
|
+
## add options later
|
9
|
+
|
10
|
+
cmd = if args.size == 0
|
11
|
+
'status' ## make status "default" command
|
12
|
+
else
|
13
|
+
args.shift ## remove first (head) element
|
14
|
+
end
|
15
|
+
|
16
|
+
## note: allow shortcut for commands
|
17
|
+
case cmd.downcase
|
18
|
+
when 'status', 'stati', 'stat', 'st', 's'
|
19
|
+
Mono.status
|
20
|
+
when 'sync', 'syn', 'sy', ## note: allow aliases such as install, get & up too
|
21
|
+
'get', 'g',
|
22
|
+
'install', 'insta', 'inst', 'ins', 'i',
|
23
|
+
'up', 'u'
|
24
|
+
Mono.sync
|
25
|
+
when 'fetch', 'f'
|
26
|
+
Mono.fetch
|
27
|
+
when 'env', 'e'
|
28
|
+
Mono.env
|
29
|
+
when 'backup', 'back', 'b'
|
30
|
+
Mono.backup
|
31
|
+
when 'run', 'r', 'exec'
|
32
|
+
Mono.run( args )
|
33
|
+
else
|
34
|
+
puts "!! ERROR: unknown command >#{cmd}<"
|
35
|
+
exit 1
|
36
|
+
end
|
37
|
+
|
38
|
+
end # method self.main
|
39
|
+
end # class Tool
|
40
|
+
|
41
41
|
end # module Mono
|
data/lib/mono/version.rb
CHANGED
@@ -6,7 +6,7 @@ module MonoCore ## todo/check: rename to MonoMeta, MonoModule or such - why? w
|
|
6
6
|
## note: move root to its own namespace to avoid
|
7
7
|
## conflict with Mono.root!!!!
|
8
8
|
MAJOR = 0 ## todo: namespace inside version or something - why? why not??
|
9
|
-
MINOR =
|
9
|
+
MINOR = 5
|
10
10
|
PATCH = 0
|
11
11
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
12
12
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: gitti
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: gitti-backup
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,30 +42,36 @@ dependencies:
|
|
42
42
|
name: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '4.0'
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '7'
|
48
51
|
type: :development
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
|
-
- - "
|
55
|
+
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: '4.0'
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '7'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: hoe
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
65
|
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
|
-
version: '3.
|
67
|
+
version: '3.22'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
72
|
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
|
-
version: '3.
|
74
|
+
version: '3.22'
|
69
75
|
description: monos - monorepo / mono source tree tools and (startup) scripts
|
70
76
|
email: opensport@googlegroups.com
|
71
77
|
executables:
|
@@ -94,10 +100,9 @@ files:
|
|
94
100
|
- lib/mono/tool.rb
|
95
101
|
- lib/mono/version.rb
|
96
102
|
- lib/monos.rb
|
97
|
-
- lib/sportdb/setup.rb
|
98
103
|
- test/helper.rb
|
99
104
|
- test/test_base.rb
|
100
|
-
homepage: https://github.com/rubycoco/
|
105
|
+
homepage: https://github.com/rubycoco/git
|
101
106
|
licenses:
|
102
107
|
- Public Domain
|
103
108
|
metadata: {}
|
data/lib/sportdb/setup.rb
DELETED
@@ -1,106 +0,0 @@
|
|
1
|
-
########
|
2
|
-
##
|
3
|
-
# fix:
|
4
|
-
# move to sportdb/setup or sportdb/boot ?
|
5
|
-
# use module SportDb::Boot
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
##########
|
10
|
-
# setup load path
|
11
|
-
# lets you use environments
|
12
|
-
# e.g. dev/development or production
|
13
|
-
|
14
|
-
|
15
|
-
## todo/fix: move later app/gem-family/-specific configs
|
16
|
-
## to its own gem e.g. mono-sportdb or sportdb-boot/starter/startup or such - why? why not?
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
$RUBYLIBS_DEBUG = true
|
23
|
-
$RUBYCOCO_DEBUG = true ## always include (NOT just in sportdb?)
|
24
|
-
|
25
|
-
|
26
|
-
### include / check for ruby debug flag too - why? why not?
|
27
|
-
def debug? ## always include (NOT just insportdb?)
|
28
|
-
value = ENV['DEBUG']
|
29
|
-
if value && ['true', 't',
|
30
|
-
'yes', 'y',
|
31
|
-
'on'].include?( value.downcase )
|
32
|
-
true
|
33
|
-
else
|
34
|
-
false
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
require_relative '../mono'
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
## convenience pre-configured/pre-built shortcut - lets you use
|
44
|
-
## require 'sportdb/setup'
|
45
|
-
## SportDb::Boot.setup
|
46
|
-
|
47
|
-
|
48
|
-
module SportDb
|
49
|
-
module Boot
|
50
|
-
def self.root() Mono.root; end
|
51
|
-
|
52
|
-
def self.setup ## setup load path
|
53
|
-
### note: for now always assume dev/development
|
54
|
-
### add ENV check later or pass in as args or such
|
55
|
-
|
56
|
-
puts "SportDb::Boot.root: >#{root}<"
|
57
|
-
|
58
|
-
### todo/fix: use an inline Gemfile and bundler's setup? why? why not?
|
59
|
-
$LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-exporters/lib" )
|
60
|
-
$LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-writers/lib" )
|
61
|
-
$LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-linters/lib" )
|
62
|
-
|
63
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sports/lib" )
|
64
|
-
|
65
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-importers/lib" )
|
66
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-readers/lib" )
|
67
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-sync/lib" )
|
68
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-models/lib" )
|
69
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-catalogs/lib" )
|
70
|
-
|
71
|
-
## todo/check:
|
72
|
-
## add fifa, footballdb-leagues, footballdb-clubs too ???
|
73
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/football.db/footballdb-clubs/lib" ))
|
74
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/football.db/footballdb-leagues/lib" ))
|
75
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/football.db/fifa/lib" ))
|
76
|
-
|
77
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-formats/lib" )
|
78
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-structs/lib" )
|
79
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-langs/lib" )
|
80
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/score-formats/lib" )
|
81
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/date-formats/lib" )
|
82
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/alphabets/lib" )
|
83
|
-
|
84
|
-
pp $: # print load path
|
85
|
-
end # method setup
|
86
|
-
end # module Boot
|
87
|
-
end # module Sportdb
|
88
|
-
|
89
|
-
|
90
|
-
### use something like SportDb::Path[:sportdb]
|
91
|
-
## SportDb.path( :sportdb )
|
92
|
-
## SportDb::Boot.sportdb_path or sportdb_dir or such???
|
93
|
-
## SportDb::Env.path( 'sportdb' ) ???
|
94
|
-
## SportDb::Env::SPORTDB_DIR ???
|
95
|
-
## or such - why? why not?
|
96
|
-
##
|
97
|
-
## check rails path setup / style ???
|
98
|
-
|
99
|
-
SPORTDB_DIR = "#{SportDb::Boot.root}/sportdb" # path to libs
|
100
|
-
OPENFOOTBALL_DIR = "#{SportDb::Boot.root}/openfootball"
|
101
|
-
## add more "standard" dirs - why? why not? - why? why not?
|
102
|
-
## use
|
103
|
-
## module SportDb::Source / Code / Boot or such????
|
104
|
-
##
|
105
|
-
## use module SportDb::Boot - yes, yes, yes - why? why not?
|
106
|
-
|