monofile 0.2.1 → 0.2.2
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/lib/monofile.rb +1 -14
- data/lib/monofile/mononame.rb +45 -9
- data/lib/monofile/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 547a6deaf1db0ea792b640dcf686fa5788d0de30
|
4
|
+
data.tar.gz: 01fdcf2b3cfc5ddb70eb68dec8a808f0a1edd2e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3358beae7a3a96107e13e4b01d0fa065acb629b131acca5031168b85331ff88463a8f9e5f7fac09de0e28eb18f2380322e6e481857a8ec077cb4e4355240298
|
7
|
+
data.tar.gz: 7c100f51fb8cb143202016b7d129b80fcf20acea7301c117263b09efec99fdf9ffede2ecb0d47cef266d86489e07de0053b6c586c8d572a0d720fb815d395534
|
data/lib/monofile.rb
CHANGED
@@ -48,24 +48,11 @@ module Mono
|
|
48
48
|
## use expand path to make (assure) absolute path - why? why not?
|
49
49
|
@@root = File.expand_path( path )
|
50
50
|
end
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
def self.monofile
|
55
|
-
path = Monofile.find
|
56
|
-
Monofile.read( path )
|
57
|
-
|
58
|
-
# if path
|
59
|
-
# GitRepoSet.read( path )
|
60
|
-
# else
|
61
|
-
# puts "!! WARN: no mono configuration file found; looking for #{MONOFILES.join(', ')} in (#{Dir.getwd})"
|
62
|
-
# GitRepoSet.new( {} ) ## return empty set -todo/check: return nil - why? why not?
|
63
|
-
# end
|
64
|
-
end
|
65
51
|
end ## module Mono
|
66
52
|
|
67
53
|
|
68
54
|
|
55
|
+
|
69
56
|
###
|
70
57
|
## add some convenience alias for alternate spelling (CamelCase)
|
71
58
|
MonoName = Mononame
|
data/lib/monofile/mononame.rb
CHANGED
@@ -51,15 +51,12 @@ class Mononame
|
|
51
51
|
new( *values )
|
52
52
|
end
|
53
53
|
|
54
|
-
|
55
54
|
def self.real_path( line )
|
56
55
|
## add one-time (quick) usage convenience shortcut
|
57
|
-
|
58
|
-
|
56
|
+
mononame = parse( line )
|
57
|
+
mononame.real_path
|
59
58
|
end
|
60
59
|
|
61
|
-
## todo/fix: add real_path
|
62
|
-
|
63
60
|
|
64
61
|
## note: org and name for now required
|
65
62
|
## - make name optional too - why? why not?!!!
|
@@ -76,8 +73,10 @@ class Mononame
|
|
76
73
|
end
|
77
74
|
end
|
78
75
|
|
79
|
-
def to_path()
|
80
|
-
def to_s()
|
76
|
+
def to_path() "#{@org}/#{@name}"; end
|
77
|
+
def to_s() "@#{to_path}"; end
|
78
|
+
|
79
|
+
def real_path() "#{Mono.root}/#{to_path}"; end
|
81
80
|
end # class Mononame
|
82
81
|
|
83
82
|
|
@@ -103,6 +102,12 @@ class Monopath
|
|
103
102
|
new( *values )
|
104
103
|
end
|
105
104
|
|
105
|
+
def self.real_path( line )
|
106
|
+
monopath = parse( line )
|
107
|
+
monopath.real_path
|
108
|
+
end
|
109
|
+
|
110
|
+
|
106
111
|
## note: org and name AND path for now required
|
107
112
|
## - make name path optional too - why? why not?!!!
|
108
113
|
attr_reader :org, :name, :path
|
@@ -124,8 +129,39 @@ class Monopath
|
|
124
129
|
end
|
125
130
|
end
|
126
131
|
|
127
|
-
def to_path()
|
128
|
-
def to_s()
|
132
|
+
def to_path() "#{@org}/#{@name}/#{@path}"; end
|
133
|
+
def to_s() "@#{to_path}"; end
|
134
|
+
|
135
|
+
def real_path() "#{Mono.root}/#{to_path}"; end
|
136
|
+
|
137
|
+
|
138
|
+
## some File-like convenience helpers
|
139
|
+
## e.g. File.exist? => Monopath.exist?
|
140
|
+
## File.open => Monopath.open( ... ) { block }
|
141
|
+
## etc.
|
142
|
+
def self.exist?( line )
|
143
|
+
File.exist?( real_path( line ) )
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
## path always relative to Mono.root
|
148
|
+
## todo/fix: use File.expand_path( path, Mono.root ) - why? why not?
|
149
|
+
## or always enfore "absolut" path e.g. do NOT allow ../ or ./ or such
|
150
|
+
def self.open( line, mode='r:utf-8', &block )
|
151
|
+
path = real_path( line )
|
152
|
+
## make sure path exists if we open for writing/appending - why? why not?
|
153
|
+
if mode[0] == 'w' || mode[0] == 'a'
|
154
|
+
FileUtils.mkdir_p( File.dirname( path ) ) ## make sure path exists
|
155
|
+
end
|
156
|
+
|
157
|
+
File.open( path, mode ) do |file|
|
158
|
+
block.call( file )
|
159
|
+
end
|
160
|
+
end
|
161
|
+
|
162
|
+
def self.read_utf8( line )
|
163
|
+
open( line, 'r:utf-8') { |file| file.read }
|
164
|
+
end
|
129
165
|
end # class Monopath
|
130
166
|
## note: use Monopath - avoid confusion with Monofile (a special file with a list of mono projects)!!!!
|
131
167
|
|
data/lib/monofile/version.rb
CHANGED
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.2
|
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-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|