miko 0.0.6 → 0.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2ac248b2ba97d2d9957c7f30b626d0344de3a8e8
4
- data.tar.gz: 8c498939cce18f2b2d67cf1b7c0588bbf716e2ad
3
+ metadata.gz: c45cc4d2ff97a91c5164464588e5f74f8abe54a2
4
+ data.tar.gz: 9d6d0dc8d03cddab9e8c259de55ab5d0d9f8ff01
5
5
  SHA512:
6
- metadata.gz: f2bcf73556fa3f2ba5ebb43aa4864614bba3ac2959534ec0724eac91b8101cec3a1b9bcf1a5fd9161a71a93d02d2c6c903e573c04c7e077ccda03dd277f2c320
7
- data.tar.gz: d551393581a0efe23a2cd6714b08747a7640e5544437ca5486485a91a4050b58656e9c4922cd3fba73465bb5bf78a0b4b68588624b58b1625af69e8b61f40c75
6
+ metadata.gz: 9b72ffb25266fb66494585777ba4975b79f375e84ea705fa16f4f8dd54e22c75c1070093f04abfb49cc526949788b032d2588deeab56a02624ff99cc6d43fff2
7
+ data.tar.gz: 550fa2c337c43fccb543c06767d43ac3a33c14226b573799a36673c7a24262574f82cbcfdeb743060181bf9545bc5f4cffcfb990fb87303015ad01f7a14dc4cb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Miko 0.0.6
1
+ # Miko 0.1.1
2
2
 
3
3
  Search for script installations versions under a account.
4
4
 
@@ -11,16 +11,56 @@ Supported scripts ( so far ):
11
11
  - SMF Forum
12
12
  - MyBB
13
13
  - Moodle
14
+ - Concrete5
15
+ - e107
16
+ - BBPress
17
+ - ModX
14
18
 
15
19
  ## Installation
16
20
  `` gem install miko ``
17
21
 
18
22
  ## Usage
19
23
  You can try to scan for the user accoutn using the "-u"/"--user" flag which translates to /home/USER/ or use "-d"/"--directory" flag to specify an exact directoy you want to scan.
20
- Usage: miko [OPTIONS]
21
- -u, --user USER Username - translates into /home/USER/
22
- -d, --directory DIRECTORY Specify directory instead username
23
- -h, --help Display Help
24
+ ```
25
+ Usage: miko [options]
26
+ -u, --user USER Username - translates into /home/USER/
27
+ -d, --directory DIRECTORY Specify directory instead username
28
+ -s, --script SCRIPT Search for a specific script or scripts.
29
+ For multiple scripts you can pass them as a list: miko -s wordpress -s smf -d /some/directory
30
+ -l, --list Lists supported scripts
31
+ -v, --verbose Be verbose and display errors
32
+ -h, --help Display Help
33
+ ```
34
+ ## Examples
35
+ Find scripts for a user account:
36
+ `` miko -u USER ``
37
+ Find specific scripts for a user or directoy
38
+ `` miko -u USER -s wordpress -s phpbb -s joomla``
39
+ `` miko -d /home/USER/some/other/dir/ -s wordpress -s phpbb -s joomla``
40
+
41
+ ## Output
42
+ ```
43
+ Name Version Installation
44
+
45
+ BBPress 2.3.2 /home/antun/public_html/bbpress/bbpress/
46
+ Concrete5 5.6.1.2 /home/antun/public_html/concrete/concrete5.6.1.2/
47
+ Drupal 6.28 /home/antun/public_html/drupal6/drupal-6.28/
48
+ Drupal 7.22 /home/antun/public_html/drupal7/drupal-7.22/
49
+ Joomla 1.5.26 /home/antun/public_html/j15/
50
+ Joomla 3.1.1 /home/antun/public_html/joomla/
51
+ Magento 1.7.0.2 /home/antun/public_html/magento/magento/
52
+ Magento 1.8.0.0-alpha1 /home/antun/public_html/magento2/magento/
53
+ ModX 2.2.8-pl /home/antun/public_html/modx/modx-2.2.8-pl/
54
+ Moodle 2.5(Build:20130514) /home/antun/public_html/moodle2/moodle/
55
+ Moodle 2.5+(Build:20130530) /home/antun/public_html/moodle/moodle/
56
+ MyBB 1.6.10 /home/antun/public_html/mybb/Upload/
57
+ SMF 2.0.4 /home/antun/public_html/smf/
58
+ Wordpress 3.5.1 /home/antun/public_html/wp/wordpress/
59
+ e107 1.0.4 /home/antun/public_html/e107/
60
+ phpBB 3.0.11 /home/antun/public_html/phpbb/phpBB3/
61
+ Scrips detected: 16
62
+
63
+ ```
24
64
 
