monos 0.1.0 → 0.3.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/Manifest.txt +7 -6
- data/README.md +141 -2
- data/Rakefile +7 -5
- data/lib/mono.rb +23 -12
- data/lib/mono/base.rb +26 -1
- 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 +25 -11
- 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: 5cafc90639b5bb02b8be04d5f993dd518a53db83
|
4
|
+
data.tar.gz: b3aba3dbae6d86e86d78eb53add58def4faa3844
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9192d91ab18d06d5b167be39171f86d71daf40629c5cf5aeeff8de9e8cb9c5b681e33de16ef08e02ee2986c97b46e9c4bc2292e364d6dab94ee6f28ce98e93e0
|
7
|
+
data.tar.gz: a48bacb9f54bf48e6264c9ece66e030cdd3c8c900373d141cc4d430b913851b802b4cb8b8c6d4d3c7b9f458584dcc372fe4e7e0ea45585d6cfcc20ca6f5a6414
|
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,4 +1,4 @@
|
|
1
|
-
# monos - tools and (startup) scripts
|
1
|
+
# monos - monorepo / mono source tree tools and (startup) scripts
|
2
2
|
|
3
3
|
|
4
4
|
* home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
|
@@ -9,9 +9,148 @@
|
|
9
9
|
|
10
10
|
|
11
11
|
|
12
|
+
|
12
13
|
## Usage
|
13
14
|
|
14
|
-
|
15
|
+
The `mono` (or short `mo`) command line tool lets you run
|
16
|
+
git commands on multiple repo(sitories) with a single command.
|
17
|
+
|
18
|
+
|
19
|
+
|
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
|
35
|
+
sportdb:
|
36
|
+
- sport.db
|
37
|
+
- sport.db.sources
|
38
|
+
- football.db
|
39
|
+
|
40
|
+
yorobot:
|
41
|
+
- cache.csv
|
42
|
+
- sport.db.more
|
43
|
+
- football.db
|
44
|
+
- football.csv
|
45
|
+
|
46
|
+
openfootball:
|
47
|
+
- leagues
|
48
|
+
- clubs
|
49
|
+
```
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
### Commands
|
54
|
+
|
55
|
+
`status` • `fetch` • `sync` • `run` •`env`
|
56
|
+
|
57
|
+
### `status` Command
|
58
|
+
|
59
|
+
Use the `status` command to check for changes (will use `git status --short`) on all repos. Example:
|
60
|
+
|
61
|
+
```
|
62
|
+
$ mono status
|
63
|
+
$ mono # status is the default command
|
64
|
+
$ mo status # mo is a "shortcut" convenience alias for mono
|
65
|
+
$ mo stat
|
66
|
+
$ mo
|
67
|
+
```
|
68
|
+
|
69
|
+
resulting in something like:
|
70
|
+
|
71
|
+
```
|
72
|
+
2 change(s) in 9 repo(s) @ 3 org(s)
|
73
|
+
|
74
|
+
-- sportdb@sport.db - CHANGES:
|
75
|
+
M monos/Manifest.txt
|
76
|
+
M monos/README.md
|
77
|
+
M monos/Rakefile
|
78
|
+
M monos/lib/mono/git/status.rb
|
79
|
+
M monos/lib/mono/git/sync.rb
|
80
|
+
M monos/lib/mono/version.rb
|
81
|
+
RM monos/lib/monoscript.rb -> monos/lib/monos.rb
|
82
|
+
M monos/test/test_base.rb
|
83
|
+
?? monos/bin/
|
84
|
+
|
85
|
+
-- yorobot@football.csv - CHANGES:
|
86
|
+
?? footballdata/
|
87
|
+
```
|
88
|
+
|
89
|
+
|
90
|
+
### `fetch` Command
|
91
|
+
|
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
|
+
|
94
|
+
```
|
95
|
+
$ mono fetch
|
96
|
+
$ mo fetch # mo is a "shortcut" convenience alias for mono
|
97
|
+
```
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
### `sync` Command
|
102
|
+
|
103
|
+
|
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:
|
105
|
+
|
106
|
+
```
|
107
|
+
$ mono sync
|
108
|
+
$ mono install # install is an alias for sync
|
109
|
+
$ mono get # get is another alias for sync
|
110
|
+
$ mo sync # mo is a "shortcut" convenience alias for mono
|
111
|
+
$ mo get
|
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
|
140
|
+
|
141
|
+
Use the `env` command to check your `mono` environment setup.
|
142
|
+
|
143
|
+
|
144
|
+
That's all for now.
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
## Installation
|
149
|
+
|
150
|
+
Use
|
151
|
+
|
152
|
+
gem install monos
|
153
|
+
|
15
154
|
|
16
155
|
## License
|
17
156
|
|
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
|
-
self.summary = "monos - tools and (startup) scripts
|
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/sportdb/sport.db' }
|
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,9 @@ 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
|
+
]
|
23
25
|
|
24
26
|
self.spec_extras = {
|
25
27
|
required_ruby_version: '>= 2.2.2'
|
data/lib/mono.rb
CHANGED
@@ -1,20 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require '
|
4
|
-
require '
|
5
|
-
|
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
|
+
|
6
|
+
module Mono
|
7
|
+
## note: make Git, GitProject, GitRepoSet, etc. available without Gitti::
|
8
|
+
include Gitti
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
## some more stdlibs
|
13
|
+
# require 'optparse'
|
14
|
+
|
8
15
|
|
9
16
|
|
10
17
|
###
|
11
18
|
# our own code
|
12
19
|
require 'mono/version' # let version always go first
|
13
20
|
require 'mono/base'
|
14
|
-
|
15
|
-
require 'mono/
|
16
|
-
require 'mono/
|
17
|
-
require 'mono/
|
21
|
+
|
22
|
+
require 'mono/commands/status'
|
23
|
+
require 'mono/commands/fetch'
|
24
|
+
require 'mono/commands/sync'
|
25
|
+
require 'mono/commands/env'
|
26
|
+
require 'mono/commands/run'
|
27
|
+
require 'mono/tool'
|
28
|
+
|
18
29
|
|
19
30
|
|
20
|
-
puts
|
31
|
+
puts MonoCore.banner # say hello
|
data/lib/mono/base.rb
CHANGED
@@ -6,7 +6,32 @@ module Mono
|
|
6
6
|
## todo/fix:
|
7
7
|
## check if windows - otherwise use /sites
|
8
8
|
## check if root directory exists?
|
9
|
-
'
|
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?
|
10
35
|
end
|
11
36
|
end
|
12
37
|
|
@@ -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 = 0
|
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,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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-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
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: rdoc
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,11 +52,10 @@ dependencies:
|
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '3.16'
|
41
|
-
description: monos - tools and (startup) scripts
|
55
|
+
description: monos - monorepo / mono source tree tools and (startup) scripts
|
42
56
|
email: opensport@googlegroups.com
|
43
57
|
executables:
|
44
58
|
- mo
|
45
|
-
- moget
|
46
59
|
- mono
|
47
60
|
extensions: []
|
48
61
|
extra_rdoc_files:
|
@@ -55,17 +68,18 @@ files:
|
|
55
68
|
- README.md
|
56
69
|
- Rakefile
|
57
70
|
- bin/mo
|
58
|
-
- bin/moget
|
59
71
|
- bin/mono
|
60
72
|
- lib/mono.rb
|
61
73
|
- lib/mono/base.rb
|
62
|
-
- lib/mono/
|
63
|
-
- lib/mono/
|
64
|
-
- lib/mono/
|
65
|
-
- lib/mono/
|
66
|
-
- lib/mono/
|
74
|
+
- lib/mono/commands/env.rb
|
75
|
+
- lib/mono/commands/fetch.rb
|
76
|
+
- lib/mono/commands/run.rb
|
77
|
+
- lib/mono/commands/status.rb
|
78
|
+
- lib/mono/commands/sync.rb
|
79
|
+
- lib/mono/tool.rb
|
67
80
|
- lib/mono/version.rb
|
68
81
|
- lib/monos.rb
|
82
|
+
- lib/sportdb/setup.rb
|
69
83
|
- test/helper.rb
|
70
84
|
- test/test_base.rb
|
71
85
|
homepage: https://github.com/sportdb/sport.db
|
@@ -93,5 +107,5 @@ rubyforge_project:
|
|
93
107
|
rubygems_version: 2.5.2
|
94
108
|
signing_key:
|
95
109
|
specification_version: 4
|
96
|
-
summary: monos - tools and (startup) scripts
|
110
|
+
summary: monos - monorepo / mono source tree tools and (startup) scripts
|
97
111
|
test_files: []
|
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
|
-
|