miko 0.0.2 → 0.0.3
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/README.md +5 -0
- data/lib/miko/version.rb +1 -1
- data/lib/miko.rb +101 -48
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 172f3d99658f1ade75394e945cf6f1e5e99dbaa3
|
4
|
+
data.tar.gz: 0f8cc88dec1daf571a09d9ea56c43dd3a3b4285a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75c8055fcefa751250f4be7f5d1b956584118d93a8c3ca924005b84fec3523f75f9d9d7efda85418d42208b9c267eeae9c6d188d9916e7e8297de0e950501b86
|
7
|
+
data.tar.gz: 3c93ff7eaa451a2649666b2690ef492edd707c959a686c71e1facbbeb90e4a84c8666d7c60dc0f6e3b34c466e8400467aed40985b42a80be31864d17e4dc7432
|
data/README.md
CHANGED
data/lib/miko/version.rb
CHANGED
data/lib/miko.rb
CHANGED
@@ -7,7 +7,7 @@ class Miko
|
|
7
7
|
#
|
8
8
|
# Start the class
|
9
9
|
def initialize( user )
|
10
|
-
@user
|
10
|
+
@user = user
|
11
11
|
@directory = "/home/#{@user}/public_html"
|
12
12
|
@found = []
|
13
13
|
end
|
@@ -23,37 +23,44 @@ class Miko
|
|
23
23
|
private
|
24
24
|
def find_installs
|
25
25
|
Find.find( @directory ) do |path|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
26
|
+
@path = path
|
27
|
+
if File.readable?(path)
|
28
|
+
if path =~ /.*\/version\.php$/
|
29
|
+
find_wordpress_joomla
|
30
|
+
find_moodle
|
31
|
+
elsif path =~ /.*\/bootstrap.inc$/
|
32
|
+
find_drupal
|
33
|
+
elsif path =~ /.*\/modules\/system\/system.module$/
|
34
|
+
find_drupal
|
35
|
+
elsif path =~ /.*\/index.php$/
|
36
|
+
find_smf_version
|
37
|
+
elsif path =~ /.*\/app\/Mage.php$/
|
38
|
+
find_magento_version
|
39
|
+
elsif path =~ /.*\/styles\/prosilver\/template\/template.cfg$/
|
40
|
+
find_phpbb_version
|
41
|
+
elsif path =~/.*\/inc\/class_core.php$/
|
42
|
+
find_mybb_version
|
42
43
|
end
|
44
|
+
else
|
45
|
+
raise "Problem accessing #{path}"
|
46
|
+
end
|
43
47
|
end
|
44
48
|
end
|
45
49
|
|
46
|
-
def output(
|
47
|
-
|
48
|
-
|
50
|
+
def output( acct_home, version,script )
|
51
|
+
if !version.nil?
|
52
|
+
if !version.empty?
|
53
|
+
@found << "#{script} #{version}\t=>\t#{acct_home}"
|
49
54
|
end
|
55
|
+
end
|
50
56
|
end
|
51
57
|
##
|
52
58
|
## Wp and Joomla share the same filename for its version file
|
53
59
|
def find_wordpress_joomla
|
54
|
-
version
|
55
|
-
acct_home
|
56
|
-
script
|
60
|
+
version = ""
|
61
|
+
acct_home = ""
|
62
|
+
script = ""
|
63
|
+
|
57
64
|
File.open( @path, "r" ).each_line do |line|
|
58
65
|
if ( line["wp_version ="] )
|
59
66
|
version = line.split(" ")[2][/([\d.]+)/]
|
@@ -72,9 +79,7 @@ class Miko
|
|
72
79
|
version << "." << line.split(" ")[3][/[0-9]/].to_s
|
73
80
|
end
|
74
81
|
end
|
75
|
-
|
76
|
-
output( "#{script} #{version}\t=>\t#{acct_home}" )
|
77
|
-
end
|
82
|
+
output( acct_home, version, script )
|
78
83
|
end
|
79
84
|
|
80
85
|
##
|
@@ -98,16 +103,13 @@ class Miko
|
|
98
103
|
script = "Drupal"
|
99
104
|
end
|
100
105
|
end
|
101
|
-
|
102
|
-
output( "#{script} #{version}\t=>\t#{acct_home}" )
|
103
|
-
end
|
104
|
-
|
106
|
+
output( acct_home, version, script)
|
105
107
|
end
|
106
108
|
|
107
109
|
def find_smf_version
|
108
|
-
version =
|
109
|
-
acct_home
|
110
|
-
script
|
110
|
+
version = ""
|
111
|
+
acct_home = ""
|
112
|
+
script = ""
|
111
113
|
|
112
114
|
File.open( @path, "r").each_line do |line|
|
113
115
|
if ( line["$forum_version"] )
|
@@ -116,14 +118,11 @@ class Miko
|
|
116
118
|
script = "SMF Forum"
|
117
119
|
end
|
118
120
|
end
|
119
|
-
|
120
|
-
output( "#{script} #{version}\t=>\t#{acct_home}" )
|
121
|
-
end
|
122
|
-
|
121
|
+
output( acct_home, version, script)
|
123
122
|
end
|
124
123
|
|
125
124
|
def find_magento_version
|
126
|
-
acct_home
|
125
|
+
acct_home = ""
|
127
126
|
script = ""
|
128
127
|
major = ""
|
129
128
|
minor = ""
|
@@ -134,25 +133,79 @@ class Miko
|
|
134
133
|
|
135
134
|
File.open( @path, "r").each_line do |line|
|
136
135
|
if ( line[/'major'.*=>.*/])
|
137
|
-
|
138
|
-
|
139
|
-
|
136
|
+
major = line[/[0-9]/]
|
137
|
+
script = "Magento"
|
138
|
+
acct_home = path.gsub("app/Mage.php", "")
|
140
139
|
elsif ( line[/'minor'.*=>.*/] )
|
141
|
-
|
140
|
+
minor = line[/[0-9]/]
|
142
141
|
elsif ( line[/'revision'.*=>.*/] )
|
143
|
-
|
142
|
+
revision = line[/[0-9]/]
|
144
143
|
elsif ( line[/'patch'.*=>.*/] )
|
145
|
-
|
144
|
+
patch = line[/[0-9]/]
|
146
145
|
elsif ( line[/'stability'.*=>.*/] )
|
147
|
-
|
146
|
+
stability = line.split("=>")[1][/[a-z]+/]
|
148
147
|
elsif ( line[/'number'.*=>.*/] )
|
149
|
-
|
148
|
+
number = line.split("=>")[1][/[0-9]+/]
|
150
149
|
end
|
151
150
|
end
|
152
151
|
if !stability.nil?
|
153
|
-
|
152
|
+
version = "#{major}.#{minor}.#{revision}.#{patch}-#{stability}#{number}"
|
154
153
|
else
|
155
|
-
|
154
|
+
version = "#{major}.#{minor}.#{revision}.#{patch}"
|
155
|
+
end
|
156
|
+
output( acct_home, version, script)
|
157
|
+
end
|
158
|
+
|
159
|
+
##
|
160
|
+
## phpBB version
|
161
|
+
## Versions are inside the CHANGELOG or the subsilver template
|
162
|
+
def find_phpbb_version
|
163
|
+
acct_home = ""
|
164
|
+
script = ""
|
165
|
+
version = ""
|
166
|
+
|
167
|
+
File.open( @path, "r").each_line do |line|
|
168
|
+
if ( line["version ="] )
|
169
|
+
version = line.split("=")[1][/([\d.]+)/]
|
170
|
+
acct_home = path.gsub("styles/prosilver/template/template.cfg", "")
|
171
|
+
script = "phpBB"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
output( acct_home, version, script)
|
175
|
+
end
|
176
|
+
|
177
|
+
def find_mybb_version
|
178
|
+
acct_home = ""
|
179
|
+
script = ""
|
180
|
+
version = ""
|
181
|
+
|
182
|
+
File.open( @path, "r").each_line do |line|
|
183
|
+
if ( line["public $version ="] )
|
184
|
+
version = line.split("=")[1][/([\d.]+)/]
|
185
|
+
acct_home = path.gsub("inc/class_core.php", "")
|
186
|
+
script = "MyBB"
|
187
|
+
|
188
|
+
end
|
189
|
+
end
|
190
|
+
|
191
|
+
output( acct_home, version, script)
|
192
|
+
end
|
193
|
+
|
194
|
+
|
195
|
+
def find_moodle
|
196
|
+
acct_home = ""
|
197
|
+
script = ""
|
198
|
+
version = ""
|
199
|
+
|
200
|
+
File.open(@path, "r").each_line do |line|
|
201
|
+
if ( line["$release "] )
|
202
|
+
version = line.split("=")[1].gsub("'", "").split(";")[0]
|
203
|
+
acct_home = path.gsub("version.php", "")
|
204
|
+
script = "Moodle"
|
205
|
+
end
|
206
|
+
|
156
207
|
end
|
208
|
+
|
209
|
+
output( acct_home, version, script)
|
157
210
|
end
|
158
211
|
end
|