rurema_fresh 0.0.1 → 0.1.0.beta
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/rurema_fresh.rb +50 -46
- data/lib/rurema_fresh/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f582817bfc56896416399e3440034b32140a2ea0291c338d26d77de7fb3221ce
|
4
|
+
data.tar.gz: 6de9f14e59600829771edee8409e9f97bd1850f6343ea0715e3c98fb94d1f253
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 30cfd63b0ed5a85335f9d0e0648424f9e3c01b4ce619bf83be77f3625d0984c45ae28ad1a9b3ac47dbbe80c927408af9c78d8b8ab4ca1401e704569ef60565b5
|
7
|
+
data.tar.gz: f90b1be74c71bae9f940491ac2090d6445f375f4adb6ecec6adf0e6e356984045ae9caa28e8bc8fdad6650cd0577bd6b9cb254e25e996333a33c64c7ee849920
|
data/lib/rurema_fresh.rb
CHANGED
@@ -13,7 +13,56 @@ module RuremaFresh
|
|
13
13
|
blocks = []
|
14
14
|
delete_mode = false
|
15
15
|
|
16
|
-
file_text =
|
16
|
+
file_text = self.replace_if(file_text, support_version)
|
17
|
+
|
18
|
+
texts = file_text.lines
|
19
|
+
texts.each_with_index do |text, line_no|
|
20
|
+
if text.start_with?('#@since ', '#@until ')
|
21
|
+
blocks << text.dup
|
22
|
+
version = text.split[1]
|
23
|
+
if version <= support_version
|
24
|
+
delete_mode = true if text.start_with?('#@until ')
|
25
|
+
text.clear
|
26
|
+
end
|
27
|
+
elsif text.start_with?('#@else')
|
28
|
+
next if blocks[-1].start_with?('#@if')
|
29
|
+
directive, version = blocks.pop.split
|
30
|
+
if version <= support_version
|
31
|
+
text.clear
|
32
|
+
delete_mode = (directive == '#@since')
|
33
|
+
end
|
34
|
+
directive_swap(directive)
|
35
|
+
blocks << [directive, version].join(' ')
|
36
|
+
elsif text.start_with?('#@end')
|
37
|
+
directive, version = blocks.pop.split
|
38
|
+
if (directive == '#@since' || directive == '#@until') && version <= support_version
|
39
|
+
text.clear
|
40
|
+
delete_mode = false
|
41
|
+
elsif (directive == '#@samplecode' || directive == '#@if') && delete_mode
|
42
|
+
text.clear
|
43
|
+
end
|
44
|
+
|
45
|
+
if (directive, version = blocks.last&.split)
|
46
|
+
if directive == '#@until' && version <= support_version
|
47
|
+
delete_mode = true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
elsif text.start_with?('#@samplecode', '#@if')
|
51
|
+
blocks << text.dup
|
52
|
+
text.clear if delete_mode
|
53
|
+
else
|
54
|
+
text.clear if delete_mode
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
texts.join
|
59
|
+
end
|
60
|
+
class << self
|
61
|
+
alias versions remove_old_versions
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.replace_if(text, support_version)
|
65
|
+
text.gsub(/^(\#@if\s*\(\s*version\s*([<>!=]=?)\s*["'](.+)["']\s*\))/){
|
17
66
|
zentai = $1
|
18
67
|
op = $2
|
19
68
|
version = $3
|
@@ -64,51 +113,6 @@ module RuremaFresh
|
|
64
113
|
zentai.sub('#@if(', '#@if (')
|
65
114
|
end
|
66
115
|
}
|
67
|
-
|
68
|
-
texts = file_text.lines
|
69
|
-
texts.each_with_index do |text, line_no|
|
70
|
-
if text.start_with?('#@since ', '#@until ')
|
71
|
-
blocks << text.dup
|
72
|
-
version = text.split[1]
|
73
|
-
if version <= support_version
|
74
|
-
delete_mode = true if text.start_with?('#@until ')
|
75
|
-
text.clear
|
76
|
-
end
|
77
|
-
elsif text.start_with?('#@else')
|
78
|
-
next if blocks[-1].start_with?('#@if')
|
79
|
-
directive, version = blocks.pop.split
|
80
|
-
if version <= support_version
|
81
|
-
text.clear
|
82
|
-
delete_mode = (directive == '#@since')
|
83
|
-
end
|
84
|
-
directive_swap(directive)
|
85
|
-
blocks << [directive, version].join(' ')
|
86
|
-
elsif text.start_with?('#@end')
|
87
|
-
directive, version = blocks.pop.split
|
88
|
-
if (directive == '#@since' || directive == '#@until') && version <= support_version
|
89
|
-
text.clear
|
90
|
-
delete_mode = false
|
91
|
-
elsif (directive == '#@samplecode' || directive == '#@if') && delete_mode
|
92
|
-
text.clear
|
93
|
-
end
|
94
|
-
|
95
|
-
if (directive, version = blocks.last&.split)
|
96
|
-
if directive == '#@until' && version <= support_version
|
97
|
-
delete_mode = true
|
98
|
-
end
|
99
|
-
end
|
100
|
-
elsif text.start_with?('#@samplecode', '#@if')
|
101
|
-
blocks << text.dup
|
102
|
-
text.clear if delete_mode
|
103
|
-
else
|
104
|
-
text.clear if delete_mode
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
texts.join
|
109
|
-
end
|
110
|
-
class << self
|
111
|
-
alias versions remove_old_versions
|
112
116
|
end
|
113
117
|
|
114
118
|
private
|
data/lib/rurema_fresh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rurema_fresh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.1.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- universato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -78,9 +78,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
version: 2.4.0
|
79
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - ">"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 1.3.1
|
84
84
|
requirements: []
|
85
85
|
rubygems_version: 3.2.11
|
86
86
|
signing_key:
|