monos 0.2.1 → 0.6.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.
@@ -1,28 +1,33 @@
1
1
  ## note: use a different module/namespace
2
- ## for the gem version info e.g. Mono::Module vs Mono
2
+ ## for the gem version info e.g. MonoCore vs Mono
3
3
 
4
- module Mono
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!!!!
5
8
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 2
7
- PATCH = 1
9
+ MINOR = 6
10
+ PATCH = 0
8
11
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
12
 
10
13
  def self.version
11
14
  VERSION
12
15
  end
13
16
 
17
+ def self.banner
18
+ "monos/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
19
+ end
20
+
21
+ def self.root
22
+ File.expand_path( File.dirname(File.dirname(__FILE__) ))
23
+ end
14
24
 
15
- module Module
16
- ## note: move root to its own namespace to avoid
17
- ## conflict with Mono.root!!!!
25
+ end # module MonoCore
18
26
 
19
- def self.banner
20
- "monos/#{VERSION} on Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) [#{RUBY_PLATFORM}]"
21
- end
22
27
 
23
- def self.root
24
- File.expand_path( File.dirname(File.dirname(__FILE__) ))
25
- end
28
+ ##################################
29
+ # add a convenience shortcut for now - why? why not?
30
+ module Mono
31
+ VERSION = MonoCore::VERSION
32
+ end
26
33
 
27
- end # module Module
28
- end # module Mono
@@ -6,10 +6,14 @@ require 'helper'
6
6
 
7
7
  class TestBase < MiniTest::Test
8
8
 
9
+ Git = Mono::Git
10
+
9
11
  def test_version
12
+ puts MonoCore::VERSION
13
+ puts MonoCore.banner
14
+ puts MonoCore.root
15
+
10
16
  puts Mono::VERSION
11
- puts Mono::Module.banner
12
- puts Mono::Module.root
13
17
  end
14
18
 
15
19
  def test_root
@@ -20,5 +24,28 @@ class TestBase < MiniTest::Test
20
24
  puts Mono.env
21
25
  end
22
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 "---"
48
+ end
49
+
23
50
  end # class TestBase
24
51
 
metadata CHANGED
@@ -1,43 +1,77 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.6.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-04 00:00:00.000000000 Z
11
+ date: 2020-10-24 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.6.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.6.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: gitti-backup
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.4.1
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: rdoc
15
43
  requirement: !ruby/object:Gem::Requirement
16
44
  requirements:
17
- - - "~>"
45
+ - - ">="
18
46
  - !ruby/object:Gem::Version
19
47
  version: '4.0'
48
+ - - "<"
49
+ - !ruby/object:Gem::Version
50
+ version: '7'
20
51
  type: :development
21
52
  prerelease: false
22
53
  version_requirements: !ruby/object:Gem::Requirement
23
54
  requirements:
24
- - - "~>"
55
+ - - ">="
25
56
  - !ruby/object:Gem::Version
26
57
  version: '4.0'
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '7'
27
61
  - !ruby/object:Gem::Dependency
28
62
  name: hoe
29
63
  requirement: !ruby/object:Gem::Requirement
30
64
  requirements:
31
65
  - - "~>"
32
66
  - !ruby/object:Gem::Version
33
- version: '3.16'
67
+ version: '3.22'
34
68
  type: :development
35
69
  prerelease: false
36
70
  version_requirements: !ruby/object:Gem::Requirement
37
71
  requirements:
38
72
  - - "~>"
39
73
  - !ruby/object:Gem::Version
40
- version: '3.16'
74
+ version: '3.22'
41
75
  description: monos - monorepo / mono source tree tools and (startup) scripts
42
76
  email: opensport@googlegroups.com
43
77
  executables:
@@ -57,18 +91,19 @@ files:
57
91
  - bin/mono
58
92
  - lib/mono.rb
59
93
  - lib/mono/base.rb
94
+ - lib/mono/commands/backup.rb
60
95
  - lib/mono/commands/env.rb
61
96
  - lib/mono/commands/fetch.rb
97
+ - lib/mono/commands/run.rb
62
98
  - lib/mono/commands/status.rb
63
99
  - lib/mono/commands/sync.rb
64
- - lib/mono/git/base.rb
65
- - lib/mono/sportdb.rb
100
+ - lib/mono/experimental.rb
66
101
  - lib/mono/tool.rb
