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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -0
  3. data/lib/miko/version.rb +1 -1
  4. data/lib/miko.rb +101 -48
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a9d254fc8d273a5b660e040380cbd8627b4d52f
4
- data.tar.gz: 3a6e6ed1e82707ce61f514c337317cc1ffc0c7fb
3
+ metadata.gz: 172f3d99658f1ade75394e945cf6f1e5e99dbaa3
4
+ data.tar.gz: 0f8cc88dec1daf571a09d9ea56c43dd3a3b4285a
5
5
  SHA512:
6
- metadata.gz: d99d4d2890d617536204bb6c9a5f85d035a918d039fee1b5b74c68126d6f89ac8f4d1bd1d46bc011af91b0efabc502e6b187808f9eae45c42a00a39f4cb20236
7
- data.tar.gz: 251336b357dab2c20881393bc616b94dadc4c7dba66a905ed0a4d93fb6152ac117c7e7332d1311bce340d92f1509351fa668a86baeb4530c1853f9a30cc8ccf7
6
+ metadata.gz: 75c8055fcefa751250f4be7f5d1b956584118d93a8c3ca924005b84fec3523f75f9d9d7efda85418d42208b9c267eeae9c6d188d9916e7e8297de0e950501b86
7
+ data.tar.gz: 3c93ff7eaa451a2649666b2690ef492edd707c959a686c71e1facbbeb90e4a84c8666d7c60dc0f6e3b34c466e8400467aed40985b42a80be31864d17e4dc7432
data/README.md CHANGED
@@ -7,6 +7,11 @@ Supported scripts ( so far ):
7
7
  - Joomla 1.x , 2.x, 3.x
8
8
  - Drupal 7.x, 6.x
9
9
  - Magento
10
+ - phpBB
11
+ - SMF Forum
12
+ - MyBB
13
+ - Moodle
14
+ - Prestashop
10
15
 
11
16
  ## Installation
12
17
 
data/lib/miko/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Miko
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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 = 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
- @path = path
27
- if File.readable?(path)
28
- if path =~ /.*\/version\.php$/
29
- find_wordpress_joomla
30
- elsif path =~ /.*\/bootstrap.inc$/
31
- find_drupal
32
- elsif path =~ /.*\/modules\/system\/system.module$/
33
- find_drupal
34
- elsif path =~ /.*\/index.php$/
35
- find_smf_version
36
- elsif path =~ /.*\/app\/Mage.php$/
37
- find_magento_version
38
- end
39
-
40
- else
41
- raise "Error accessing #{path}"
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( result )
47
- if !result.nil?
48
- @found << result
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
- if !version.empty?
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
- if !version.empty?
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
- if !version.empty?
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
- major = line[/[0-9]/]
138
- script = "Magento"
139
- acct_home = path.gsub("app/Mage.php", "")
136
+ major = line[/[0-9]/]
137
+ script = "Magento"
138
+ acct_home = path.gsub("app/Mage.php", "")
140
139
  elsif ( line[/'minor'.*=>.*/] )
141
- minor = line[/[0-9]/]
140
+ minor = line[/[0-9]/]
142
141
  elsif ( line[/'revision'.*=>.*/] )
143
- revision = line[/[0-9]/]
142
+ revision = line[/[0-9]/]
144
143
  elsif ( line[/'patch'.*=>.*/] )
145
- patch = line[/[0-9]/]
144
+ patch = line[/[0-9]/]
146
145
  elsif ( line[/'stability'.*=>.*/] )
147
- stability = line.split("=>")[1][/[a-z]+/]
146
+ stability = line.split("=>")[1][/[a-z]+/]
148
147
  elsif ( line[/'number'.*=>.*/] )
149
- number = line.split("=>")[1][/[0-9]+/]
148
+ number = line.split("=>")[1][/[0-9]+/]
150
149
  end
151
150
  end
152
151
  if !stability.nil?
153
- output( "#{script} #{major}.#{minor}.#{revision}.#{patch}-#{stability}#{number}\t=>\t#{acct_home}" )
152
+ version = "#{major}.#{minor}.#{revision}.#{patch}-#{stability}#{number}"
154
153
  else
155
- output( "#{script} #{major}.#{minor}.#{revision}.#{patch}\t=>\t#{acct_home}" )
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antun Krasic