monos 0.1.1 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +7 -6
- data/README.md +69 -39
- data/Rakefile +7 -4
- data/lib/mono.rb +25 -12
- data/lib/mono/base.rb +19 -0
- data/lib/mono/commands/env.rb +26 -0
- data/lib/mono/commands/fetch.rb +44 -0
- data/lib/mono/commands/run.rb +47 -0
- data/lib/mono/{git → commands}/status.rb +7 -15
- data/lib/mono/commands/sync.rb +53 -0
- data/lib/mono/{git/tool.rb → tool.rb} +7 -1
- data/lib/mono/version.rb +26 -18
- data/lib/sportdb/setup.rb +106 -0
- data/test/test_base.rb +35 -4
- metadata +38 -10
- data/bin/moget +0 -17
- data/lib/mono/git/base.rb +0 -174
- data/lib/mono/git/sync.rb +0 -98
- data/lib/mono/sportdb.rb +0 -61
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee4368f5e1359184cd8592946f23e9140c72d28b
|
4
|
+
data.tar.gz: c6bcc16a6c88e0ffe2266fee1bce4b5a12772874
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0675326b562361aef8d40f39db0a20b1d20767b44d1bdea716170e5dd006af94375e89c5e05d2c8681c8fff0958f99de9a08a7bc09c55f1d1fe1b1ad997cb037
|
7
|
+
data.tar.gz: d3c5e25625174b05bc9a098e64f7614eea15fe15699a9bbfafe98bcb01d2b1dacfd1022801e344202fe9c7b5470561e6b970ae74df3f9b07ea11dbe8f3c1ed77
|
data/Manifest.txt
CHANGED
@@ -3,16 +3,17 @@ Manifest.txt
|
|
3
3
|
README.md
|
4
4
|
Rakefile
|
5
5
|
bin/mo
|
6
|
-
bin/moget
|
7
6
|
bin/mono
|
8
7
|
lib/mono.rb
|
9
8
|
lib/mono/base.rb
|
10
|
-
lib/mono/
|
11
|
-
lib/mono/
|
12
|
-
lib/mono/
|
13
|
-
lib/mono/
|
14
|
-
lib/mono/
|
9
|
+
lib/mono/commands/env.rb
|
10
|
+
lib/mono/commands/fetch.rb
|
11
|
+
lib/mono/commands/run.rb
|
12
|
+
lib/mono/commands/status.rb
|
13
|
+
lib/mono/commands/sync.rb
|
14
|
+
lib/mono/tool.rb
|
15
15
|
lib/mono/version.rb
|
16
16
|
lib/monos.rb
|
17
|
+
lib/sportdb/setup.rb
|
17
18
|
test/helper.rb
|
18
19
|
test/test_base.rb
|
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/
|
5
|
-
* bugs :: [github.com/
|
4
|
+
* home :: [github.com/rubycoco/sport.db](https://github.com/rubycoco/monos)
|
5
|
+
* bugs :: [github.com/rubycoco/sport.db/issues](https://github.com/rubycoco/monos/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)
|
@@ -15,64 +15,63 @@
|
|
15
15
|
The `mono` (or short `mo`) command line tool lets you run
|
16
16
|
git commands on multiple repo(sitories) with a single command.
|
17
17
|
|
18
|
-
Add all repo(sitories) to the `monorepo.yml` that you want
|
19
|
-
to be part of the "virtual" all-in-one / single mono source tree.
|
20
|
-
Example:
|
21
18
|
|
22
|
-
``` yml
|
23
|
-
####################
|
24
|
-
# checkout skripts (auto-update machinery)
|
25
|
-
yorobot:
|
26
|
-
- cache.csv ## incl. self
|
27
|
-
- sport.db.more
|
28
|
-
- football.db
|
29
|
-
- football.csv
|
30
19
|
|
31
|
-
|
32
|
-
|
20
|
+
### Setup
|
21
|
+
|
22
|
+
#### 1) The monorepo (single source tree) root - `MOPATH`
|
23
|
+
|
24
|
+
Use the `MOPATH` environment variable to set the monorepo (single source tree) root
|
25
|
+
path. The builtin default for now is `/sites`.
|
26
|
+
|
27
|
+
#### 2) The configuration / manifest file to list all repos - `monorepo.yml`
|
28
|
+
|
29
|
+
|
30
|
+
Add all repo(sitories) to the `monorepo.yml` that you want
|
31
|
+
to be part of the "virtual" all-in-one / single mono source tree
|
32
|
+
in your project. Example:
|
33
|
+
|
34
|
+
``` yaml
|
33
35
|
sportdb:
|
34
36
|
- sport.db
|
35
37
|
- sport.db.sources
|
36
38
|
- football.db
|
37
39
|
|
38
|
-
|
39
|
-
|
40
|
+
yorobot:
|
41
|
+
- cache.csv
|
42
|
+
- sport.db.more
|
43
|
+
- football.db
|
44
|
+
- football.csv
|
45
|
+
|
40
46
|
openfootball:
|
41
47
|
- leagues
|
42
48
|
- clubs
|
43
49
|
```
|
44
50
|
|
45
51
|
|
46
|
-
### MOPATH - The monorepo (single source tree) root
|
47
|
-
|
48
|
-
Use the `MOPATH` environment variable to set the monorepo (single source tree) root
|
49
|
-
path. The builtin default for now is `/sites`.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
52
|
|
54
53
|
### Commands
|
55
54
|
|
56
|
-
`status` • `sync`
|
55
|
+
`status` • `fetch` • `sync` • `run` •`env`
|
57
56
|
|
58
57
|
### `status` Command
|
59
58
|
|
60
59
|
Use the `status` command to check for changes (will use `git status --short`) on all repos. Example:
|
61
60
|
|
62
|
-
|
61
|
+
```
|
63
62
|
$ mono status
|
64
63
|
$ mono # status is the default command
|
65
64
|
$ mo status # mo is a "shortcut" convenience alias for mono
|
66
65
|
$ mo stat
|
67
66
|
$ mo
|
68
|
-
|
67
|
+
```
|
69
68
|
|
70
69
|
resulting in something like:
|
71
70
|
|
72
|
-
|
71
|
+
```
|
73
72
|
2 change(s) in 9 repo(s) @ 3 org(s)
|
74
73
|
|
75
|
-
|
74
|
+
-- sportdb@sport.db - CHANGES:
|
76
75
|
M monos/Manifest.txt
|
77
76
|
M monos/README.md
|
78
77
|
M monos/Rakefile
|
@@ -83,32 +82,63 @@ RM monos/lib/monoscript.rb -> monos/lib/monos.rb
|
|
83
82
|
M monos/test/test_base.rb
|
84
83
|
?? monos/bin/
|
85
84
|
|
86
|
-
|
85
|
+
-- yorobot@football.csv - CHANGES:
|
87
86
|
?? footballdata/
|
88
|
-
|
87
|
+
```
|
89
88
|
|
90
89
|
|
90
|
+
### `fetch` Command
|
91
91
|
|
92
|
-
|
92
|
+
Use the `fetch` command to fetch all (remote) changes (will use `git fetch`) on all existing repos and warn about not-yet-cloned repos. Example:
|
93
93
|
|
94
|
-
|
94
|
+
```
|
95
|
+
$ mono fetch
|
96
|
+
$ mo fetch # mo is a "shortcut" convenience alias for mono
|
97
|
+
```
|
95
98
|
|
96
|
-
Note: `moget` is a shortcut convenience command for `mono get` (or, that is, `mono sync`).
|
97
99
|
|
98
100
|
|
99
|
-
|
101
|
+
### `sync` Command
|
102
|
+
|
100
103
|
|
101
|
-
Example:
|
104
|
+
Use the `sync` command to sync up (pull) changes (will use `git pull --ff-only`) on all existing repos and `git clone` for new not-yet-cloned repos. Example:
|
102
105
|
|
103
|
-
|
106
|
+
```
|
104
107
|
$ mono sync
|
105
108
|
$ mono install # install is an alias for sync
|
106
109
|
$ mono get # get is another alias for sync
|
107
110
|
$ mo sync # mo is a "shortcut" convenience alias for mono
|
108
111
|
$ mo get
|
109
|
-
|
110
|
-
|
112
|
+
```
|
113
|
+
|
114
|
+
Note: `install` or `get` or `up` are all aliases that you can use for `sync`.
|
115
|
+
|
116
|
+
|
117
|
+
### `run` Command
|
118
|
+
|
119
|
+
Use the `run` command to run any command in all repos. Example:
|
120
|
+
|
121
|
+
```
|
122
|
+
$ mono run git ls-files
|
123
|
+
$ mono exec git ls-files # exec is an alias for run
|
124
|
+
$ mo run git ls-files # mo is a "shortcut" convenience alias for mono
|
125
|
+
$ mo exec git ls-files
|
126
|
+
|
127
|
+
# -or-
|
128
|
+
|
129
|
+
$ mono run tree
|
130
|
+
$ mono exec tree
|
131
|
+
$ mo run tree
|
132
|
+
$ mo exec tree
|
133
|
+
```
|
134
|
+
|
135
|
+
Note: `exec` is an alias that you can use for `run`.
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
### `env` Command
|
111
140
|
|
141
|
+
Use the `env` command to check your `mono` environment setup.
|
112
142
|
|
113
143
|
|
114
144
|
That's all for now.
|
data/Rakefile
CHANGED
@@ -3,15 +3,15 @@ require './lib/mono/version.rb'
|
|
3
3
|
|
4
4
|
Hoe.spec 'monos' do
|
5
5
|
|
6
|
-
self.version =
|
6
|
+
self.version = MonoCore::VERSION
|
7
7
|
|
8
8
|
self.summary = "monos - monorepo / mono source tree tools and (startup) scripts"
|
9
9
|
self.description = summary
|
10
10
|
|
11
|
-
self.urls =
|
11
|
+
self.urls = { home: 'https://github.com/rubycoco/monos' }
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
|
-
self.email
|
14
|
+
self.email = 'opensport@googlegroups.com'
|
15
15
|
|
16
16
|
# switch extension to .markdown for gihub formatting
|
17
17
|
self.readme_file = 'README.md'
|
@@ -19,7 +19,10 @@ Hoe.spec 'monos' do
|
|
19
19
|
|
20
20
|
self.licenses = ['Public Domain']
|
21
21
|
|
22
|
-
self.extra_deps = [
|
22
|
+
self.extra_deps = [
|
23
|
+
['gitti', '>= 0.4.0' ],
|
24
|
+
['gitti-backup', '>= 0.3.0' ],
|
25
|
+
]
|
23
26
|
|
24
27
|
self.spec_extras = {
|
25
28
|
required_ruby_version: '>= 2.2.2'
|
data/lib/mono.rb
CHANGED
@@ -1,20 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
require '
|
6
|
-
|
7
|
-
|
1
|
+
## first add git support
|
2
|
+
## note: use the "modular" version WITHOUT auto-include gitti,
|
3
|
+
## thus, require 'gitti/base' (and NOT 'gitti')
|
4
|
+
require 'gitti/base'
|
5
|
+
require 'gitti/backup/base'
|
6
|
+
|
7
|
+
|
8
|
+
module Mono
|
9
|
+
## note: make Git, GitProject, GitRepoSet, etc. available without Gitti::
|
10
|
+
include Gitti
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
## some more stdlibs
|
15
|
+
# require 'optparse'
|
16
|
+
|
8
17
|
|
9
18
|
|
10
19
|
###
|
11
20
|
# our own code
|
12
21
|
require 'mono/version' # let version always go first
|
13
22
|
require 'mono/base'
|
14
|
-
|
15
|
-
require 'mono/
|
16
|
-
require 'mono/
|
17
|
-
require 'mono/
|
23
|
+
|
24
|
+
require 'mono/commands/status'
|
25
|
+
require 'mono/commands/fetch'
|
26
|
+
require 'mono/commands/sync'
|
27
|
+
require 'mono/commands/env'
|
28
|
+
require 'mono/commands/run'
|
29
|
+
require 'mono/tool'
|
30
|
+
|
18
31
|
|
19
32
|
|
20
|
-
puts
|
33
|
+
puts MonoCore.banner # say hello
|
data/lib/mono/base.rb
CHANGED
@@ -16,6 +16,25 @@ module Mono
|
|
16
16
|
end
|
17
17
|
end
|
18
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
|
+
|
19
38
|
end ## module Mono
|
20
39
|
|
21
40
|
|
@@ -0,0 +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
|
@@ -0,0 +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
|
@@ -0,0 +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,25 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
1
|
module Mono
|
4
2
|
|
5
3
|
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
6
|
-
def self.status
|
4
|
+
def self.status
|
5
|
+
repos = Mono.monofile
|
6
|
+
|
7
7
|
changes = [] ## track changes
|
8
8
|
|
9
9
|
count_orgs = 0
|
10
10
|
count_repos = 0
|
11
11
|
|
12
|
-
|
13
|
-
total_repos = h.reduce(0) {|sum,(_,names)| sum+= names.size; sum }
|
14
|
-
|
15
|
-
|
16
|
-
h.each do |org_with_counter,names|
|
12
|
+
total_repos = repos.size
|
17
13
|
|
18
|
-
|
19
|
-
## mrhydescripts (3) => mrhydescripts
|
20
|
-
## footballjs (4) => footballjs
|
21
|
-
## etc.
|
22
|
-
org = org_with_counter.sub( /\([0-9]+\)/, '' ).strip
|
14
|
+
repos.each do |org,names|
|
23
15
|
|
24
16
|
org_path = "#{Mono.root}/#{org}"
|
25
17
|
|
@@ -30,8 +22,8 @@ module Mono
|
|
30
22
|
|
31
23
|
Dir.chdir( org_path ) do
|
32
24
|
if Dir.exist?( repo.name )
|
33
|
-
|
34
|
-
output =
|
25
|
+
GitProject.open( repo.name ) do |proj|
|
26
|
+
output = proj.changes
|
35
27
|
if output.empty?
|
36
28
|
puts " - no changes -"
|
37
29
|
else
|
@@ -0,0 +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
|
@@ -15,13 +15,19 @@ class Tool
|
|
15
15
|
|
16
16
|
## note: allow shortcut for commands
|
17
17
|
case cmd.downcase
|
18
|
-
when 'status', 'stati', 'stat', 's'
|
18
|
+
when 'status', 'stati', 'stat', 'st', 's'
|
19
19
|
Mono.status
|
20
20
|
when 'sync', 'syn', 'sy', ## note: allow aliases such as install, get & up too
|
21
21
|
'get', 'g',
|
22
22
|
'install', 'insta', 'inst', 'ins', 'i',
|
23
23
|
'up', 'u'
|
24
24
|
Mono.sync
|
25
|
+
when 'fetch', 'f'
|
26
|
+
Mono.fetch
|
27
|
+
when 'env', 'e'
|
28
|
+
Mono.env
|
29
|
+
when 'run', 'r', 'exec'
|
30
|
+
Mono.run( args )
|
25
31
|
else
|
26
32
|
puts "!! ERROR: unknown command >#{cmd}<"
|
27
33
|
exit 1
|
data/lib/mono/version.rb
CHANGED
@@ -1,25 +1,33 @@
|
|
1
1
|
## note: use a different module/namespace
|
2
|
-
## for the gem version info e.g.
|
2
|
+
## for the gem version info e.g. MonoCore vs Mono
|
3
3
|
|
4
|
-
module
|
5
|
-
|
4
|
+
module MonoCore ## todo/check: rename to MonoMeta, MonoModule or such - why? why not?
|
5
|
+
|
6
|
+
## note: move root to its own namespace to avoid
|
7
|
+
## conflict with Mono.root!!!!
|
8
|
+
MAJOR = 0 ## todo: namespace inside version or something - why? why not??
|
9
|
+
MINOR = 3
|
10
|
+
PATCH = 1
|
11
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
12
|
+
|
13
|
+
def self.version
|
14
|
+
VERSION
|
15
|
+
end
|
6
16
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
17
|
+
def self.banner
|
18
|
+
"monos/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
19
|
+
end
|
11
20
|
|
12
|
-
|
13
|
-
|
14
|
-
|
21
|
+
def self.root
|
22
|
+
File.expand_path( File.dirname(File.dirname(__FILE__) ))
|
23
|
+
end
|
15
24
|
|
16
|
-
|
17
|
-
"monos/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
18
|
-
end
|
25
|
+
end # module MonoCore
|
19
26
|
|
20
|
-
def self.root
|
21
|
-
File.expand_path( File.dirname(File.dirname(__FILE__) ))
|
22
|
-
end
|
23
27
|
|
24
|
-
|
25
|
-
|
28
|
+
##################################
|
29
|
+
# add a convenience shortcut for now - why? why not?
|
30
|
+
module Mono
|
31
|
+
VERSION = MonoCore::VERSION
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,106 @@
|
|
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
|
+
|
data/test/test_base.rb
CHANGED
@@ -6,14 +6,45 @@ require 'helper'
|
|
6
6
|
|
7
7
|
class TestBase < MiniTest::Test
|
8
8
|
|
9
|
+
Git = Mono::Git
|
10
|
+
|
9
11
|
def test_version
|
10
|
-
puts
|
11
|
-
puts
|
12
|
-
puts
|
12
|
+
puts MonoCore::VERSION
|
13
|
+
puts MonoCore.banner
|
14
|
+
puts MonoCore.root
|
15
|
+
|
16
|
+
puts Mono::VERSION
|
13
17
|
end
|
14
18
|
|
15
19
|
def test_root
|
16
|
-
|
20
|
+
puts Mono.root
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_env
|
24
|
+
puts Mono.env
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
def test_git_config
|
29
|
+
puts "---"
|
30
|
+
Git.config( 'user.name' )
|
31
|
+
Git.config( 'user.name', show_origin: true )
|
32
|
+
# Git.config( 'user.name', show_scope: true )
|
33
|
+
|
34
|
+
puts "---"
|
35
|
+
Git.config( /user/ ) ## note: pass in regex for regex match/search
|
36
|
+
Git.config( /user/, show_origin: true )
|
37
|
+
# Git.config( /user/, show_scope: true )
|
38
|
+
|
39
|
+
puts "---"
|
40
|
+
Git.config( /user\./ ) ## note: pass in regex for regex match/search
|
41
|
+
|
42
|
+
puts "---"
|
43
|
+
## note: if NOT found Mono::Git.config will exit(1) !!!
|
44
|
+
## Mono::Git.config( /proxy/, show_origin: true )
|
45
|
+
## Mono::Git.config( /http/, show_origin: true )
|
46
|
+
|
47
|
+
puts "---"
|
17
48
|
end
|
18
49
|
|
19
50
|
end # class TestBase
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
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-09-
|
11
|
+
date: 2020-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: gitti
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: gitti-backup
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.3.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.3.0
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: rdoc
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,7 +70,6 @@ description: monos - monorepo / mono source tree tools and (startup) scripts
|
|
42
70
|
email: opensport@googlegroups.com
|
43
71
|
executables:
|
44
72
|
- mo
|
45
|
-
- moget
|
46
73
|
- mono
|
47
74
|
extensions: []
|
48
75
|
extra_rdoc_files:
|
@@ -55,20 +82,21 @@ files:
|
|
55
82
|
- README.md
|
56
83
|
- Rakefile
|
57
84
|
- bin/mo
|
58
|
-
- bin/moget
|
59
85
|
- bin/mono
|
60
86
|
- lib/mono.rb
|
61
87
|
- lib/mono/base.rb
|
62
|
-
- lib/mono/
|
63
|
-
- lib/mono/
|
64
|
-
- lib/mono/
|
65
|
-
- lib/mono/
|
66
|
-
- lib/mono/
|
88
|
+
- lib/mono/commands/env.rb
|
89
|
+
- lib/mono/commands/fetch.rb
|
90
|
+
- lib/mono/commands/run.rb
|
91
|
+
- lib/mono/commands/status.rb
|
92
|
+
- lib/mono/commands/sync.rb
|
93
|
+
- lib/mono/tool.rb
|
67
94
|
- lib/mono/version.rb
|
68
95
|
- lib/monos.rb
|
96
|
+
- lib/sportdb/setup.rb
|
69
97
|
- test/helper.rb
|
70
98
|
- test/test_base.rb
|
71
|
-
homepage: https://github.com/
|
99
|
+
homepage: https://github.com/rubycoco/monos
|
72
100
|
licenses:
|
73
101
|
- Public Domain
|
74
102
|
metadata: {}
|
data/bin/moget
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
###################
|
4
|
-
# DEV TIPS:
|
5
|
-
#
|
6
|
-
# For local testing run like:
|
7
|
-
#
|
8
|
-
# ruby -Ilib bin/moget
|
9
|
-
#
|
10
|
-
# Set the executable bit in Linux. Example:
|
11
|
-
#
|
12
|
-
# % chmod a+x bin/moget
|
13
|
-
#
|
14
|
-
|
15
|
-
require 'mono'
|
16
|
-
|
17
|
-
Mono::Tool.main( ['sync'] )
|
data/lib/mono/git/base.rb
DELETED
@@ -1,174 +0,0 @@
|
|
1
|
-
|
2
|
-
class GitError < StandardError
|
3
|
-
end
|
4
|
-
|
5
|
-
class Git ## make Git a module - why? why not?
|
6
|
-
|
7
|
-
###
|
8
|
-
## todo/fix: change opts=nil to *args or such - why? why not?
|
9
|
-
|
10
|
-
|
11
|
-
###############
|
12
|
-
## "setup" starter git commands
|
13
|
-
|
14
|
-
def self.clone( repo, name=nil )
|
15
|
-
cmd = "git clone #{repo}"
|
16
|
-
cmd << " #{name}" unless name.nil? || name.empty?
|
17
|
-
Shell.run( cmd )
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.mirror( repo )
|
21
|
-
cmd = "git clone --mirror #{repo}"
|
22
|
-
Shell.run( cmd )
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
#################
|
27
|
-
## standard git commands
|
28
|
-
|
29
|
-
def self.version
|
30
|
-
cmd = 'git --version'
|
31
|
-
Shell.run( cmd )
|
32
|
-
end
|
33
|
-
|
34
|
-
def self.status( short: false )
|
35
|
-
cmd = 'git status'
|
36
|
-
cmd << " --short" if short
|
37
|
-
Shell.run( cmd )
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.changes ## same as git status --short - keep shortcut / alias - why? why not?
|
41
|
-
## returns changed files - one per line or empty if no changes
|
42
|
-
cmd = 'git status --short'
|
43
|
-
Shell.run( cmd )
|
44
|
-
end
|
45
|
-
|
46
|
-
#####################
|
47
|
-
## status helpers
|
48
|
-
|
49
|
-
## git status --short returns empty stdout/list
|
50
|
-
def self.clean?() changes.empty?; end
|
51
|
-
|
52
|
-
def self.changes?() clean? == false; end ## reverse of clean?
|
53
|
-
class << self
|
54
|
-
alias_method :dirty?, :changes? ## add alias
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
#######
|
59
|
-
## more (major) git commands
|
60
|
-
|
61
|
-
def self.pull
|
62
|
-
cmd = 'git pull'
|
63
|
-
Shell.run( cmd )
|
64
|
-
end
|
65
|
-
|
66
|
-
def self.fast_forward
|
67
|
-
cmd = 'git pull --ff-only'
|
68
|
-
Shell.run( cmd )
|
69
|
-
end
|
70
|
-
class << self
|
71
|
-
alias_method :ff, :fast_forward ## add alias
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
def self.push
|
76
|
-
cmd = 'git push'
|
77
|
-
Shell.run( cmd )
|
78
|
-
end
|
79
|
-
|
80
|
-
def self.add( pathspec=nil ) ## e.g. git add . or git add *.rb or such
|
81
|
-
cmd = 'git add'
|
82
|
-
cmd << " #{pathspec}" unless pathspec.nil? || pathspec.empty?
|
83
|
-
Shell.run( cmd )
|
84
|
-
end
|
85
|
-
|
86
|
-
def self.add_all
|
87
|
-
cmd = 'git add --all'
|
88
|
-
Shell.run( cmd )
|
89
|
-
end
|
90
|
-
|
91
|
-
def self.commit( message: )
|
92
|
-
cmd = 'git commit'
|
93
|
-
cmd << %Q{ -m "#{message}"} unless message.nil? || message.empty?
|
94
|
-
Shell.run( cmd )
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
###
|
99
|
-
# use nested class for "base" for running commands - why? why not?
|
100
|
-
class Shell
|
101
|
-
def self.run( cmd )
|
102
|
-
print "cmd exec >#{cmd}<..."
|
103
|
-
stdout, stderr, status = Open3.capture3( cmd )
|
104
|
-
|
105
|
-
if status.success?
|
106
|
-
print " OK"
|
107
|
-
print "\n"
|
108
|
-
else
|
109
|
-
print " FAIL (#{status.exitstatus})"
|
110
|
-
print "\n"
|
111
|
-
end
|
112
|
-
|
113
|
-
unless stdout.empty?
|
114
|
-
puts stdout
|
115
|
-
end
|
116
|
-
|
117
|
-
unless stderr.empty?
|
118
|
-
## todo/check: or use >2: or &2: or such
|
119
|
-
## stderr output not always an error (that is, exit status might be 0)
|
120
|
-
puts "STDERR:"
|
121
|
-
puts stderr
|
122
|
-
end
|
123
|
-
|
124
|
-
if status.success?
|
125
|
-
stdout # return stdout string
|
126
|
-
else
|
127
|
-
puts "!! ERROR: cmd exec >#{cmd}< failed with exit status #{status.exitstatus}:"
|
128
|
-
puts stderr
|
129
|
-
raise GitError, "git cmd exec >#{cmd}< failed with exit status #{status.exitstatus}<: #{stderr}"
|
130
|
-
end
|
131
|
-
end
|
132
|
-
end # class Shell
|
133
|
-
|
134
|
-
end # class Git
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
class GitRepo
|
139
|
-
def self.open( path, &blk )
|
140
|
-
new( path ).open( &blk )
|
141
|
-
end
|
142
|
-
|
143
|
-
def initialize( path )
|
144
|
-
raise ArgumentError, "dir >#{path}< not found; dir MUST already exist for GitRepo class - sorry" unless Dir.exist?( path )
|
145
|
-
@path = path
|
146
|
-
end
|
147
|
-
|
148
|
-
def open( &blk )
|
149
|
-
## puts "Dir.getwd: #{Dir.getwd}"
|
150
|
-
Dir.chdir( @path ) do
|
151
|
-
blk.call( self )
|
152
|
-
end
|
153
|
-
## puts "Dir.getwd: #{Dir.getwd}"
|
154
|
-
end
|
155
|
-
|
156
|
-
|
157
|
-
def status( short: false ) Git.status( short: short ); end
|
158
|
-
def changes() Git.changes; end
|
159
|
-
def clean?() Git.clean?; end
|
160
|
-
def changes?() Git.changes?; end
|
161
|
-
alias_method :dirty?, :changes?
|
162
|
-
|
163
|
-
def pull() Git.pull; end
|
164
|
-
def fast_forward() Git.fast_forward; end
|
165
|
-
alias_method :ff, :fast_forward
|
166
|
-
|
167
|
-
def push() Git.push; end
|
168
|
-
|
169
|
-
def add( pathspec ) Git.add( pathspec ); end
|
170
|
-
def add_all() Git.add_all; end
|
171
|
-
def commit( message: ) Git.commit( message: message ); end
|
172
|
-
|
173
|
-
|
174
|
-
end # class GitRepo
|
data/lib/mono/git/sync.rb
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
class GitHubRepo ## todo: change to GitHubRepoRef or such - why? why not?
|
4
|
-
attr_reader :owner, :name
|
5
|
-
|
6
|
-
def initialize( owner, name )
|
7
|
-
@owner = owner ## use/rename to login or something - why? why not??
|
8
|
-
@name = name # e.g. "rubylibs/webservice"
|
9
|
-
end
|
10
|
-
|
11
|
-
def ssh_clone_url
|
12
|
-
## check: use https: as default? for github - http:// still supported? or redirected?
|
13
|
-
## "http://github.com/#{@owner}/#{@name}"
|
14
|
-
"git@github.com:#{@owner}/#{@name}.git"
|
15
|
-
end
|
16
|
-
end ## class GitHubRepo
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
module Mono
|
21
|
-
|
22
|
-
def self.monofile
|
23
|
-
path = if File.exist?( './monorepo.yml' )
|
24
|
-
'./monorepo.yml'
|
25
|
-
elsif File.exist?( './monotree.yml' )
|
26
|
-
'./monotree.yml'
|
27
|
-
elsif File.exist?( './repos.yml' )
|
28
|
-
'./repos.yml'
|
29
|
-
else
|
30
|
-
puts "!! WARN: no mo|moget|mono configuration file (that is, monorepo|monotree|repos.yml) found in >#{Dir.getwd}<"
|
31
|
-
nil
|
32
|
-
end
|
33
|
-
|
34
|
-
if path
|
35
|
-
YAML.load_file( path )
|
36
|
-
else
|
37
|
-
{}
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
|
42
|
-
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
43
|
-
def self.sync( h=Mono.monofile )
|
44
|
-
count_orgs = 0
|
45
|
-
count_repos = 0
|
46
|
-
|
47
|
-
## sum up total number of repos
|
48
|
-
total_repos = h.reduce(0) {|sum,(_,names)| sum+= names.size; sum }
|
49
|
-
|
50
|
-
h.each do |org_with_counter,names|
|
51
|
-
|
52
|
-
## remove optional number from key e.g.
|
53
|
-
## mrhydescripts (3) => mrhydescripts
|
54
|
-
## footballjs (4) => footballjs
|
55
|
-
## etc.
|
56
|
-
org = org_with_counter.sub( /\([0-9]+\)/, '' ).strip
|
57
|
-
|
58
|
-
org_path = "#{Mono.root}/#{org}"
|
59
|
-
FileUtils.mkdir_p( org_path ) unless Dir.exist?( org_path ) ## make sure path exists
|
60
|
-
|
61
|
-
names.each do |name|
|
62
|
-
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
63
|
-
|
64
|
-
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
65
|
-
|
66
|
-
Dir.chdir( org_path ) do
|
67
|
-
if Dir.exist?( repo.name )
|
68
|
-
GitRepo.open( repo.name ) do |git|
|
69
|
-
if git.changes?
|
70
|
-
puts "!! WARN - local changes in workdir; skipping fast forward (remote) sync / merge"
|
71
|
-
else
|
72
|
-
git.fast_forward ## note: use git pull --ff-only (fast forward only - do NOT merge)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
else
|
76
|
-
Git.clone( repo.ssh_clone_url )
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
#
|
81
|
-
# todo/fix: add (back) error log !!!!!!!!!!!!
|
82
|
-
# rescue GitError => ex
|
83
|
-
# puts "!! ERROR: #{ex.message}"
|
84
|
-
#
|
85
|
-
# File.open( './errors.log', 'a' ) do |f|
|
86
|
-
# f.write "#{Time.now} -- repo #{org}/#{name} - #{ex.message}\n"
|
87
|
-
# end
|
88
|
-
|
89
|
-
count_repos += 1
|
90
|
-
end
|
91
|
-
count_orgs += 1
|
92
|
-
end
|
93
|
-
|
94
|
-
## print stats
|
95
|
-
puts "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
96
|
-
end # method sync
|
97
|
-
|
98
|
-
end # module Mono
|
data/lib/mono/sportdb.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
##########
|
2
|
-
# setup load path
|
3
|
-
# lets you use environments
|
4
|
-
# e.g. dev/development or production
|
5
|
-
|
6
|
-
|
7
|
-
## todo/fix: move later app/gem-family/-specific configs
|
8
|
-
## to its own gem e.g. mono-sportdb or such - why? why not?
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
require_relative '../mono'
|
13
|
-
|
14
|
-
|
15
|
-
## convenience pre-configured/pre-built shortcut - lets you use
|
16
|
-
## require 'mono/sportdb'
|
17
|
-
## Mono.setup
|
18
|
-
|
19
|
-
|
20
|
-
module Mono
|
21
|
-
def self.setup ## setup load path
|
22
|
-
### note: for now always assume dev/development
|
23
|
-
### add ENV check later or pass in as args or such
|
24
|
-
|
25
|
-
puts "Mono.root: >#{root}<"
|
26
|
-
|
27
|
-
$LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-exporters/lib" )
|
28
|
-
$LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-writers/lib" )
|
29
|
-
$LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-linters/lib" )
|
30
|
-
|
31
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sports/lib" )
|
32
|
-
|
33
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-importers/lib" )
|
34
|
-
## todo - add readers, models, sync, etc.
|
35
|
-
|
36
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-catalogs/lib" )
|
37
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-formats/lib" )
|
38
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-structs/lib" )
|
39
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-langs/lib" )
|
40
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/score-formats/lib" )
|
41
|
-
$LOAD_PATH.unshift( "#{root}/sportdb/sport.db/date-formats/lib" )
|
42
|
-
|
43
|
-
|
44
|
-
pp $: # print load path
|
45
|
-
end
|
46
|
-
end # module Mono
|
47
|
-
|
48
|
-
|
49
|
-
## todo/fix:
|
50
|
-
## use
|
51
|
-
## module Starter
|
52
|
-
## module SportDb
|
53
|
-
## def setup ...
|
54
|
-
## end
|
55
|
-
## end
|
56
|
-
##
|
57
|
-
## or such? and use Mono.extend - why? why not?
|
58
|
-
## module Mono
|
59
|
-
## extend Starter::SportDb
|
60
|
-
## end
|
61
|
-
|