Skip to content

Commit 544283b

Browse files
committed
up
1 parent 7c05d4f commit 544283b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2166
-1
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
# git (and github) command line tools, libraries & scripts
1+
# git (and github) & monorepo / mono source tree tools command line tools, libraries & scripts
22

33
Git Gems:
44

55
- [**gitti**](gitti) - (lite) git command line helper / wrapper
66
- [gitti-backup](gitti-backup) - (lite) multi repo git backup command line script
77

8+
_GitHub_
9+
810
<!-- break -->
911
- [hubba](hubba) - (yet) another (lite) GitHub HTTP API client / library
1012
- [hubba-reports](hubba-reports)- auto-generate github statistics / analytics reports from github api data (stars, timeline, traffic, top pages, top referrers, etc.)
1113

14+
_Monorepos_
15+
16+
<!-- break -->
17+
- [**monos**](monos) - monorepo / mono source tree tools and scripts
18+
- [monofile](monofile) - read in / parse monorepo / mono source tree definitions - a list of git (and github) projects, and more
19+
1220

1321

1422
## License

monofile/.gitignore

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
*.gem
2+
*.rbc
3+
/.config
4+
/coverage/
5+
/InstalledFiles
6+
/pkg/
7+
/spec/reports/
8+
/test/tmp/
9+
/test/version_tmp/
10+
/tmp/
11+
12+
## Specific to RubyMotion:
13+
.dat*
14+
.repl_history
15+
build/
16+
17+
## Documentation cache and generated files:
18+
/.yardoc/
19+
/_yardoc/
20+
/doc/
21+
/rdoc/
22+
23+
## Environment normalisation:
24+
/.bundle/
25+
/lib/bundler/man/
26+
27+
# for a library or gem, you might want to ignore these files since the code is
28+
# intended to run in multiple environments; otherwise, check them in:
29+
# Gemfile.lock
30+
# .ruby-version
31+
# .ruby-gemset
32+
33+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34+
.rvmrc
35+
36+
37+
# more debugging support
38+
errors.log

monofile/CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### 0.0.1 / 2020-10-29
2+
3+
* Everything is new. First release.

monofile/Manifest.txt

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CHANGELOG.md
2+
Manifest.txt
3+
README.md
4+
Rakefile
5+
bin/monofile
6+
lib/monofile.rb
7+
lib/monofile/monofile.rb
8+
lib/monofile/mononame.rb
9+
lib/monofile/tool.rb
10+
lib/monofile/version.rb
11+
test/helper.rb
12+
test/test_names.rb

monofile/README.md

+138
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# monofile - read in / parse monorepo / mono source tree definitions - a list of git (and github) projects, and more
2+
3+
* home :: [github.com/rubycocos/git](https://github.com/rubycocos/git)
4+
* bugs :: [github.com/rubycocos/git/issues](https://github.com/rubycocos/git/issues)
5+
* gem :: [rubygems.org/gems/monofile](https://rubygems.org/gems/monofile)
6+
* rdoc :: [rubydoc.info/gems/monofile](http://rubydoc.info/gems/monofile)
7+
8+
9+
10+
## Usage
11+
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/rubycocos/git/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+
133+
134+
## License
135+
136+
The `monofile` scripts are dedicated to the public domain.
137+
Use it as you please with no restrictions whatsoever.
138+

monofile/Rakefile

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require 'hoe'
2+
require './lib/monofile/version.rb'
3+
4+
5+
Hoe.spec 'monofile' do
6+
7+
self.version = Mono::Module::Monofile::VERSION
8+
9+
self.summary = "monofile - read in / parse monorepo / mono source tree definitions - a list of git (and github) projects, and more"
10+
self.description = summary
11+
12+
self.urls = { home: 'https://github.com/rubycocos/git' }
13+
14+
self.author = 'Gerald Bauer'
15+
self.email = '[email protected]'
16+
17+
# switch extension to .markdown for gihub formatting
18+
self.readme_file = 'README.md'
19+
self.history_file = 'CHANGELOG.md'
20+
21+
self.licenses = ['Public Domain']
22+
23+
self.extra_deps = []
24+
25+
self.spec_extras = {
26+
required_ruby_version: '>= 2.2.2'
27+
}
28+
end

monofile/bin/monofile

+17
Original file line numberDiff line numberDiff line change
@@ -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/monofile
9+
#
10+
# Set the executable bit in Linux. Example:
11+
#
12+
# % chmod a+x bin/monofile
13+
#
14+
15+
require 'monofile'
16+
17+
Monofile::Tool.main

monofile/lib/monofile.rb

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
##
2+
## "prelude / prolog " add some common used stdlibs
3+
## add more - why? why not?
4+
require 'pp'
5+
require 'time'
6+
require 'date'
7+
require 'json'
8+
require 'yaml'
9+
require 'fileutils'
10+
11+
require 'uri'
12+
require 'net/http'
13+
require 'net/https'
14+
15+
16+
require 'optparse' ## used by monofile (built-in test/debug) command line tool
17+
18+
19+
20+
#####################
21+
# our own code
22+
require 'monofile/version' # note: let version always go first
23+
require 'monofile/mononame'
24+
require 'monofile/monofile'
25+
require 'monofile/tool'
26+
27+
28+
29+
module Mono
30+
31+
def self.root ## root of single (monorepo) source tree
32+
@@root ||= begin
33+
## todo/fix:
34+
## check if windows - otherwise use /sites
35+
## check if root directory exists?
36+
if ENV['MOPATH']
37+
## use expand path to make (assure) absolute path - why? why not?
38+
File.expand_path( ENV['MOPATH'] )
39+
elsif Dir.exist?( 'C:/Sites' )
40+
'C:/Sites'
41+
else
42+
'/sites'
43+
end
44+
end
45+
end
46+
47+
def self.root=( path )
48+
## use expand path to make (assure) absolute path - why? why not?
49+
@@root = File.expand_path( path )
50+
end
51+
end ## module Mono
52+
53+
54+
55+
56+
###
57+
## add some convenience alias for alternate spelling (CamelCase)
58+
MonoName = Mononame
59+
MonoPath = Monopath
60+
MonoFile = Monofile
61+
62+
63+
puts Mono::Module::Monofile.banner ## say hello
64+

0 commit comments

Comments
 (0)