monofile 0.2.0 → 0.2.1
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 +1 -0
- data/README.md +124 -4
- data/Rakefile +2 -2
- data/lib/monofile.rb +3 -39
- data/lib/monofile/monofile.rb +5 -6
- data/lib/monofile/mononame.rb +12 -4
- data/lib/monofile/tool.rb +59 -0
- data/lib/monofile/version.rb +1 -1
- data/test/test_names.rb +41 -40
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 972e45a2358abae2cc65d2689004ee6caeffc06a
|
4
|
+
data.tar.gz: 793fb0d5404a10dd22a1e3478785769683b5b25f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c5e1a3399d7465f2fa94df7ec9c15cb38890928808850490edf07635a4b98b8e5b4010bf738d892cd5916b1d03a4e3c55187938cb82a32e8b3ac7a888d7db89
|
7
|
+
data.tar.gz: 95b41e6fd5b0950551b29c605524eba6ce0b59b95591ed148ae70ee205fc317739facfc89738a3dc42c2bac2fb515e9f78b2d8b313c13d63c3145b4a89a87c20
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
# monofile - read in/ parse mono
|
1
|
+
# monofile - read in / parse monorepo / mono source tree definitions - a list of git (and github) projects, and more
|
2
2
|
|
3
|
-
* home :: [github.com/rubycoco/
|
4
|
-
* bugs :: [github.com/rubycoco/
|
3
|
+
* home :: [github.com/rubycoco/monos](https://github.com/rubycoco/monos)
|
4
|
+
* bugs :: [github.com/rubycoco/monos/issues](https://github.com/rubycoco/monos/issues)
|
5
5
|
* gem :: [rubygems.org/gems/monofile](https://rubygems.org/gems/monofile)
|
6
6
|
* rdoc :: [rubydoc.info/gems/monofile](http://rubydoc.info/gems/monofile)
|
7
7
|
|
@@ -9,7 +9,127 @@
|
|
9
9
|
|
10
10
|
## Usage
|
11
11
|
|
12
|
-
|
12
|
+
|
13
|
+
Use `Monofile.read` to read in / parse monorepo / mono source tree definitions - supporting a ruby or a yaml format.
|
14
|
+
|
15
|
+
|
16
|
+
Example - `Monofile`:
|
17
|
+
``` ruby
|
18
|
+
project "@openfootball/england"
|
19
|
+
project "@openfootball/world-cup"
|
20
|
+
project "@geraldb/austria"
|
21
|
+
project "@geraldb/geraldb.github.io"
|
22
|
+
|
23
|
+
project "geraldb", "catalog"
|
24
|
+
project "openfootball", "europe"
|
25
|
+
project "openfootball", "south-america"
|
26
|
+
```
|
27
|
+
|
28
|
+
or
|
29
|
+
|
30
|
+
Example - `monofile.yml`:
|
31
|
+
|
32
|
+
``` yaml
|
33
|
+
geraldb:
|
34
|
+
- austria
|
35
|
+
- catalog
|
36
|
+
- geraldb.github.io
|
37
|
+
|
38
|
+
openfootball:
|
39
|
+
- england
|
40
|
+
- europe
|
41
|
+
- south-america
|
42
|
+
- world-cup
|
43
|
+
```
|
44
|
+
|
45
|
+
|
46
|
+
To read use.
|
47
|
+
|
48
|
+
``` ruby
|
49
|
+
monofile = Monofile.read( "./Monofile" )
|
50
|
+
# -or-
|
51
|
+
monofile = Monofile.read( "./monofile.yml" )
|
52
|
+
pp monofile.to_a
|
53
|
+
#=> ["@openfootball/england",
|
54
|
+
# "@openfootball/world-cup",
|
55
|
+
# "@geraldb/austria",
|
56
|
+
# "@geraldb/geraldb.github.io",
|
57
|
+
# "@geraldb/catalog",
|
58
|
+
# "@openfootball/europe"]
|
59
|
+
# "@openfootball/south-america"]
|
60
|
+
|
61
|
+
pp monofile.to_h
|
62
|
+
#=> {"openfootball"=>["england", "world-cup", "europe", "south-america"],
|
63
|
+
# "geraldb" =>["austria", "geraldb.github.io", "catalog"]}
|
64
|
+
|
65
|
+
monofile.each do |proj|
|
66
|
+
puts " #{proj}"
|
67
|
+
end
|
68
|
+
#=> @openfootball/england
|
69
|
+
# @openfootball/world-cup
|
70
|
+
# @geraldb/austria
|
71
|
+
# @geraldb/geraldb.github.io
|
72
|
+
# @geraldb/catalog
|
73
|
+
# @openfootball/europe
|
74
|
+
# @openfootball/south-america
|
75
|
+
|
76
|
+
monofile.size
|
77
|
+
#=> 7
|
78
|
+
```
|
79
|
+
|
80
|
+
and so on. That's it for now.
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
### Troubleshooting / Debugging
|
85
|
+
|
86
|
+
Use the `monofile` command line tool to test reading in of
|
87
|
+
monorepo / mono source tree definitions.
|
88
|
+
Example:
|
89
|
+
|
90
|
+
``` shell
|
91
|
+
# option 1) try to find default name (e.g. Monofile, Monofile.rb, etc.)
|
92
|
+
$ monofile
|
93
|
+
|
94
|
+
# option 2) pass in monofiles
|
95
|
+
$ monofile ./Monofile
|
96
|
+
$ monofile ./monfile.yml
|
97
|
+
# ...
|
98
|
+
```
|
99
|
+
|
100
|
+
Printing the normalized / canonical names of the repo sources. Example.
|
101
|
+
|
102
|
+
```
|
103
|
+
@openfootball/england
|
104
|
+
@openfootball/world-cup
|
105
|
+
@geraldb/austria
|
106
|
+
@geraldb/geraldb.github.io
|
107
|
+
@geraldb/catalog
|
108
|
+
@openfootball/europe
|
109
|
+
@openfootball/south-america
|
110
|
+
```
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
## Real-World Usage
|
116
|
+
|
117
|
+
See the [`monos`](https://github.com/rubycoco/monos/tree/master/monos) package that incl. the `mono` (or short `mo`)
|
118
|
+
command line tool lets you run
|
119
|
+
git commands on multiple repo(sitories) with a single command.
|
120
|
+
|
121
|
+
|
122
|
+
## Installation
|
123
|
+
|
124
|
+
Use
|
125
|
+
|
126
|
+
gem install monofile
|
127
|
+
|
128
|
+
or add to your Gemfile
|
129
|
+
|
130
|
+
gem 'monofile'
|
131
|
+
|
132
|
+
|
13
133
|
|
14
134
|
## License
|
15
135
|
|
data/Rakefile
CHANGED
@@ -6,10 +6,10 @@ Hoe.spec 'monofile' do
|
|
6
6
|
|
7
7
|
self.version = Mono::Module::Monofile::VERSION
|
8
8
|
|
9
|
-
self.summary = "monofile - read in/ parse mono
|
9
|
+
self.summary = "monofile - read in / parse monorepo / mono source tree definitions - a list of git (and github) projects, and more"
|
10
10
|
self.description = summary
|
11
11
|
|
12
|
-
self.urls = { home: 'https://github.com/rubycoco/
|
12
|
+
self.urls = { home: 'https://github.com/rubycoco/monos' }
|
13
13
|
|
14
14
|
self.author = 'Gerald Bauer'
|
15
15
|
self.email = 'opensport@googlegroups.com'
|
data/lib/monofile.rb
CHANGED
@@ -13,7 +13,7 @@ require 'net/http'
|
|
13
13
|
require 'net/https'
|
14
14
|
|
15
15
|
|
16
|
-
require 'optparse'
|
16
|
+
require 'optparse' ## used by monofile (built-in test/debug) command line tool
|
17
17
|
|
18
18
|
|
19
19
|
|
@@ -22,7 +22,7 @@ require 'optparse'
|
|
22
22
|
require 'monofile/version' # note: let version always go first
|
23
23
|
require 'monofile/mononame'
|
24
24
|
require 'monofile/monofile'
|
25
|
-
|
25
|
+
require 'monofile/tool'
|
26
26
|
|
27
27
|
|
28
28
|
|
@@ -73,41 +73,5 @@ MonoPath = Monopath
|
|
73
73
|
MonoFile = Monofile
|
74
74
|
|
75
75
|
|
76
|
-
|
77
|
-
class Monofile
|
78
|
-
class Tool
|
79
|
-
def self.main( args=ARGV )
|
80
|
-
|
81
|
-
## todo/fix:
|
82
|
-
## check args - if any, use/read monofiles in args!!!
|
83
|
-
|
84
|
-
path = Monofile.find
|
85
|
-
if path.nil?
|
86
|
-
puts "!! ERROR: no mono configuration file found; looking for #{Monofile::NAMES.join(', ')} in (#{Dir.getwd})"
|
87
|
-
exit 1
|
88
|
-
end
|
89
|
-
|
90
|
-
## add check for auto-require (e.g. ./config.rb)
|
91
|
-
config_path = "./config.rb"
|
92
|
-
if File.exist?( config_path )
|
93
|
-
puts "[monofile] auto-require >#{config_path}<..."
|
94
|
-
require( config_path )
|
95
|
-
end
|
96
|
-
|
97
|
-
puts "[monofile] reading >#{path}<..."
|
98
|
-
monofile=Monofile.read( path )
|
99
|
-
pp monofile
|
100
|
-
|
101
|
-
## print one project per line
|
102
|
-
puts "---"
|
103
|
-
monofile.each do |proj|
|
104
|
-
puts proj.to_s
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end # (nested) class Tool
|
108
|
-
end # class Monofile
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
Mono::Module::Monofile.banner
|
76
|
+
puts Mono::Module::Monofile.banner ## say hello
|
113
77
|
|
data/lib/monofile/monofile.rb
CHANGED
@@ -198,12 +198,11 @@ class Monofile
|
|
198
198
|
## - austria
|
199
199
|
## - catalog
|
200
200
|
## - geraldb.github.io
|
201
|
-
##
|
202
|
-
##
|
203
|
-
## -
|
204
|
-
## -
|
205
|
-
## -
|
206
|
-
## - logs
|
201
|
+
## openfootball:
|
202
|
+
## - england
|
203
|
+
## - europe
|
204
|
+
## - south-america
|
205
|
+
## - world-cup
|
207
206
|
##
|
208
207
|
def to_h
|
209
208
|
h = {}
|
data/lib/monofile/mononame.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#####
|
2
2
|
# mononame (e.g. @org/hello) machinery
|
3
3
|
# turn
|
4
|
-
# - @
|
5
|
-
# -
|
6
|
-
# -
|
4
|
+
# - @openfootball/england/2020-21
|
5
|
+
# - 2020-21@openfootball/england
|
6
|
+
# - england/2020-21@openfootball
|
7
7
|
# => into
|
8
|
-
# -
|
8
|
+
# - openfootball/england/2020-21
|
9
9
|
|
10
10
|
|
11
11
|
|
@@ -52,6 +52,14 @@ class Mononame
|
|
52
52
|
end
|
53
53
|
|
54
54
|
|
55
|
+
def self.real_path( line )
|
56
|
+
## add one-time (quick) usage convenience shortcut
|
57
|
+
name = parse( line )
|
58
|
+
name.real_path
|
59
|
+
end
|
60
|
+
|
61
|
+
## todo/fix: add real_path
|
62
|
+
|
55
63
|
|
56
64
|
## note: org and name for now required
|
57
65
|
## - make name optional too - why? why not?!!!
|
@@ -0,0 +1,59 @@
|
|
1
|
+
class Monofile
|
2
|
+
class Tool
|
3
|
+
def self.main( args=ARGV )
|
4
|
+
|
5
|
+
options = {}
|
6
|
+
OptionParser.new do |parser|
|
7
|
+
## note:
|
8
|
+
## you can add many/multiple modules
|
9
|
+
## e.g. -r gitti -r mono etc.
|
10
|
+
parser.on( '-r NAME', '--require NAME') do |name|
|
11
|
+
options[:requires] ||= []
|
12
|
+
options[:requires] << name
|
13
|
+
end
|
14
|
+
## todo/fix:
|
15
|
+
## add --verbose
|
16
|
+
## add -d/--debug
|
17
|
+
end.parse!( args )
|
18
|
+
|
19
|
+
|
20
|
+
if args.size == 0 ## auto-add default arg (monofile)
|
21
|
+
monofile_path = Monofile.find
|
22
|
+
if monofile_path.nil?
|
23
|
+
puts "!! ERROR: no mono configuration file found; looking for #{Monofile::NAMES.join(', ')} in (#{Dir.getwd})"
|
24
|
+
exit 1
|
25
|
+
end
|
26
|
+
args << monofile_path
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
## add check for auto-require (e.g. ./config.rb)
|
31
|
+
if options[:requires] ## use custom (auto-)requires
|
32
|
+
options[:requires].each do |path|
|
33
|
+
puts "[monofile] auto-require >#{path}<..."
|
34
|
+
require( path )
|
35
|
+
end
|
36
|
+
else ## use/try defaults
|
37
|
+
config_path = "./config.rb"
|
38
|
+
if File.exist?( config_path )
|
39
|
+
puts "[monofile] auto-require (default) >#{config_path}<..."
|
40
|
+
require( config_path )
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
args.each do |path|
|
46
|
+
puts "[monofile] reading >#{path}<..."
|
47
|
+
monofile=Monofile.read( path )
|
48
|
+
pp monofile
|
49
|
+
|
50
|
+
## print one project per line
|
51
|
+
puts "---"
|
52
|
+
monofile.each do |proj|
|
53
|
+
puts proj.to_s
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end # method self.main
|
57
|
+
end # (nested) class Tool
|
58
|
+
end # class Monofile
|
59
|
+
|
data/lib/monofile/version.rb
CHANGED
data/test/test_names.rb
CHANGED
@@ -10,85 +10,86 @@ class TestNames < MiniTest::Test
|
|
10
10
|
|
11
11
|
def test_parse
|
12
12
|
%w[
|
13
|
-
@
|
14
|
-
|
13
|
+
@openfootball/england
|
14
|
+
england@openfootball
|
15
15
|
].each do |line|
|
16
16
|
mono = Mononame.parse( line )
|
17
17
|
|
18
|
-
assert_equal '@
|
19
|
-
assert_equal '
|
18
|
+
assert_equal '@openfootball/england', mono.to_s
|
19
|
+
assert_equal 'openfootball/england', mono.to_path
|
20
20
|
|
21
|
-
assert_equal '
|
22
|
-
assert_equal '
|
21
|
+
assert_equal 'openfootball', mono.org
|
22
|
+
assert_equal 'england', mono.name
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
26
|
%w[
|
27
|
-
@
|
28
|
-
|
29
|
-
|
27
|
+
@openfootball/england/2020-21
|
28
|
+
2020-21@openfootball/england
|
29
|
+
england/2020-21@openfootball
|
30
30
|
].each do |line|
|
31
31
|
mono = Monopath.parse( line )
|
32
32
|
|
33
|
-
assert_equal '@
|
34
|
-
assert_equal '
|
33
|
+
assert_equal '@openfootball/england/2020-21', mono.to_s
|
34
|
+
assert_equal 'openfootball/england/2020-21', mono.to_path
|
35
35
|
|
36
|
-
assert_equal '
|
37
|
-
assert_equal '
|
38
|
-
assert_equal '
|
36
|
+
assert_equal 'openfootball', mono.org
|
37
|
+
assert_equal 'england', mono.name
|
38
|
+
assert_equal '2020-21', mono.path
|
39
39
|
end
|
40
40
|
|
41
41
|
%w[
|
42
|
-
@
|
43
|
-
|
44
|
-
|
42
|
+
@openfootball/england/2020-21/premierleague.txt
|
43
|
+
2020-21/premierleague.txt@openfootball/england
|
44
|
+
england/2020-21/premierleague.txt@openfootball
|
45
45
|
].each do |line|
|
46
46
|
mono = Monopath.parse( line )
|
47
47
|
|
48
|
-
assert_equal '@
|
49
|
-
assert_equal '
|
48
|
+
assert_equal '@openfootball/england/2020-21/premierleague.txt', mono.to_s
|
49
|
+
assert_equal 'openfootball/england/2020-21/premierleague.txt', mono.to_path
|
50
50
|
|
51
|
-
assert_equal '
|
52
|
-
assert_equal '
|
53
|
-
assert_equal '
|
51
|
+
assert_equal 'openfootball', mono.org
|
52
|
+
assert_equal 'england', mono.name
|
53
|
+
assert_equal '2020-21/premierleague.txt', mono.path
|
54
54
|
end
|
55
55
|
end # method test_parse
|
56
56
|
|
57
57
|
|
58
|
+
|
58
59
|
def test_init
|
59
|
-
mono = Mononame.new( '
|
60
|
+
mono = Mononame.new( 'openfootball','england' )
|
60
61
|
|
61
|
-
assert_equal '@
|
62
|
-
assert_equal '
|
62
|
+
assert_equal '@openfootball/england', mono.to_s
|
63
|
+
assert_equal 'openfootball/england', mono.to_path
|
63
64
|
|
64
|
-
assert_equal '
|
65
|
-
assert_equal '
|
65
|
+
assert_equal 'openfootball', mono.org
|
66
|
+
assert_equal 'england', mono.name
|
66
67
|
|
67
68
|
|
68
|
-
mono = Monopath.new( '
|
69
|
+
mono = Monopath.new( 'openfootball', 'england', '2020-21' )
|
69
70
|
|
70
|
-
assert_equal '@
|
71
|
-
assert_equal '
|
71
|
+
assert_equal '@openfootball/england/2020-21', mono.to_s
|
72
|
+
assert_equal 'openfootball/england/2020-21', mono.to_path
|
72
73
|
|
73
|
-
assert_equal '
|
74
|
-
assert_equal '
|
75
|
-
assert_equal '
|
74
|
+
assert_equal 'openfootball', mono.org
|
75
|
+
assert_equal 'england', mono.name
|
76
|
+
assert_equal '2020-21', mono.path
|
76
77
|
|
77
78
|
|
78
79
|
## !!!!todo/check/fix!!!!!:
|
79
|
-
## - support '
|
80
|
+
## - support '2020-21', 'premierleague.txt' too (or only) - why? why not?
|
80
81
|
##
|
81
82
|
## todo/check/fix:
|
82
83
|
## find a better name for path/path? component / part - why? why not?
|
83
84
|
## to_path and path/path? to confusing!!!
|
84
|
-
mono = Monopath.new( '
|
85
|
+
mono = Monopath.new( 'openfootball', 'england', '2020-21/premierleague.txt' )
|
85
86
|
|
86
|
-
assert_equal '@
|
87
|
-
assert_equal '
|
87
|
+
assert_equal '@openfootball/england/2020-21/premierleague.txt', mono.to_s
|
88
|
+
assert_equal 'openfootball/england/2020-21/premierleague.txt', mono.to_path
|
88
89
|
|
89
|
-
assert_equal '
|
90
|
-
assert_equal '
|
91
|
-
assert_equal '
|
90
|
+
assert_equal 'openfootball', mono.org
|
91
|
+
assert_equal 'england', mono.name
|
92
|
+
assert_equal '2020-21/premierleague.txt', mono.path
|
92
93
|
end # method test_init
|
93
94
|
|
94
95
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monofile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.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-10-
|
11
|
+
date: 2020-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|
@@ -44,8 +44,8 @@ dependencies:
|
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: '3.22'
|
47
|
-
description: monofile - read in/ parse mono
|
48
|
-
github) projects, and more
|
47
|
+
description: monofile - read in / parse monorepo / mono source tree definitions -
|
48
|
+
a list of git (and github) projects, and more
|
49
49
|
email: opensport@googlegroups.com
|
50
50
|
executables:
|
51
51
|
- monofile
|
@@ -63,10 +63,11 @@ files:
|
|
63
63
|
- lib/monofile.rb
|
64
64
|
- lib/monofile/monofile.rb
|
65
65
|
- lib/monofile/mononame.rb
|
66
|
+
- lib/monofile/tool.rb
|
66
67
|
- lib/monofile/version.rb
|
67
68
|
- test/helper.rb
|
68
69
|
- test/test_names.rb
|
69
|
-
homepage: https://github.com/rubycoco/
|
70
|
+
homepage: https://github.com/rubycoco/monos
|
70
71
|
licenses:
|
71
72
|
- Public Domain
|
72
73
|
metadata: {}
|
@@ -91,6 +92,6 @@ rubyforge_project:
|
|
91
92
|
rubygems_version: 2.5.2
|
92
93
|
signing_key:
|
93
94
|
specification_version: 4
|
94
|
-
summary: monofile - read in/ parse mono
|
95
|
-
projects, and more
|
95
|
+
summary: monofile - read in / parse monorepo / mono source tree definitions - a list
|
96
|
+
of git (and github) projects, and more
|
96
97
|
test_files: []
|