monos 0.6.0 → 1.1.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 +1 -0
- data/README.md +2 -2
- data/Rakefile +5 -4
- data/lib/mono.rb +26 -4
- data/lib/mono/base.rb +44 -106
- data/lib/mono/commands/backup.rb +3 -2
- data/lib/mono/commands/env.rb +4 -3
- data/lib/mono/commands/fetch.rb +4 -3
- data/lib/mono/commands/run.rb +4 -3
- data/lib/mono/commands/status.rb +5 -4
- data/lib/mono/commands/sync.rb +6 -4
- data/lib/mono/experimental.rb +11 -11
- data/lib/mono/tool.rb +42 -8
- data/lib/mono/version.rb +12 -9
- data/lib/monos.rb +1 -1
- data/test/test_base.rb +4 -4
- data/test/test_path.rb +23 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef0e3b6e34281f0de5814be5353282f3433ff7a2
|
4
|
+
data.tar.gz: 0adb54bd17a900418ebeb7c8cb72aff6db9c95cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75be1cebf370650581e4600debea7b128a0f53a7661bff57fc22b6086d2b53306f09bcb4e1e481f2be003489c160440f3708fe329de4c6eede610968bf948aa0
|
7
|
+
data.tar.gz: 279c3310bb58d3272b596d5fd511fb40bc6749ea0f71087b0558f343ea46c5c4e6a7b8eca7cfe4b388cd2b8395a817432bc2fb322ac45beb48c3258ad7fa9ed8
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# monos - monorepo / mono source tree tools and (startup) scripts
|
2
2
|
|
3
3
|
|
4
|
-
* home :: [github.com/rubycoco/
|
5
|
-
* bugs :: [github.com/rubycoco/
|
4
|
+
* home :: [github.com/rubycoco/monos](https://github.com/rubycoco/monos)
|
5
|
+
* bugs :: [github.com/rubycoco/monos/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)
|
data/Rakefile
CHANGED
@@ -3,12 +3,12 @@ require './lib/mono/version.rb'
|
|
3
3
|
|
4
4
|
Hoe.spec 'monos' do
|
5
5
|
|
6
|
-
self.version =
|
6
|
+
self.version = Mono::Module::Tool::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 = { home: 'https://github.com/rubycoco/
|
11
|
+
self.urls = { home: 'https://github.com/rubycoco/monos' }
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
14
|
self.email = 'opensport@googlegroups.com'
|
@@ -20,8 +20,9 @@ Hoe.spec 'monos' do
|
|
20
20
|
self.licenses = ['Public Domain']
|
21
21
|
|
22
22
|
self.extra_deps = [
|
23
|
-
['
|
24
|
-
['gitti
|
23
|
+
['monofile', '>= 0.2.2'],
|
24
|
+
['gitti', '>= 0.6.1'],
|
25
|
+
['gitti-backup', '>= 0.4.1'],
|
25
26
|
]
|
26
27
|
|
27
28
|
self.spec_extras = {
|
data/lib/mono.rb
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'monofile'
|
2
|
+
|
3
|
+
|
1
4
|
## first add git support
|
2
5
|
## note: use the "modular" version WITHOUT auto-include gitti,
|
3
6
|
## thus, require 'gitti/base' (and NOT 'gitti')
|
@@ -8,11 +11,14 @@ require 'gitti/backup/base'
|
|
8
11
|
module Mono
|
9
12
|
## note: make Git, GitProject, GitRepoSet, etc. available without Gitti::
|
10
13
|
include Gitti
|
11
|
-
end
|
12
14
|
|
15
|
+
class Tool
|
16
|
+
include Gitti
|
17
|
+
end
|
18
|
+
|
19
|
+
## add more classes e.g. MonoGitProject, etc. - why? why not?
|
20
|
+
end
|
13
21
|
|
14
|
-
## some more stdlibs
|
15
|
-
# require 'optparse'
|
16
22
|
|
17
23
|
|
18
24
|
|
@@ -31,4 +37,20 @@ require 'mono/commands/run'
|
|
31
37
|
require 'mono/tool'
|
32
38
|
|
33
39
|
|
34
|
-
|
40
|
+
|
41
|
+
module Mono
|
42
|
+
def self.monofile
|
43
|
+
path = Monofile.find
|
44
|
+
|
45
|
+
if path
|
46
|
+
Monofile.read( path )
|
47
|
+
else
|
48
|
+
puts "!! WARN: no mono configuration file found; looking for #{Monofile::NAMES.join(', ')} in (#{Dir.getwd})"
|
49
|
+
Monofile.new ## return empty set -todo/check: return nil - why? why not?
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end ## module Mono
|
53
|
+
|
54
|
+
|
55
|
+
|
56
|
+
puts Mono::Module::Tool.banner # say hello
|
data/lib/mono/base.rb
CHANGED
@@ -1,73 +1,27 @@
|
|
1
|
-
|
2
|
-
module Mono
|
3
|
-
|
4
|
-
def self.root ## root of single (monorepo) source tree
|
5
|
-
@@root ||= begin
|
6
|
-
## todo/fix:
|
7
|
-
## check if windows - otherwise use /sites
|
8
|
-
## check if root directory exists?
|
9
|
-
if ENV['MOPATH']
|
10
|
-
## use expand path to make (assure) absolute path - why? why not?
|
11
|
-
::File.expand_path( ENV['MOPATH'] )
|
12
|
-
elsif ::Dir.exist?( 'C:/Sites' )
|
13
|
-
'C:/Sites'
|
14
|
-
else
|
15
|
-
'/sites'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.root=( path )
|
21
|
-
## use expand path to make (assure) absolute path - why? why not?
|
22
|
-
@@root = ::File.expand_path( path )
|
23
|
-
end
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
def self.monofile
|
29
|
-
path = if ::File.exist?( './monorepo.yml' )
|
30
|
-
'./monorepo.yml'
|
31
|
-
elsif ::File.exist?( './monotree.yml' )
|
32
|
-
'./monotree.yml'
|
33
|
-
elsif ::File.exist?( './repos.yml' )
|
34
|
-
'./repos.yml'
|
35
|
-
else
|
36
|
-
puts "!! WARN: no mono configuration file (that is, {monorepo,monotree,repos}.yml) found in >#{Dir.getwd}<"
|
37
|
-
nil
|
38
|
-
end
|
39
|
-
|
40
|
-
if path
|
41
|
-
GitRepoSet.read( path )
|
42
|
-
else
|
43
|
-
GitRepoSet.new( {} ) ## return empty set -todo/check: return nil - why? why not?
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end ## module Mono
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
1
|
#####################
|
52
|
-
# add
|
2
|
+
# add repo helper
|
53
3
|
|
54
|
-
##
|
55
|
-
## todo/fix: ALWAYS assert name format
|
56
|
-
## (rename to mononame and monopath) - why? why not?
|
57
4
|
|
58
5
|
class MonoGitHub
|
59
|
-
def self.clone( name )
|
60
|
-
|
6
|
+
def self.clone( name, depth: nil )
|
7
|
+
## lets you use:
|
8
|
+
## @rubycoco/gitti or
|
9
|
+
## gitti@rubycoco
|
10
|
+
## => rubycoco/gitti
|
11
|
+
|
12
|
+
## note: allow passing in (reusing) of mononames too
|
13
|
+
mononame = name.is_a?( Mononame ) ? name : Mononame.parse( name )
|
14
|
+
path = mononame.real_path
|
61
15
|
|
62
16
|
org_path = File.dirname( path )
|
63
17
|
FileUtils.mkdir_p( org_path ) unless Dir.exist?( org_path ) ## make sure path exists
|
64
18
|
|
65
19
|
### note: use a github clone url (using ssh) like:
|
66
20
|
## git@github.com:rubycoco/gitti.git
|
67
|
-
ssh_clone_url = "git@github.com:#{
|
21
|
+
ssh_clone_url = "git@github.com:#{mononame.to_path}.git"
|
68
22
|
|
69
23
|
Dir.chdir( org_path ) do
|
70
|
-
Gitti::Git.clone( ssh_clone_url )
|
24
|
+
Gitti::Git.clone( ssh_clone_url, depth: depth )
|
71
25
|
end
|
72
26
|
end
|
73
27
|
end
|
@@ -77,61 +31,45 @@ MonoGithub = MonoGitHub ## add convenience (typo?) alias
|
|
77
31
|
|
78
32
|
class MonoGitProject
|
79
33
|
def self.open( name, &block )
|
80
|
-
|
34
|
+
## note: allow passing in (reusing) of mononames too
|
35
|
+
mononame = name.is_a?( Mononame ) ? name : Mononame.parse( name )
|
36
|
+
path = mononame.real_path
|
81
37
|
Gitti::GitProject.open( path, &block )
|
82
38
|
end
|
83
39
|
end
|
84
40
|
|
85
41
|
|
86
|
-
module Mono
|
87
|
-
## add some short cuts
|
88
|
-
def self.open( name, &block ) MonoGitProject.open( name, &block ); end
|
89
|
-
def self.clone( name ) MonoGitHub.clone( name ); end
|
90
|
-
end
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
class MonoFile
|
95
|
-
## e.g. openfootball/austria etc.
|
96
|
-
## expand to to "real" absolute path
|
97
|
-
##
|
98
|
-
## todo/check: assert name must be {orgname,username}/reponame
|
99
|
-
def self.expand_path( path )
|
100
|
-
"#{Mono.root}/#{path}"
|
101
|
-
end
|
102
|
-
def self.exist?( path )
|
103
|
-
::File.exist?( expand_path( path ))
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
|
-
## add some aliases - why? why not?
|
108
|
-
class << self
|
109
|
-
alias_method :real_path, :expand_path
|
110
|
-
alias_method :exists?, :exist? ## add deprecated exists? too - why? why not?
|
111
|
-
end
|
112
|
-
|
113
42
|
|
114
43
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
44
|
+
module Mono
|
45
|
+
#################
|
46
|
+
## add some short cuts
|
47
|
+
def self.open( name, &block ) MonoGitProject.open( name, &block ); end
|
48
|
+
def self.clone( name, depth: nil ) MonoGitHub.clone( name, depth: depth ); end
|
49
|
+
|
50
|
+
######################################
|
51
|
+
## add some more "porcelain" helpers
|
52
|
+
def self.sync( name )
|
53
|
+
## add some options - why? why not?
|
54
|
+
## - :readonly - auto-adds depth: 1 on clone or such - why? why not?
|
55
|
+
## - :clone true/false - do NOT clone only fast forward or such - why? why not?
|
56
|
+
## - :clean true/false or similar - only clone repos; no fast forward
|
57
|
+
## others - ideas -- ??
|
58
|
+
|
59
|
+
## note: allow passing in (reusing) of mononames too
|
60
|
+
mononame = name.is_a?( Mononame ) ? name : Mononame.parse( name )
|
61
|
+
if mononame.exist?
|
62
|
+
MonoGitProject.open( mononame ) do |proj|
|
63
|
+
if proj.changes?
|
64
|
+
puts "!! WARN - local changes in workdir; skipping fast forward (remote) sync / merge"
|
65
|
+
else
|
66
|
+
proj.fast_forward ## note: use git pull --ff-only (fast forward only - do NOT merge)
|
67
|
+
end
|
127
68
|
end
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
end ## class MonoFile
|
134
|
-
|
135
|
-
|
69
|
+
else
|
70
|
+
MonoGitHub.clone( mononame )
|
71
|
+
end
|
72
|
+
end # method self.sync
|
73
|
+
end ## module Mono
|
136
74
|
|
137
75
|
|
data/lib/mono/commands/backup.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Mono
|
2
2
|
|
3
|
-
|
3
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
+
class Tool
|
4
5
|
def self.backup
|
5
6
|
repos = Mono.monofile
|
6
7
|
|
@@ -11,5 +12,5 @@ module Mono
|
|
11
12
|
## 2) git remote update (if local backup already exists)
|
12
13
|
backup.backup( repos )
|
13
14
|
end # method backup
|
14
|
-
|
15
|
+
end # class Tool
|
15
16
|
end # module Mono
|
data/lib/mono/commands/env.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
module Mono
|
2
2
|
|
3
|
+
class Tool
|
3
4
|
def self.env ## check environment setup
|
4
5
|
puts "Mono.root (MOPATH): >#{Mono.root}<"
|
5
|
-
puts "
|
6
|
+
puts "Mono::Module::Tool.root: >#{Mono::Module::Tool.root}<"
|
6
7
|
puts
|
7
8
|
|
8
9
|
## add ruby version and path - why? why not? e.g.
|
@@ -19,8 +20,8 @@ module Mono
|
|
19
20
|
Git.config( /user/, show_origin: true )
|
20
21
|
|
21
22
|
puts
|
22
|
-
puts "
|
23
|
+
puts "monofile => (#{Monofile.find}):"
|
23
24
|
pp Mono.monofile
|
24
25
|
end
|
25
|
-
|
26
|
+
end # class Tool
|
26
27
|
end # module Mono
|
data/lib/mono/commands/fetch.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Mono
|
2
2
|
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
3
|
+
class Tool
|
3
4
|
def self.fetch
|
4
5
|
repos = Mono.monofile
|
5
6
|
|
@@ -18,8 +19,8 @@ module Mono
|
|
18
19
|
|
19
20
|
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
20
21
|
|
21
|
-
|
22
|
-
if
|
22
|
+
Dir.chdir( org_path ) do
|
23
|
+
if Dir.exist?( repo.name )
|
23
24
|
GitProject.open( repo.name ) do |proj|
|
24
25
|
proj.fetch
|
25
26
|
end
|
@@ -39,5 +40,5 @@ module Mono
|
|
39
40
|
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
40
41
|
print "\n"
|
41
42
|
end # method fetch
|
42
|
-
|
43
|
+
end # class Tool
|
43
44
|
end # module Mono
|
data/lib/mono/commands/run.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
module Mono
|
2
2
|
|
3
|
+
class Tool
|
3
4
|
def self.run( *args )
|
4
5
|
## todo/fix: use a "standard" argument to pass along hash of repos
|
5
6
|
## (e.g. monorepo.yml or repos.yml ) how? - why? why not?
|
@@ -22,8 +23,8 @@ module Mono
|
|
22
23
|
|
23
24
|
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
24
25
|
|
25
|
-
|
26
|
-
if
|
26
|
+
Dir.chdir( org_path ) do
|
27
|
+
if Dir.exist?( repo.name )
|
27
28
|
GitProject.open( repo.name ) do |proj|
|
28
29
|
proj.run( cmd )
|
29
30
|
end
|
@@ -43,5 +44,5 @@ module Mono
|
|
43
44
|
print "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
44
45
|
print "\n"
|
45
46
|
end # method run
|
46
|
-
|
47
|
+
end # class Tool
|
47
48
|
end # module Mono
|
data/lib/mono/commands/status.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Mono
|
2
2
|
|
3
|
-
|
3
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
+
class Tool
|
4
5
|
def self.status
|
5
6
|
repos = Mono.monofile
|
6
7
|
|
@@ -20,8 +21,8 @@ module Mono
|
|
20
21
|
|
21
22
|
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
22
23
|
|
23
|
-
|
24
|
-
if
|
24
|
+
Dir.chdir( org_path ) do
|
25
|
+
if Dir.exist?( repo.name )
|
25
26
|
GitProject.open( repo.name ) do |proj|
|
26
27
|
output = proj.changes
|
27
28
|
if output.empty?
|
@@ -61,5 +62,5 @@ module Mono
|
|
61
62
|
end
|
62
63
|
|
63
64
|
end # method status
|
64
|
-
|
65
|
+
end # class Tool
|
65
66
|
end # module Mono
|
data/lib/mono/commands/sync.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
module Mono
|
2
2
|
|
3
|
-
|
3
|
+
## pass along hash of repos (e.g. monorepo.yml or repos.yml )
|
4
|
+
class Tool
|
4
5
|
def self.sync
|
5
6
|
repos = Mono.monofile
|
6
7
|
|
@@ -11,15 +12,15 @@ module Mono
|
|
11
12
|
|
12
13
|
repos.each do |org,names|
|
13
14
|
org_path = "#{Mono.root}/#{org}"
|
14
|
-
|
15
|
+
FileUtils.mkdir_p( org_path ) unless Dir.exist?( org_path ) ## make sure path exists
|
15
16
|
|
16
17
|
names.each do |name|
|
17
18
|
puts "[#{count_repos+1}/#{total_repos}] #{org}@#{name}..."
|
18
19
|
|
19
20
|
repo = GitHubRepo.new( org, name ) ## owner, name e.g. rubylibs/webservice
|
20
21
|
|
21
|
-
|
22
|
-
if
|
22
|
+
Dir.chdir( org_path ) do
|
23
|
+
if Dir.exist?( repo.name )
|
23
24
|
GitProject.open( repo.name ) do |proj|
|
24
25
|
if proj.changes?
|
25
26
|
puts "!! WARN - local changes in workdir; skipping fast forward (remote) sync / merge"
|
@@ -50,4 +51,5 @@ module Mono
|
|
50
51
|
puts "#{count_repos} repo(s) @ #{count_orgs} org(s)"
|
51
52
|
end # method sync
|
52
53
|
|
54
|
+
end # class Tool
|
53
55
|
end # module Mono
|
data/lib/mono/experimental.rb
CHANGED
@@ -25,15 +25,15 @@ private
|
|
25
25
|
|
26
26
|
## todo/check - use max_depth or max_level or such - why? why not?
|
27
27
|
def self.walk_dir( path, repos=[], level=1, depth: nil )
|
28
|
-
entries =
|
28
|
+
entries = Dir.entries(path)
|
29
29
|
|
30
30
|
## filter dirs
|
31
31
|
dirs = entries.select do |entry|
|
32
32
|
if ['..', '.'].include?( entry ) ## first check for excludes
|
33
33
|
false
|
34
34
|
else
|
35
|
-
full_path =
|
36
|
-
|
35
|
+
full_path = File.join( path, entry )
|
36
|
+
File.directory?( full_path )
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -53,9 +53,9 @@ def self.walk_dir( path, repos=[], level=1, depth: nil )
|
|
53
53
|
buf << ">#{path}< - level #{level}:\n"
|
54
54
|
dirs.each do |entry|
|
55
55
|
next if ['..', '.', '.git'].include?( entry )
|
56
|
-
full_path =
|
56
|
+
full_path = File.join( path, entry )
|
57
57
|
|
58
|
-
if
|
58
|
+
if Dir.exist?( File.join( full_path, '.git' ))
|
59
59
|
repos_count += 1
|
60
60
|
|
61
61
|
if level == 1
|
@@ -69,15 +69,15 @@ def self.walk_dir( path, repos=[], level=1, depth: nil )
|
|
69
69
|
end
|
70
70
|
|
71
71
|
buf << " repo ##{'%-2d' % repos_count} | "
|
72
|
-
buf << "#{'%-20s' % entry} @ #{
|
72
|
+
buf << "#{'%-20s' % entry} @ #{File.basename(path)} (#{path})"
|
73
73
|
buf << "\n"
|
74
74
|
repos << full_path
|
75
75
|
|
76
76
|
## check for bare bone git repos - todo/fix: add .gitconfig or such and more - why? why not?
|
77
|
-
elsif
|
78
|
-
|
79
|
-
|
80
|
-
|
77
|
+
elsif Dir.exist?( File.join( full_path, 'hooks' )) &&
|
78
|
+
Dir.exist?( File.join( full_path, 'info' )) &&
|
79
|
+
Dir.exist?( File.join( full_path, 'objects' )) &&
|
80
|
+
Dir.exist?( File.join( full_path, 'refs' ))
|
81
81
|
warns_count += 1
|
82
82
|
buf << "!! WARN - skip bare git repo >#{entry}< @ #{path}\n"
|
83
83
|
else
|
@@ -94,7 +94,7 @@ def self.walk_dir( path, repos=[], level=1, depth: nil )
|
|
94
94
|
|
95
95
|
sub_dirs.each do |entry|
|
96
96
|
## continue walking
|
97
|
-
full_path =
|
97
|
+
full_path = File.join( path, entry )
|
98
98
|
walk_dir( full_path, repos, level+1, depth: depth )
|
99
99
|
end
|
100
100
|
|
data/lib/mono/tool.rb
CHANGED
@@ -4,9 +4,37 @@ module Mono
|
|
4
4
|
class Tool
|
5
5
|
def self.main( args=ARGV )
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
options = {}
|
8
|
+
OptionParser.new do |parser|
|
9
|
+
## note:
|
10
|
+
## you can add many/multiple modules
|
11
|
+
## e.g. -r gitti -r mono etc.
|
12
|
+
parser.on( '-r NAME', '--require NAME') do |name|
|
13
|
+
options[:requires] ||= []
|
14
|
+
options[:requires] << name
|
15
|
+
end
|
16
|
+
## todo/fix:
|
17
|
+
## add --verbose
|
18
|
+
## add -d/--debug
|
19
|
+
end.parse!( args )
|
20
|
+
|
21
|
+
|
22
|
+
## add check for auto-require (e.g. ./config.rb)
|
23
|
+
if options[:requires] ## use custom (auto-)requires
|
24
|
+
options[:requires].each do |path|
|
25
|
+
puts "[monofile] auto-require >#{path}<..."
|
26
|
+
require( path )
|
27
|
+
end
|
28
|
+
else ## use/try defaults
|
29
|
+
config_path = "./config.rb"
|
30
|
+
if File.exist?( config_path )
|
31
|
+
puts "[monofile] auto-require (default) >#{config_path}<..."
|
32
|
+
require( config_path )
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
9
36
|
|
37
|
+
## note: for now assume first argument is command
|
10
38
|
cmd = if args.size == 0
|
11
39
|
'status' ## make status "default" command
|
12
40
|
else
|
@@ -16,20 +44,26 @@ class Tool
|
|
16
44
|
## note: allow shortcut for commands
|
17
45
|
case cmd.downcase
|
18
46
|
when 'status', 'stati', 'stat', 'st', 's'
|
19
|
-
|
47
|
+
status
|
20
48
|
when 'sync', 'syn', 'sy', ## note: allow aliases such as install, get & up too
|
21
49
|
'get', 'g',
|
22
50
|
'install', 'insta', 'inst', 'ins', 'i',
|
23
51
|
'up', 'u'
|
24
|
-
|
52
|
+
sync
|
25
53
|
when 'fetch', 'f'
|
26
|
-
|
54
|
+
fetch
|
27
55
|
when 'env', 'e'
|
28
|
-
|
56
|
+
env
|
29
57
|
when 'backup', 'back', 'b'
|
30
|
-
|
58
|
+
backup
|
31
59
|
when 'run', 'r', 'exec'
|
32
|
-
|
60
|
+
run( args )
|
61
|
+
|
62
|
+
|
63
|
+
##################
|
64
|
+
## for debugging / linting
|
65
|
+
when 'walk'
|
66
|
+
Mono.walk
|
33
67
|
else
|
34
68
|
puts "!! ERROR: unknown command >#{cmd}<"
|
35
69
|
exit 1
|
data/lib/mono/version.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
## note: use a different module/namespace
|
2
2
|
## for the gem version info e.g. MonoCore vs Mono
|
3
3
|
|
4
|
-
module
|
4
|
+
module Mono
|
5
|
+
module Module
|
6
|
+
module Tool ## todo/check: rename to MonoMeta, MonoModule or such - why? why not?
|
5
7
|
|
6
|
-
##
|
7
|
-
|
8
|
-
|
9
|
-
MINOR = 6
|
10
|
-
PATCH = 0
|
8
|
+
MAJOR = 1 ## todo: namespace inside version or something - why? why not??
|
9
|
+
MINOR = 1
|
10
|
+
PATCH = 1
|
11
11
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
12
12
|
|
13
13
|
def self.version
|
@@ -18,16 +18,19 @@ module MonoCore ## todo/check: rename to MonoMeta, MonoModule or such - why? w
|
|
18
18
|
"monos/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
|
19
19
|
end
|
20
20
|
|
21
|
+
## note: move root to its own namespace to avoid
|
22
|
+
## conflict with Mono.root!!!!
|
21
23
|
def self.root
|
22
24
|
File.expand_path( File.dirname(File.dirname(__FILE__) ))
|
23
25
|
end
|
24
26
|
|
25
|
-
end # module
|
26
|
-
|
27
|
+
end # module Tool
|
28
|
+
end # module Module
|
29
|
+
end # module Mono
|
27
30
|
|
28
31
|
##################################
|
29
32
|
# add a convenience shortcut for now - why? why not?
|
30
33
|
module Mono
|
31
|
-
VERSION =
|
34
|
+
VERSION = Mono::Module::Tool::VERSION
|
32
35
|
end
|
33
36
|
|
data/lib/monos.rb
CHANGED
data/test/test_base.rb
CHANGED
@@ -9,9 +9,9 @@ class TestBase < MiniTest::Test
|
|
9
9
|
Git = Mono::Git
|
10
10
|
|
11
11
|
def test_version
|
12
|
-
puts
|
13
|
-
puts
|
14
|
-
puts
|
12
|
+
puts Mono::Module::Tool::VERSION
|
13
|
+
puts Mono::Module::Tool.banner
|
14
|
+
puts Mono::Module::Tool.root
|
15
15
|
|
16
16
|
puts Mono::VERSION
|
17
17
|
end
|
@@ -21,7 +21,7 @@ class TestBase < MiniTest::Test
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_env
|
24
|
-
puts Mono.env
|
24
|
+
puts Mono::Tool.env
|
25
25
|
end
|
26
26
|
|
27
27
|
|
data/test/test_path.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
###
|
2
|
+
# to run use
|
3
|
+
# ruby -I ./lib -I ./test test/test_path.rb
|
4
|
+
|
5
|
+
require 'helper'
|
6
|
+
|
7
|
+
class TestPath < MiniTest::Test
|
8
|
+
|
9
|
+
|
10
|
+
def test_real_path
|
11
|
+
[
|
12
|
+
'@yorobot/stage/one',
|
13
|
+
'one@yorobot/stage',
|
14
|
+
'stage/one@yorobot',
|
15
|
+
].each do |path|
|
16
|
+
puts "#{path} => >#{Monopath.parse( path )}<"
|
17
|
+
|
18
|
+
assert_equal "#{Mono.root}/yorobot/stage/one", Monopath.real_path( path )
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end # class TestPath
|
23
|
+
|
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:
|
4
|
+
version: 1.1.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-
|
11
|
+
date: 2020-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: monofile
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.2
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: gitti
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,7 +117,8 @@ files:
|
|
103
117
|
- lib/monos.rb
|
104
118
|
- test/helper.rb
|
105
119
|
- test/test_base.rb
|
106
|
-
|
120
|
+
- test/test_path.rb
|
121
|
+
homepage: https://github.com/rubycoco/monos
|
107
122
|
licenses:
|
108
123
|
- Public Domain
|
109
124
|
metadata: {}
|