25
65
  ## Contributing
26
66
 
@@ -29,3 +69,4 @@ Usage: miko [OPTIONS]
29
69
  3. Commit your changes (`git commit -am 'Add some feature'`)
30
70
  4. Push to the branch (`git push origin my-new-feature`)
31
71
  5. Create new Pull Request
72
+
data/bin/miko CHANGED
@@ -1,9 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
+ # miko
3
+ # Version 0.1.1
4
+ #--------------------------------
2
5
 
3
6
  $LOAD_PATH << File.join(File.dirname(__FILE__), '../lib')
4
7
  require 'find'
5
8
  require 'fileutils'
6
- require 'miko'
9
+ require 'miko/traveler'
7
10
  require 'optparse'
8
11
 
9
12
  options = {}
@@ -18,6 +21,16 @@ optparse = OptionParser.new do |opts|
18
21
  options[:directory] = dir
19
22
  end
20
23
 
24
+ options[:script] = []
25
+ opts.on("-s sc", "--script SCRIPT", "Search for a specific script or scripts.\n\t\t\t\t For multiple scripts you can pass them as a list: miko -s wordpress -s smf -d /some/directory") do |script|
26
+ options[:script] << script
27
+ end
28
+
29
+ options[:list] = false
30
+ opts.on( "-l", "--list", "Lists supported scripts") do |list|
31
+ options[:list] = list
32
+ end
33
+
21
34
  opts.on("-v", "--verbose", "Be verbose and display errors" ) do |ver|
22
35
  options[:verbose] = ver
23
36
  end
@@ -31,20 +44,28 @@ end
31
44
 
32
45
  begin
33
46
  optparse.parse!
34
- if options[:user].nil? and options[:directory].nil?
35
- puts optparse
36
- exit
47
+
48
+ if options[:list].nil?
49
+ if options[:user].nil? and options[:directory].nil?
50
+ puts optparse
51
+ exit
52
+ end
37
53
  end
38
54
 
39
- c = Miko.new( options )
55
+ c = Miko::Traveler.new( options )
40
56
 
41
57
  begin
42
58
  c.run
43
- if c.found.empty?
44
- puts "No scripts detected"
45
- else
46
- puts "Scrips detected"
47
- c.found.sort.each{ | script| puts script }
59
+
60
+ unless options[:list]
61
+ if c.found.empty?
62
+ puts "No scripts detected"
63
+ else
64
+
65
+ puts"%-20s %-30s %20s \n " % [ "Name", "Version", "Installation"]
66
+ c.found.sort.each{ | script| puts script }
67
+ puts "Scrips detected: #{ c.found.length.to_s }"
68
+ end
48
69
  end
49
70
  rescue Exception => e
50
71
  puts e
@@ -54,3 +75,4 @@ rescue OptionParser::InvalidOption, OptionParser::MissingArgument
54
75
  puts optparse
55
76
  exit
56
77
  end
78
+
data/lib/miko.rb CHANGED
@@ -1,210 +1,4 @@
1
1
 
