mpatch 2.0.1 → 2.1.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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/lib/mpatch.rb +0 -1
- metadata +1 -2
- data/lib/mpatch/file.rb +0 -69
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 767d6387814d6df3836abbaf3e5fd32a36a78f04
|
4
|
+
data.tar.gz: c7e57a1cb878df1a9d0a06816fa266a590fe1142
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4048c0ba55f610bbfa5171274e501b8de2eb1496472432d84f5a6596b8db3941f50bb74db80bf8ceffa663111b712dd44bedca75d11e3d1939b0f71d1ea1ff17
|
7
|
+
data.tar.gz: eb44d59818a6793d89faede9988f97ee2c6e3bb09a8caa197772af85d5649552aab2b82611c179c74f14cb3c6c94ecf970970c85d7627d83bb53e6290aa2dee0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0
|
1
|
+
2.1.0
|
data/lib/mpatch.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mpatch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Luzsi
|
@@ -27,7 +27,6 @@ files:
|
|
27
27
|
- lib/mpatch.rb
|
28
28
|
- lib/mpatch/array.rb
|
29
29
|
- lib/mpatch/class.rb
|
30
|
-
- lib/mpatch/file.rb
|
31
30
|
- lib/mpatch/hash.rb
|
32
31
|
- lib/mpatch/integer.rb
|
33
32
|
- lib/mpatch/module.rb
|
data/lib/mpatch/file.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
module MPatch
|
2
|
-
module File
|
3
|
-
|
4
|
-
# create a file, if not exsist create file, and dir if needed
|
5
|
-
def self.create(route_name ,filemod="w",string_data= ::String.new )
|
6
|
-
|
7
|
-
#file_name generate
|
8
|
-
if !route_name.to_s.split(self.class::SEPARATOR).last.nil? || route_name.to_s.split(self.class::SEPARATOR).last != ''
|
9
|
-
file_name = route_name.to_s.split(self.class::SEPARATOR).last
|
10
|
-
else
|
11
|
-
file_name = nil?
|
12
|
-
end
|
13
|
-
|
14
|
-
#path_way
|
15
|
-
begin
|
16
|
-
raise ::ArgumentError, "missing route_name: #{route_name}" if route_name.nil?
|
17
|
-
path = self.class.expand_path(route_name).to_s.split(self.class::SEPARATOR)
|
18
|
-
path = path - [self.class.expand_path(route_name).to_s.split(self.class::SEPARATOR).last]
|
19
|
-
path.shift
|
20
|
-
end
|
21
|
-
|
22
|
-
#job
|
23
|
-
begin
|
24
|
-
if !::Dir.exists?(self.class::SEPARATOR+path.join(self.class::SEPARATOR))
|
25
|
-
|
26
|
-
at_now = self.class::SEPARATOR
|
27
|
-
path.each do |dir_to_be_checked|
|
28
|
-
|
29
|
-
at_now += "#{dir_to_be_checked+self.class::SEPARATOR}"
|
30
|
-
::Dir.mkdir(at_now) if !::Dir.exists?(at_now)
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
# write data
|
37
|
-
begin
|
38
|
-
full_path = "#{self.class::SEPARATOR+path.join(self.class::SEPARATOR)+self.class::SEPARATOR}#{file_name}"
|
39
|
-
if self.class.exist? full_path
|
40
|
-
self.class.open(full_path,filemod).write string_data
|
41
|
-
else
|
42
|
-
self.class.new(full_path,filemod).write string_data
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
# start read the file object on each line
|
49
|
-
# optionable an integer value to start read line at
|
50
|
-
# compatible with mac (i am linux user, so not tested)
|
51
|
-
def each_line_from(start_at=1,&block)
|
52
|
-
unless [::Integer,Fixnum,Bignum].include?(start_at.class)
|
53
|
-
raise ::ArgumentError, "invalid line index"
|
54
|
-
end
|
55
|
-
begin
|
56
|
-
line_num= 1
|
57
|
-
text= self.read
|
58
|
-
text.gsub!(/\r\n?/, "\n")
|
59
|
-
text.each_line do |*line|
|
60
|
-
if line_num >= start_at
|
61
|
-
block.call #*line
|
62
|
-
end
|
63
|
-
line_num += 1
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
end
|
69
|
-
end
|