monos 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4962b6373c3d482ef91c0e9657e169217a96ffb7
4
- data.tar.gz: 98eb5aa97ffed451336eb0b27402a2de03b45ffb
3
+ metadata.gz: ef0e3b6e34281f0de5814be5353282f3433ff7a2
4
+ data.tar.gz: 0adb54bd17a900418ebeb7c8cb72aff6db9c95cb
5
5
  SHA512:
6
- metadata.gz: b98911c5622bc280477824a78f28fa3da0e556ac5b3284d27a8e37dcd2c00b3162be3c13c1dbdc3118d4156fc4ef9eb769e48ff21b29695906607a426845dcac
7
- data.tar.gz: 6a0cb4ef8100b218f1ef322b2fa352f4e20f3b6838249f8504ba35fd1ed106e2cc3b3a4ab1a47527301b3443aa62250624fa75e547e6990991a67ff04ba6126d
6
+ metadata.gz: 75be1cebf370650581e4600debea7b128a0f53a7661bff57fc22b6086d2b53306f09bcb4e1e481f2be003489c160440f3708fe329de4c6eede610968bf948aa0
7
+ data.tar.gz: 279c3310bb58d3272b596d5fd511fb40bc6749ea0f71087b0558f343ea46c5c4e6a7b8eca7cfe4b388cd2b8395a817432bc2fb322ac45beb48c3258ad7fa9ed8
@@ -11,6 +11,12 @@ require 'gitti/backup/base'
11
11
  module Mono
12
12
  ## note: make Git, GitProject, GitRepoSet, etc. available without Gitti::
13
13
  include Gitti
14
+
15
+ class Tool
16
+ include Gitti
17
+ end
18
+
19
+ ## add more classes e.g. MonoGitProject, etc. - why? why not?
14
20
  end
15
21
 
16
22
 
@@ -1,9 +1,6 @@
1
1
  #####################
2
2
  # add repo helper
3
3
 
4
- ##
5
- ## todo/fix: ALWAYS assert name format
6
- ## (rename to mononame and monopath) - why? why not?
7
4
 
8
5
  class MonoGitHub
9
6
  def self.clone( name, depth: nil )
@@ -11,7 +8,9 @@ class MonoGitHub
11
8
  ## @rubycoco/gitti or
12
9
  ## gitti@rubycoco
13
10
  ## => rubycoco/gitti
14
- mononame = Mononame.parse( name )
11
+
12
+ ## note: allow passing in (reusing) of mononames too
13
+ mononame = name.is_a?( Mononame ) ? name : Mononame.parse( name )
15
14
  path = mononame.real_path
16
15
 
17
16
  org_path = File.dirname( path )
@@ -32,7 +31,8 @@ MonoGithub = MonoGitHub ## add convenience (typo?) alias
32
31
 
33
32
  class MonoGitProject
34
33
  def self.open( name, &block )
35
- mononame = Mononame.parse( name )
34
+ ## note: allow passing in (reusing) of mononames too
35
+ mononame = name.is_a?( Mononame ) ? name : Mononame.parse( name )
36
36
  path = mononame.real_path
37
37
  Gitti::GitProject.open( path, &block )
38
38
  end
@@ -40,11 +40,36 @@ end
40
40
 
41
41
 
42
42
 
43
+
43
44
  module Mono
44
45
  #################
45
46
  ## add some short cuts
46
47
  def self.open( name, &block ) MonoGitProject.open( name, &block ); end
47
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
68
+ end
69
+ else
70
+ MonoGitHub.clone( mononame )
71
+ end
72
+ end # method self.sync
48
73
  end ## module Mono
49
74
 
50
75
 
@@ -1,6 +1,7 @@
1
1
  module Mono
2
2
 
3
- ## pass along hash of repos (e.g. monorepo.yml or repos.yml )
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
@@ -1,5 +1,6 @@
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
6
  puts "Mono::Module::Tool.root: >#{Mono::Module::Tool.root}<"
@@ -22,5 +23,5 @@ module Mono
22
23
  puts "monofile => (#{Monofile.find}):"
23
24
  pp Mono.monofile
24
25
  end
25
-
26
+ end # class Tool
26
27
  end # module Mono
@@ -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
 
@@ -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
@@ -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?
@@ -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
@@ -1,6 +1,7 @@
1
1
  module Mono
2
2
 
3
- ## pass along hash of repos (e.g. monorepo.yml or repos.yml )
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
 
@@ -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
@@ -1,6 +1,7 @@
1
1
  module Mono
2
2
 
3
- ## pass along hash of repos (e.g. monorepo.yml or repos.yml )
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
 
@@ -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
@@ -44,20 +44,21 @@ class Tool
44
44
  ## note: allow shortcut for commands
45
45
  case cmd.downcase
46
46
  when 'status', 'stati', 'stat', 'st', 's'
47
- Mono.status
47
+ status
48
48
  when 'sync', 'syn', 'sy', ## note: allow aliases such as install, get & up too
49
49
  'get', 'g',
50
50
  'install', 'insta', 'inst', 'ins', 'i',
51
51
  'up', 'u'
52
- Mono.sync
52
+ sync
53
53
  when 'fetch', 'f'
54
- Mono.fetch
54
+ fetch
55
55
  when 'env', 'e'
56
- Mono.env
56
+ env
57
57
  when 'backup', 'back', 'b'
58
- Mono.backup
58
+ backup
59
59
  when 'run', 'r', 'exec'
60
- Mono.run( args )
60
+ run( args )
61
+
61
62
 
62
63
  ##################
63
64
  ## for debugging / linting
@@ -7,7 +7,7 @@ module Tool ## todo/check: rename to MonoMeta, MonoModule or such - why? why
7
7
 
8
8
  MAJOR = 1 ## todo: namespace inside version or something - why? why not??
9
9
  MINOR = 1
10
- PATCH = 0
10
+ PATCH = 1
11
11
  VERSION = [MAJOR,MINOR,PATCH].join('.')
12
12
 
13
13
  def self.version
@@ -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
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
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-02 00:00:00.000000000 Z
11
+ date: 2020-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: monofile