67
102
  - lib/mono/version.rb
68
103
  - lib/monos.rb
69
104
  - test/helper.rb
70
105
  - test/test_base.rb
71
- homepage: https://github.com/sportdb/sport.db
106
+ homepage: https://github.com/rubycoco/git
72
107
  licenses:
73
108
  - Public Domain
74
109
  metadata: {}
@@ -1,226 +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.fetch
62
- cmd = 'git fetch'
63
- Shell.run( cmd )
64
- end
65
-
66
- def self.pull
67
- cmd = 'git pull'
68
- Shell.run( cmd )
69
- end
70
-
71
- def self.fast_forward
72
- cmd = 'git pull --ff-only'
73
- Shell.run( cmd )
74
- end
75
- class << self
76
- alias_method :ff, :fast_forward ## add alias
77
- end
78
-
79
-
80
- def self.push
81
- cmd = 'git push'
82
- Shell.run( cmd )
83
- end
84
-
85
- def self.add( pathspec=nil ) ## e.g. git add . or git add *.rb or such
86
- cmd = 'git add'
87
- cmd << " #{pathspec}" unless pathspec.nil? || pathspec.empty?
88
- Shell.run( cmd )
89
- end
90
-
91
- def self.add_all
92
- cmd = 'git add --all'
93
- Shell.run( cmd )
94
- end
95
-
96
- def self.commit( message: )
97
- cmd = 'git commit'
98
- cmd << %Q{ -m "#{message}"} unless message.nil? || message.empty?
99
- Shell.run( cmd )
100
- end
101
-
102
-
103
- #############
104
- # change git ls-files to git ls-tree ... - why? why not?
105
- #
106
- # git ls-tree --full-tree --name-only -r HEAD
107
- # --full-tree makes the command run as if you were in the repo's root directory.
108
- # -r recurses into subdirectories. Combined with --full-tree, this gives you all committed, tracked files.
109
- # --name-only removes SHA / permission info for when you just want the file paths.
110
- # HEAD specifies which branch you want the list of tracked, committed files for.
111
- # You could change this to master or any other branch name, but HEAD is the commit you have checked out right now.
112
- #
113
- # see https://stackoverflow.com/questions/15606955/how-can-i-make-git-show-a-list-of-the-files-that-are-being-tracked
114
- #
115
- # was:
116
-
117
- def self.files ## was: e.g. git ls-files . or git ls-files *.rb or such
118
- cmd = 'git ls-tree --full-tree --name-only -r HEAD' # was: 'git ls-files'
119
- Shell.run( cmd )
120
- end
121
- ## add list_files or ls_files alias - why? why not?
122
-
123
-
124
- ###
125
- # use nested class for "base" for running commands - why? why not?
126
- class Shell
127
- def self.run( cmd )
128
- print "cmd exec >#{cmd}<..."
129
- stdout, stderr, status = Open3.capture3( cmd )
130
-
131
- if status.success?
132
- print " OK"
133
- print "\n"
134
- else
135
- print " FAIL (#{status.exitstatus})"
136
- print "\n"
137
- end
138
-
139
- unless stdout.empty?
140
- puts stdout
141
- end
142
-
143
- unless stderr.empty?
144
- ## todo/check: or use >2: or &2: or such
145
- ## stderr output not always an error (that is, exit status might be 0)
146
- puts "STDERR:"
147
- puts stderr
148
- end
149
-
150
- if status.success?
151
- stdout # return stdout string
152
- else
153
- puts "!! ERROR: cmd exec >#{cmd}< failed with exit status #{status.exitstatus}:"
154
- puts stderr
155
- raise GitError, "git cmd exec >#{cmd}< failed with exit status #{status.exitstatus}<: #{stderr}"
156
- end
157
- end
158
- end # class Shell
159
-
160
- end # class Git
161
-
162
-
163
-
164
- class GitProject
165
- def self.open( path, &blk )
166
- new( path ).open( &blk )
167
- end
168
-
169
- def initialize( path )
170
- raise ArgumentError, "dir >#{path}< not found; dir MUST already exist for GitProject class - sorry" unless Dir.exist?( path )
171
- raise ArgumentError, "dir >#{path}/.git< not found; dir MUST already be initialized with git for GitProject class - sorry" unless Dir.exist?( "#{path}/.git" )
172
- @path = path
173
- end
174
-
175
-
176
- def open( &blk )
177
- ## puts "Dir.getwd: #{Dir.getwd}"
178
- Dir.chdir( @path ) do
179
- blk.call( self )
180
- end
181
- ## puts "Dir.getwd: #{Dir.getwd}"
182
- end
183
-
184
-
185
- def status( short: false ) Git.status( short: short ); end
186
- def changes() Git.changes; end
187
- def clean?() Git.clean?; end
188
- def changes?() Git.changes?; end
189
- alias_method :dirty?, :changes?
190
-
191
-
192
- def fetch() Git.fetch; end
193
- def pull() Git.pull; end
194
- def fast_forward() Git.fast_forward; end
195
- alias_method :ff, :fast_forward
196
-
197
- def push() Git.push; end
198
-
199
- def add( pathspec ) Git.add( pathspec ); end
200
- def add_all() Git.add_all; end
201
- def commit( message: ) Git.commit( message: message ); end
202
-
203
- def files() Git.files; end
204
-
205
- end # class GitProject
206
-
207
-
208
-
209
-
210
- ## todo: change to GitHubRepoRef or GitHubProject
211
- ## or Git::GitHub or Git::Source::GitHub or such - why? why not?
212
- class GitHubRepo
213
- attr_reader :owner, :name
214
-
215
- def initialize( owner, name )
216
- @owner = owner ## use/rename to login or something - why? why not??
217
- @name = name # e.g. "rubylibs/webservice"
218
- end
219
-
220
- def ssh_clone_url
221
- ## check: use https: as default? for github - http:// still supported? or redirected?
222
- ## "http://github.com/#{@owner}/#{@name}"
223
- "git@github.com:#{@owner}/#{@name}.git"
224
- end
225
- end ## class GitHubRepo
226
-
@@ -1,109 +0,0 @@
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 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
-
44
- SPORTDB_DIR = "#{Mono.root}/sportdb" # path to libs
45
- OPENFOOTBALL_DIR = "#{Mono.root}/openfootball"
46
- ## add more "standard" dirs - why? why not? - why? why not?
47
- ## use
48
- ## module SportDb::Source / Code / Boot or such????
49
- ##
50
- ## use module SportDb::Boot - yes, yes, yes - why? why not?
51
-
52
-
53
-
54
- ## convenience pre-configured/pre-built shortcut - lets you use
55
- ## require 'mono/sportdb'
56
- ## Mono.setup
57
-
58
- ## use SportDb::Boot.setup (setup_load_path) or such??? - why? why not?
59
-
60
- module Mono
61
- def self.setup ## setup load path
62
- ### note: for now always assume dev/development
63
- ### add ENV check later or pass in as args or such
64
-
65
- puts "Mono.root: >#{root}<"
66
-
67
- $LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-exporters/lib" )
68
- $LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-writers/lib" )
69
- $LOAD_PATH.unshift( "#{root}/yorobot/sport.db.more/sportdb-linters/lib" )
70
-
71
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sports/lib" )
72
-
73
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-importers/lib" )
74
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-readers/lib" )
75
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-sync/lib" )
76
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-models/lib" )
77
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-catalogs/lib" )
78
-
79
- ## todo/check:
80
- ## add fifa, footballdb-leagues, footballdb-clubs too ???
81
- $LOAD_PATH.unshift( "#{root}/sportdb/football.db/footballdb-clubs/lib" ))
82
- $LOAD_PATH.unshift( "#{root}/sportdb/football.db/footballdb-leagues/lib" ))
83
- $LOAD_PATH.unshift( "#{root}/sportdb/football.db/fifa/lib" ))
84
-
85
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-formats/lib" )
86
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-structs/lib" )
87
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/sportdb-langs/lib" )
88
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/score-formats/lib" )
89
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/date-formats/lib" )
90
- $LOAD_PATH.unshift( "#{root}/sportdb/sport.db/alphabets/lib" )
91
-
92
- pp $: # print load path
93
- end
94
- end # module Mono
95
-
96
-
97
- ## todo/fix:
98
- ## use
99
- ## module Starter
100
- ## module SportDb
101
- ## def setup ...
102
- ## end
103
- ## end
104
- ##
105
- ## or such? and use Mono.extend - why? why not?
106
- ## module Mono
107
- ## extend Starter::SportDb
108
- ## end
109
-