2
- class Miko
3
- attr_accessor :user
4
- attr_accessor :directory
5
- attr_accessor :found
6
- attr_accessor :path
7
- attr_accessor :verbose
8
-
9
- def initialize( option )
10
- unless option[:user].nil?
11
- @user = option[:user]
12
- @directory = "/home/#{option[:user]}/public_html"
13
- end
14
-
15
- unless option[:directory].nil?
16
- @directory = option[:directory]
17
- end
18
-
19
- unless option[:verbose]
20
- @verbose = option[:verbose]
21
- end
22
-
23
- @found = []
24
- end
25
-
26
- def run
27
- if File.directory?(@directory ) and File.readable?(@directory)
28
- find_installs
29
-
30
- else
31
- unless defined?(@verbose).nil?
32
- raise "Problem accessing directory"
33
- end
34
- end
35
- end
36
-
37
- private
38
- ##
39
- ## Skip /home/virtfs
40
- def find_installs
41
- Find.find( @directory ) do |path|
42
- @path = path
43
- if File.readable_real?(path)
44
- if path[/virtfs/].nil?
45
- if path =~ /.*\/version\.php$/
46
- find_wordpress_joomla
47
- find_moodle
48
- elsif path =~ /.*\/bootstrap.inc$/
49
- find_drupal
50
- elsif path =~ /.*\/modules\/system\/system.module$/
51
- find_drupal
52
- elsif path =~ /.*\/index.php$/
53
- find_smf_version
54
- elsif path =~ /.*\/app\/Mage.php$/
55
- find_magento_version
56
- elsif path =~ /.*\/styles\/prosilver\/template\/template.cfg$/
57
- find_phpbb_version
58
- elsif path =~/.*\/inc\/class_core.php$/
59
- find_mybb_version
60
- end
61
- end
62
- else
63
- unless defined?( @verbose).nil?
64
- puts "Problem accessing #{path}"
65
- end
66
- end
67
- end
68
- end
69
-
70
-
71
- def output( acct_home, version,script )
72
- unless version.nil? or version.empty?
73
- @found << "#{script} #{version}\t=>\t#{acct_home}"
74
- end
75
- end
76
-
77
- ##
78
- ## Wp and Joomla share the same filename for its version file
79
- def find_wordpress_joomla
80
- File.open( @path, "r" ).each_line do |line|
81
- if ( line["wp_version ="] )
82
- version = line.split(" ")[2][/([\d.]+)/]
83
- acct_home = path.gsub("/wp-includes/version.php", "")
84
- script = "Wordpress"
85
- elsif ( line["$RELEASE"] )
86
- if @path =~ /.*\/libraries\/cms\/version\/version.php$/ || @path =~ /.*\/libraries\/joomla\/version.php$/
87
- version = line[/([\d.]+)/]+ "."+ joomla_devlevel
88
- acct_home = path.split("libraries")[0]
89
- script = "Joomla"
90
- end
91
- end
92
- # Output ony when we has a defined variable
93
- unless defined?(version).nil?
94
- output( acct_home, version, script )
95
- end
96
- end
97
- end
98
-
99
- def joomla_devlevel
100
- File.read( @path )[/DEV_LEVEL.*'/][/\d+/]
101
- end
102
-
103
- ## Find Drupal version
104
- def find_drupal
105
- File.open( @path, "r").each_line do |line|
106
- if (line["define('VERSION"] )
107
- version = line.split(" ")[1][/([\d.]+)/]
108
- ## Drupal 6 / Drupal7 compatability
109
- if path =~ /.*\/modules\/system\/system.module$/
110
- acct_home = path.gsub("modules/system/system.module", "")
111
- else
112
- acct_home = path.gsub("includes/bootstrap.inc", "")
113
- end
114
- script = "Drupal"
115
- end
116
- unless defined?(version).nil?
117
- output( acct_home, version, script)
118
- end
119
- end
120
- end
121
-
122
- def find_smf_version
123
- File.open( @path, "r").each_line do |line|
124
- if ( line["$forum_version"] )
125
- version = line.split("=")[1][/([\d.]+)/]
126
- acct_home = path.gsub("index.php", "")
127
- script = "SMF Forum"
128
- end
129
- unless defined?(version).nil?
130
- output( acct_home, version, script)
131
- end
132
- end
133
- end
134
-
135
- def find_magento_version
136
- File.open( @path, "r").each_line do |line|
137
- if ( line[/'major'.*=>.*/])
138
- major = line[/[0-9]/]
139
- script = "Magento"
140
- acct_home = path.gsub("app/Mage.php", "")
141
-
142
- sec = File.read(@path)
143
- minor = sec[/'minor'.*=>.*/][/\d/]
144
- revision = sec[/'revision'.*=>.*/][/\d/]
145
- patch = sec[/'patch'.*=>.*/][/\d/]
146
- stability = sec[/'stability'.*=>.*/].split("=>")[1][/[a-z]+/]
147
- number = sec[/'number'.*=>.*/][/\d/]
148
-
149
- if stability.nil?
150
- version = "#{major}.#{minor}.#{revision}.#{patch}"
151
- else
152
- version = "#{major}.#{minor}.#{revision}.#{patch}-#{stability}#{number}"
153
- end
154
- end
155
-
156
- ## Ship it
157
- unless defined?(version).nil?
158
- output( acct_home, version, script)
159
- end
160
-
161
- end
162
- end
163
-
164
- ##
165
- ## phpBB version
166
- ## Versions are inside the CHANGELOG or the subsilver template
167
- def find_phpbb_version
168
- File.open( @path, "r").each_line do |line|
169
- if ( line["version ="] )
170
- version = line.split("=")[1][/([\d.]+)/]
171
- acct_home = path.gsub("styles/prosilver/template/template.cfg", "")
172
- script = "phpBB"
173
- end
174
-
175
- unless defined?(version).nil?
176
- output( acct_home, version, script)
177
- end
178
- end
179
-
180
- end
181
-
182
- def find_mybb_version
183
- File.open( @path, "r").each_line do |line|
184
- if ( line["public $version ="] )
185
- version = line.split("=")[1][/([\d.]+)/]
186
- acct_home = path.gsub("inc/class_core.php", "")
187
- script = "MyBB"
188
- end
189
-
190
- unless defined?(version).nil?
191
- output( acct_home, version, script)
192
- end
193
- end
194
-
195
- end
196
-
197
-
198
- def find_moodle
199
- File.open(@path, "r").each_line do |line|
200
- if ( line["$release "] )
201
- version = line.split("=")[1].gsub("'", "").split(";")[0]
202
- acct_home = @path.gsub("version.php", "")
203
- script = "Moodle"
204
- end
205
- unless defined?(version).nil?
206
- output( acct_home, version, script)
207
- end
208
- end
209
- end
2
+ module Miko
3
+ # Stay right there boi
210
4
  end
@@ -0,0 +1,121 @@
1
+ ##
2
+ ## Main miko controller
3
+ ## Include, specify and add new modules and regex defs
4
+ ##
5
+
6
+ require 'scripts/wordpress.rb'
7
+ require 'scripts/joomla.rb'
8
+ require 'scripts/drupal.rb'
9
+ require 'scripts/smf.rb'
10
+ require 'scripts/magento.rb'
11
+ require 'scripts/phpbb.rb'
12
+ require 'scripts/mybb.rb'
13
+ require 'scripts/moodle.rb'
14
+ require 'scripts/concrete5.rb'
15
+ require 'scripts/e107.rb'
16
+ require 'scripts/bbpress.rb'
17
+ require 'scripts/modx.rb'
18
+
19
+ module Miko
20
+ class Applications
21
+ attr_accessor :applist, :option
22
+ attr_accessor :user, :directory, :found, :path, :verbose
23
+
24
+ def initialize(option)
25
+ @option = option
26
+ ## Add to applist
27
+ ## name => /regxp
28
+ @applist= { 'wordpress' => /.*\/wp-includes\/version.php$/,
29
+ 'joomla15' => /.*\/libraries\/joomla\/version.php$/,
30
+ 'joomla25' => /.*\/libraries\/cms\/version\/version.php$/,
31
+ 'drupal' => /.*\/CHANGELOG.txt$/,
32
+ 'smf' => /.*\/index.php$/,
33
+ 'magento' => /.*\/app\/Mage.php$/,
34
+ 'phpbb' => /.*\/styles\/prosilver\/template\/template.cfg$/,
35
+ 'mybb' => /.*\/inc\/class_core.php$/,
36
+ 'moodle' => /.*\/version.php$/,
37
+ 'concrete5' => /.*\/concrete\/config\/version.php$/,
38
+ 'e107' => /.*\/e107_admin\/ver.php$/,
39
+ 'modx' => /.*\/core\/docs\/changelog.txt$/,
40
+ 'bbpress' => /.*\/bbpress.php$/
41
+ }
42
+ end
43
+
44
+
45
+
46
+ def final_find( script, file )
47
+ case script
48
+ when 'wordpress'
49
+ wp = Miko::Wordpress.new( file )
50
+ wp.showVersion()
51
+ when 'joomla15', 'joomla25'
52
+ j = Miko::Joomla.new( file )
53
+ j.showVersion()
54
+
55
+ when "drupal"
56
+ drupal = Miko::Drupal.new( file )
57
+ drupal.showVersion()
58
+
59
+ when "smf"
60
+ smf = Miko::SMF.new( file )
61
+ smf.showVersion()
62
+
63
+ when "magento"
64
+ magento = Miko::Magento.new( file )
65
+ magento.showVersion()
66
+
67
+ when "phpbb"
68
+ phpbb = Miko::PHPBB.new( file )
69
+ phpbb.showVersion()
70
+
71
+ when "mybb"
72
+ mybb = Miko::MyBB.new(file)
73
+ mybb.showVersion()
74
+
75
+ when "moodle"
76
+ moodle = Miko::Moodle.new( file )
77
+ moodle.showVersion()
78
+
79
+ when "concrete5"
80
+ c5 = Miko::Concrete5.new(file)
81
+ c5.showVersion()
82
+ when "e107"
83
+ e = Miko::E107.new(file)
84
+ e.showVersion()
85
+ when "bbpress"
86
+ b = Miko::BBPress.new(file)
87
+ b.showVersion()
88
+ when "modx"
89
+ modx = Miko::ModX.new(file)
90
+ modx.showVersion()
91
+ end
92
+ end
93
+
94
+
95
+ ##
96
+ ## Loops trough the defined @applist checking if the provided path wouldn't match
97
+ ## once of defined regex definitions
98
+ def checkScripts( path )
99
+ if @option[:script].empty?
100
+ @applist.each do |sc, val|
101
+ if !val.match(path).nil?
102
+ f = final_find(sc, path)
103
+ @found << f if !f.nil?
104
+ end
105
+ end
106
+ else
107
+ @option[:script].each do |sc|
108
+ if !@applist[sc].match(path).nil?
109
+ f = final_find(sc, path)
110
+ @found << f if !f.nil?
111
+ end
112
+ end
113
+ end
114
+
115
+
116
+
117
+ end
118
+
119
+
120
+ end
121
+ end
data/lib/miko/base.rb ADDED
@@ -0,0 +1,24 @@
1
+ ##
2
+ ### Base class for script modules
3
+ ### Provides with necessary helpers to successfulyl
4
+ ### tie up the integration.
5
+
6
+ module Miko
7
+ class Base
8
+ attr_accessor :path, :acct_home, :version, :script
9
+
10
+ def initialize( path )
11
+ @path = path
12
+ end
13
+
14
+ # Output formatted version string
15
+ def showVersion
16
+ unless defined?(@version).nil?
17
+ unless @version.nil? or @version.empty?
18
+ "%-20s %-30s %20s" % [ @script, @version, @acct_home]
19
+ end
20
+ end
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,66 @@
1
+ ##
2
+ ## Glue that class Miko::Applications
3
+ ##
4
+ require 'miko/applications.rb'
5
+
6
+ module Miko
7
+ class Traveler < Miko::Applications
8
+ attr_accessor :list
9
+
10
+ def initialize( option )
11
+ super( option )
12
+
13
+ unless option[:user].nil?
14
+ @user = option[:user]
15
+ @directory = "/home/#{user}/public_html/"
16
+ end
17
+
18
+ unless option[:directory].nil?
19
+ @directory = option[:directory]
20
+ end
21
+
22
+ unless option[:verbose].nil?
23
+ @verbose = option[:verbose]
24
+ end
25
+
26
+ unless option[:list].nil?
27
+ @list = option[:list]
28
+ end
29
+
30
+ @found = []
31
+
32
+ end
33
+ ## Define your awesum stuff here
34
+ def run( )
35
+ if option[:list]
36
+ listScripts
37
+ else
38
+ if File.directory?(@directory) and File.readable?(@directory)
39
+
40
+ Find.find( directory ) do |path|
41
+ if File.readable_real?(path)
42
+ if path[/virtfs/].nil?
43
+ checkScripts( path.chomp )
44
+ end
45
+ end
46
+ end
47
+
48
+ else
49
+ unless defined?(@verbose).nil?
50
+ raise "Problem accessing directory #{@directory}"
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ def listScripts
57
+ puts "Supported scripts\n----------------------"
58
+ @applist.each do |script, val|
59
+ puts "- #{script}"
60
+ end
61
+ end
62
+
63
+
64
+
65
+ end #EOC
66
+ end #EOM
data/lib/miko/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Miko
2
- VERSION = "0.0.6"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -0,0 +1,22 @@
1
+ ##
2
+ ## BBPress search class
3
+ ### BBPress :: http://bbpress.org/
4
+ require 'miko/base.rb'
5
+ module Miko
6
+ class BBPress < Miko::Base
7
+
8
+ def initialize( path )
9
+ super( path )
10
+
11
+ ##
12
+ ## Skip any false bbpress.php files
13
+ ver = File.read( path )[/.*this->version.*/]
14
+ unless ver.nil?
15
+ @version = ver[/([\d.]+)/]
16
+ @acct_home = path.gsub("bbpress.php", "")
17
+ @script = "BBPress"
18
+ end
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,15 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class Concrete5 < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ ## Load ver
9
+ @version = File.read( path )[/.*APP_VERSION.*/][/([\d.]+)/]
10
+ @acct_home = path.gsub("concrete/config/version.php", "")
11
+ @script = "Concrete5"
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class Drupal < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+ versions = []
8
+
9
+ ## Verify that this is indeed Drupal's
10
+ File.open( path ).each_line {|x| versions << x if x =~ /Drupal.*/ }
11
+ unless versions.empty?
12
+ @version = versions[0][/([\d.]+)/]
13
+ @script = "Drupal"
14
+ @acct_home = path.gsub("CHANGELOG.txt", "")
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class E107 < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ ## Load ver
9
+ ver = File.read( path )[/.*e107_version.*/]
10
+ unless ver.nil?
11
+ @version = ver.split("=")[1][/([\d.]+)/]
12
+ @acct_home = path.gsub("e107_admin/ver.php", "")
13
+ @script = "e107"
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,22 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class Joomla < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ ## Load ver
9
+ ver = File.read( path )[/.*RELEASE.*/][/([\d.]+)/]
10
+ dev = File.read( path )[/DEV_LEVEL.*/][/\d+/]
11
+
12
+ @version = "#{ver}.#{dev}"
13
+ @acct_home = path.split("libraries")[0]
14
+ @script = "Joomla"
15
+ end
16
+
17
+ def returnversion(path)
18
+ File.read( path )[/.*wp_version.*=.*$/][/([\d.]+)/]
19
+ end
20
+
21
+ end
22
+ end
@@ -0,0 +1,29 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class Magento < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ magento = { 'major' => File.read( path )[/'major'.*=>.*/][/\d/],
9
+ 'minor' => File.read( path )[/'minor'.*=>.*/][/\d/],
10
+ 'revision' => File.read( path )[/'revision'.*=>.*/][/\d/],
11
+ 'patch' => File.read( path )[/'patch'.*=>.*/][/\d/],
12
+ 'stability' => File.read( path )[/'stability'.*=>.*/].split("=>")[1][/[a-z]+/],
13
+ 'number' => File.read( path )[/'number'.*=>.*/][/\d/]
14
+ }
15
+
16
+ @acct_home = path.gsub("app/Mage.php", "")
17
+ @script = "Magento"
18
+
19
+ if magento["stability"].nil?
20
+ @version = "#{magento["major"]}.#{magento["minor"]}.#{magento["revision"]}.#{magento["patch"]}"
21
+ else
22
+ @version = "#{magento["major"]}.#{magento["minor"]}.#{magento["revision"]}.#{magento["patch"]}-#{magento["stability"]}#{magento["number"]}"
23
+ end
24
+
25
+
26
+ end
27
+
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class ModX < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ ## Load ver
9
+ versions = []
10
+ File.open(path, "r").each {|x| versions << x if x =~ /MODX Revolution/}
11
+ @version = versions[0].split(" ")[2]
12
+ @acct_home = path.gsub("core/docs/changelog.txt", "")
13
+ @script = "ModX"
14
+ end
15
+
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class Moodle < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ versions = []
9
+ File.open( path ).each_line {|x| versions << x if x =~ /MOODLE VERSION INFORMATION.*/ }
10
+
11
+ unless versions.empty?
12
+ @script = "Moodle"
13
+ @version = File.read( path )[/.*release.*=.*/].to_s.split("=")[1].gsub("'", "").split(";")[0].gsub(" ", "")
14
+ @acct_home = @path.gsub("version.php", "")
15
+
16
+ end
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class MyBB < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ ## Load ver
9
+ ver = File.read( path )[/.*public.*version.*=.*/]
10
+ unless ver.nil?
11
+ @version = ver[/([\d.]+)/]
12
+ @acct_home = path.gsub("inc/class_core.php", "")
13
+ @script = "MyBB"
14
+ end
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,15 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class PHPBB < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ ## Load ver
9
+ @version = File.read( path )[/.*version.*=.*/][/([\d.]+)/]
10
+ @acct_home = path.gsub("styles/prosilver/template/template.cfg", "")
11
+ @script = "phpBB"
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,20 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class SMF < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+ versions = []
8
+
9
+ ## Verify that this is indeed Drupal's
10
+ File.open( path ).each_line {|x| versions << x if x =~ /.*forum_version.*/ }
11
+ unless versions.empty?
12
+ @version = versions[0][/([\d.]+)/]
13
+ @script = "SMF"
14
+ @acct_home = path.gsub("index.php", "")
15
+ end
16
+
17
+ end
18
+
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ require 'miko/base.rb'
2
+ module Miko
3
+ class Wordpress < Miko::Base
4
+
5
+ def initialize( path )
6
+ super( path )
7
+
8
+ @version = returnversion( @path )
9
+ @acct_home = path.gsub("wp-includes/version.php", "")
10
+ @script = "Wordpress"
11
+ end
12
+
13
+ def returnversion(path)
14
+ File.read( path )[/.*wp_version.*=.*$/][/([\d.]+)/]
15
+ end
16
+
17
+ end
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miko
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antun Krasic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-06-04 00:00:00.000000000 Z
11
+ date: 2013-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -53,7 +53,22 @@ files:
53
53
  - Rakefile
54
54
  - bin/miko
55
55
  - lib/miko.rb
56
+ - lib/miko/applications.rb
57
+ - lib/miko/base.rb
58
+ - lib/miko/traveler.rb
56
59
  - lib/miko/version.rb
60
+ - lib/scripts/bbpress.rb
61
+ - lib/scripts/concrete5.rb
62
+ - lib/scripts/drupal.rb
63
+ - lib/scripts/e107.rb
64
+ - lib/scripts/joomla.rb
65
+ - lib/scripts/magento.rb
66
+ - lib/scripts/modx.rb
67
+ - lib/scripts/moodle.rb
68
+ - lib/scripts/mybb.rb
69
+ - lib/scripts/phpbb.rb
70
+ - lib/scripts/smf.rb
71
+ - lib/scripts/wordpress.rb
57
72
  - miko.gemspec
58
73
  homepage: https://github.com/akrasic/miko
59
74
  licenses: