monos 0.1.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 +7 -0
- data/CHANGELOG.md +3 -0
- data/Manifest.txt +18 -0
- data/README.md +26 -0
- data/Rakefile +27 -0
- data/bin/mo +17 -0
- data/bin/moget +17 -0
- data/bin/mono +17 -0
- data/lib/mono.rb +20 -0
- data/lib/mono/base.rb +15 -0
- data/lib/mono/git/base.rb +174 -0
- data/lib/mono/git/status.rb +73 -0
- data/lib/mono/git/sync.rb +98 -0
- data/lib/mono/git/tool.rb +33 -0
- data/lib/mono/sportdb.rb +61 -0
- data/lib/mono/version.rb +25 -0
- data/lib/monos.rb +5 -0
- data/test/helper.rb +7 -0
- data/test/test_base.rb +20 -0
- metadata +97 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 576b842ecee3e88c176654fdf0851b26c85b6e46
|
4
|
+
data.tar.gz: a6d79f70f3deb662cbb60e2d38a558a44a7e9716
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0bb43687058126a85c6fdbf3e8755c9c28f186686b2132a7a029522af5e65d3d671351cd1ea593fde3f2fe10df86f19893f01a6510d88eb5ecf2ccb531e9bf3b
|
7
|
+
data.tar.gz: 0dc9a08488c235d9df1d269b12a34243df3a7dec2ec6385b22268c692080824b03ea1c32dc9b44b0bd5caa68b63e3f07526cdbb35291127c2c9eb7ec1ee51be2
|
data/CHANGELOG.md
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
CHANGELOG.md
|
2
|
+
Manifest.txt
|
3
|
+
README.md
|
4
|
+
Rakefile
|
5
|
+
bin/mo
|
6
|
+
bin/moget
|
7
|
+
bin/mono
|
8
|
+
lib/mono.rb
|
9
|
+
lib/mono/base.rb
|
10
|
+
lib/mono/git/base.rb
|
11
|
+
lib/mono/git/status.rb
|
12
|
+
lib/mono/git/sync.rb
|
13
|
+
lib/mono/git/tool.rb
|
14
|
+
lib/mono/sportdb.rb
|
15
|
+
lib/mono/version.rb
|
16
|
+
lib/monos.rb
|
17
|
+
test/helper.rb
|
18
|
+
test/test_base.rb
|
data/README.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# monos - tools and (startup) scripts for mono source trees / monorepos
|
2
|
+
|
3
|
+
|
4
|
+
* home :: [github.com/sportdb/sport.db](https://github.com/sportdb/sport.db)
|
5
|
+
* bugs :: [github.com/sportdb/sport.db/issues](https://github.com/sportdb/sport.db/issues)
|
6
|
+
* gem :: [rubygems.org/gems/monos](https://rubygems.org/gems/monos)
|
7
|
+
* rdoc :: [rubydoc.info/gems/monos](http://rubydoc.info/gems/monos)
|
8
|
+
* forum :: [opensport](http://groups.google.com/group/opensport)
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
## Usage
|
13
|
+
|
14
|
+
To be done
|
15
|
+
|
16
|
+
## License
|
17
|
+
|
18
|
+
The `monos` scripts are dedicated to the public domain.
|
19
|
+
Use it as you please with no restrictions whatsoever.
|
20
|
+
|
21
|
+
|
22
|
+
## Questions? Comments?
|
23
|
+
|
24
|
+
Send them along to the
|
25
|
+
[Open Sports & Friends Forum/Mailing List](http://groups.google.com/group/opensport).
|
26
|
+
Thanks!
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'hoe'
|
2
|
+
require './lib/mono/version.rb'
|
3
|
+
|
4
|
+
Hoe.spec 'monos' do
|
5
|
+
|
6
|
+
self.version = Mono::Module::VERSION
|
7
|
+
|
8
|
+
self.summary = "monos - tools and (startup) scripts for mono source trees / monorepos"
|
9
|
+
self.description = summary
|
10
|
+
|
11
|
+
self.urls = ['https://github.com/sportdb/sport.db']
|
12
|
+
|
13
|
+
self.author = 'Gerald Bauer'
|
14
|
+
self.email = 'opensport@googlegroups.com'
|
15
|
+
|
16
|
+
# switch extension to .markdown for gihub formatting
|
17
|
+
self.readme_file = 'README.md'
|
18
|
+
self.history_file = 'CHANGELOG.md'
|
19
|
+
|
20
|
+
self.licenses = ['Public Domain']
|
21
|
+
|
22
|
+
self.extra_deps = []
|
23
|
+
|
24
|
+
self.spec_extras = {
|
25
|
+
required_ruby_version: '>= 2.2.2'
|
26
|
+
}
|
27
|
+
end
|
data/bin/mo
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
###################
|
4
|
+
# DEV TIPS:
|
5
|
+
#
|
6
|
+
# For local testing run like:
|
7
|
+
#
|
8
|
+
# ruby -Ilib bin/mo
|
9
|
+
#
|
10
|
+
# Set the executable bit in Linux. Example:
|
11
|
+
#
|
12
|
+
# % chmod a+x bin/mo
|
13
|
+
#
|
14
|
+
|
15
|
+
require 'mono'
|
16
|
+
|
17
|
+
Mono::Tool.main
|
data/bin/moget
ADDED
@@ -0,0 +1,17 @@
|
|
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/bin/mono
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
###################
|
4
|
+
# DEV TIPS:
|
5
|
+
#
|
6
|
+
# For local testing run like:
|
7
|
+
#
|
8
|
+
# ruby -Ilib bin/mono
|
9
|
+
#
|
10
|
+
# Set the executable bit in Linux. Example:
|
11
|
+
#
|
12
|
+
# % chmod a+x bin/mono
|
13
|
+
#
|
14
|
+
|
15
|
+
require 'mono'
|
16
|
+
|
17
|
+
Mono::Tool.main
|
data/lib/mono.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'pp'
|
2
|
+
require 'time'
|
3
|
+
require 'date'
|
4
|
+
require 'yaml'
|
5
|
+
require 'open3'
|
6
|
+
require 'fileutils'
|
7
|
+
require 'optparse'
|
8
|
+
|
9
|
+
|
10
|
+
###
|
11
|
+
# our own code
|
12
|
+
require 'mono/version' # let version always go first
|
13
|
+
require 'mono/base'
|
14
|
+
require 'mono/git/base'
|
15
|
+
require 'mono/git/sync'
|
16
|
+
require 'mono/git/status'
|
17
|
+
require 'mono/git/tool'
|
18
|
+
|
19
|
+
|
20
|
+
puts Mono::Module.banner # say hello
|
data/lib/mono/base.rb
ADDED
@@ -0,0 +1,174 @@
|
|
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
|
@@ -0,0 +1,73 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module Mono
|
4
|
+
|
5
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
6
|
+
def self.status( h=Mono.monofile )
|
7
|
+
changes = [] ## track changes
|
8
|
+
|
9
|
+
count_orgs = 0
|
10
|
+
count_repos = 0
|
11
|
+
|
12
|
+
## sum up total number of repos
|
13
|
+
total_repos = h.reduce(0) {|sum,(_,names)| sum+= names.size; sum }
|
14
|
+
|
15
|
+
|
16
|
+
h.each do |org_with_counter,names|
|
17
|
+
|
18
|
+
## remove optional number from key e.g.
|
19
|
+
## mrhydescripts (3) => mrhydescripts
|
20
|
+
## footballjs (4) => footballjs
|
21
|
+
## etc.
|
22
|
+
org = org_with_counter.sub( /\([0-9]+\)/, '' ).strip
|
23
|
+
|
24
|
+
org_path = "#{Mono.root}/#{org}"
|
25
|
+
|
26
|
+
names.each do |name|
|
27
|
+
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
28
|
+
|
29
|
+
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
30
|
+
|
31
|
+
Dir.chdir( org_path ) do
|
32
|
+
if Dir.exist?( repo.name )
|
33
|
+
GitRepo.open( repo.name ) do |git|
|
34
|
+
output = git.changes
|
35
|
+
if output.empty?
|
36
|
+
puts " - no changes -"
|
37
|
+
else
|
38
|
+
changes << ["#{org}@#{name}", :CHANGES, output]
|
39
|
+
end
|
40
|
+
end
|
41
|
+
else
|
42
|
+
puts "!! repo not found / missing"
|
43
|
+
changes << ["#{org}@#{name}", :NOT_FOUND]
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
count_repos += 1
|
48
|
+
end
|
49
|
+
count_orgs += 1
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
## print stats & changes summary
|
54
|
+
puts
|
55
|
+
print "#{changes.size} change(s) in "
|
56
|
+
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
57
|
+
print "\n"
|
58
|
+
|
59
|
+
changes.each do |item|
|
60
|
+
puts
|
61
|
+
print "== #{item[0]} - #{item[1]}"
|
62
|
+
case item[1]
|
63
|
+
when :CHANGES
|
64
|
+
print ":\n"
|
65
|
+
print item[2]
|
66
|
+
when :NOT_FOUND
|
67
|
+
print "\n"
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end # method status
|
72
|
+
|
73
|
+
end # module Mono
|
@@ -0,0 +1,98 @@
|
|
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
|
@@ -0,0 +1,33 @@
|
|
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', '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
|
+
else
|
26
|
+
puts "!! ERROR: unknown command >#{cmd}<"
|
27
|
+
exit 1
|
28
|
+
end
|
29
|
+
|
30
|
+
end # method self.main
|
31
|
+
end # class Tool
|
32
|
+
|
33
|
+
end # module Mono
|
data/lib/mono/sportdb.rb
ADDED
@@ -0,0 +1,61 @@
|
|
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
|
+
|
data/lib/mono/version.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
## note: use a different module/namespace
|
2
|
+
## for the gem version info e.g. Mono::Module vs Mono
|
3
|
+
|
4
|
+
module Mono
|
5
|
+
module Module
|
6
|
+
|
7
|
+
MAJOR = 0 ## todo: namespace inside version or something - why? why not??
|
8
|
+
MINOR = 1
|
9
|
+
PATCH = 0
|
10
|
+
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
11
|
+
|
12
|
+
def self.version
|
13
|
+
VERSION
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.banner
|
17
|
+
"monos/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.root
|
21
|
+
File.expand_path( File.dirname(File.dirname(__FILE__) ))
|
22
|
+
end
|
23
|
+
|
24
|
+
end # module Module
|
25
|
+
end # module Mono
|
data/lib/monos.rb
ADDED
data/test/helper.rb
ADDED
data/test/test_base.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
###
|
2
|
+
# to run use
|
3
|
+
# ruby -I ./lib -I ./test test/test_base.rb
|
4
|
+
|
5
|
+
require 'helper'
|
6
|
+
|
7
|
+
class TestBase < MiniTest::Test
|
8
|
+
|
9
|
+
def test_version
|
10
|
+
puts Mono::Module::VERSION
|
11
|
+
puts Mono::Module.banner
|
12
|
+
puts Mono::Module.root
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_root
|
16
|
+
puts Mono.root
|
17
|
+
end
|
18
|
+
|
19
|
+
end # class TestBase
|
20
|
+
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: monos
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Gerald Bauer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-09-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rdoc
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: hoe
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '3.16'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '3.16'
|
41
|
+
description: monos - tools and (startup) scripts for mono source trees / monorepos
|
42
|
+
email: opensport@googlegroups.com
|
43
|
+
executables:
|
44
|
+
- mo
|
45
|
+
- moget
|
46
|
+
- mono
|
47
|
+
extensions: []
|
48
|
+
extra_rdoc_files:
|
49
|
+
- CHANGELOG.md
|
50
|
+
- Manifest.txt
|
51
|
+
- README.md
|
52
|
+
files:
|
53
|
+
- CHANGELOG.md
|
54
|
+
- Manifest.txt
|
55
|
+
- README.md
|
56
|
+
- Rakefile
|
57
|
+
- bin/mo
|
58
|
+
- bin/moget
|
59
|
+
- bin/mono
|
60
|
+
- lib/mono.rb
|
61
|
+
- lib/mono/base.rb
|
62
|
+
- lib/mono/git/base.rb
|
63
|
+
- lib/mono/git/status.rb
|
64
|
+
- lib/mono/git/sync.rb
|
65
|
+
- lib/mono/git/tool.rb
|
66
|
+
- lib/mono/sportdb.rb
|
67
|
+
- lib/mono/version.rb
|
68
|
+
- lib/monos.rb
|
69
|
+
- test/helper.rb
|
70
|
+
- test/test_base.rb
|
71
|
+
homepage: https://github.com/sportdb/sport.db
|
72
|
+
licenses:
|
73
|
+
- Public Domain
|
74
|
+
metadata: {}
|
75
|
+
post_install_message:
|
76
|
+
rdoc_options:
|
77
|
+
- "--main"
|
78
|
+
- README.md
|
79
|
+
require_paths:
|
80
|
+
- lib
|
81
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.2.2
|
86
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
requirements: []
|
92
|
+
rubyforge_project:
|
93
|
+
rubygems_version: 2.5.2
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: monos - tools and (startup) scripts for mono source trees / monorepos
|
97
|
+
test_files: []
|