miko 0.0.1 → 0.0.2

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: e2f41acdd74230c8b45ec8c6384450be57e07cfe
4
- data.tar.gz: 2cae96f7725a62de5c675aba4f628aa2c3c41193
3
+ metadata.gz: 6a9d254fc8d273a5b660e040380cbd8627b4d52f
4
+ data.tar.gz: 3a6e6ed1e82707ce61f514c337317cc1ffc0c7fb
5
5
  SHA512:
6
- metadata.gz: 01ebc68cde2f00c9a2be34d7e9897ccd8dabfdd16b79d50d305907b2e65e56366a21da54e5e632103070fdbd1968198769a58003d610ea44dc1b5774e7eb6ded
7
- data.tar.gz: c8c9e0898110c1d381ab508758c058cda373c3b05f3a5bd3f90a4ea506ac280169677a7c0fadb5d25666f45d2ef9d77d161ead532d75b3de0f6032dad8fbe953
6
+ metadata.gz: d99d4d2890d617536204bb6c9a5f85d035a918d039fee1b5b74c68126d6f89ac8f4d1bd1d46bc011af91b0efabc502e6b187808f9eae45c42a00a39f4cb20236
7
+ data.tar.gz: 251336b357dab2c20881393bc616b94dadc4c7dba66a905ed0a4d93fb6152ac117c7e7332d1311bce340d92f1509351fa668a86baeb4530c1853f9a30cc8ccf7
data/README.md CHANGED
@@ -5,14 +5,15 @@ Search for script installations under a cPanel account
5
5
  Supported scripts ( so far ):
6
6
  - Wordpress
7
7
  - Joomla 1.x , 2.x, 3.x
8
- - Drupal
8
+ - Drupal 7.x, 6.x
9
+ - Magento
9
10
 
10
11
  ## Installation
11
12
 
12
13
  gem install miko
13
14
 
14
15
  ## Usage
15
- ```$ miko USERNAME``
16
+ ``$ miko USERNAME``
16
17
 
17
18
  ## Contributing
18
19
 
data/lib/miko/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Miko
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/miko.rb CHANGED
@@ -3,6 +3,7 @@ class Miko
3
3
  attr_accessor :user
4
4
  attr_accessor :directory
5
5
  attr_accessor :found
6
+ attr_accessor :path
6
7
  #
7
8
  # Start the class
8
9
  def initialize( user )
@@ -21,13 +22,19 @@ class Miko
21
22
 
22
23
  private
23
24
  def find_installs
24
- final = []
25
25
  Find.find( @directory ) do |path|
26
+ @path = path
26
27
  if File.readable?(path)
27
28
  if path =~ /.*\/version\.php$/
28
- @found << find_wordpress_joomla( path )
29
+ find_wordpress_joomla
29
30
  elsif path =~ /.*\/bootstrap.inc$/
30
- @found << find_drupal( path )
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
31
38
  end
32
39
 
33
40
  else
@@ -36,15 +43,18 @@ class Miko
36
43
  end
37
44
  end
38
45
 
39
-
46
+ def output( result )
47
+ if !result.nil?
48
+ @found << result
49
+ end
50
+ end
40
51
  ##
41
52
  ## Wp and Joomla share the same filename for its version file
42
- def find_wordpress_joomla( path )
53
+ def find_wordpress_joomla
43
54
  version = ""
44
55
  acct_home = ""
45
56
  script = ""
46
- f = []
47
- File.open( path, "r" ).each_line do |line|
57
+ File.open( @path, "r" ).each_line do |line|
48
58
  if ( line["wp_version ="] )
49
59
  version = line.split(" ")[2][/([\d.]+)/]
50
60
  acct_home = path.gsub("/wp-includes/version.php", "")
@@ -62,25 +72,87 @@ class Miko
62
72
  version << "." << line.split(" ")[3][/[0-9]/].to_s
63
73
  end
64
74
  end
65
- "#{script} #{version}\t=>\t#{acct_home}"
75
+ if !version.empty?
76
+ output( "#{script} #{version}\t=>\t#{acct_home}" )
77
+ end
66
78
  end
67
79
 
68
80
  ##
69
81
  ## Find Drupal version
70
- def find_drupal( path )
82
+ def find_drupal
71
83
  version = ""
72
84
  acct_home = ""
73
85
  script = ""
74
86
 
75
- File.open( path, "r").each_line do |line|
87
+ File.open( @path, "r").each_line do |line|
76
88
  if (line["define('VERSION"] )
77
89
  version = line.split(" ")[1][/([\d.]+)/]
78
- acct_home = path.gsub("includes/bootstrap.inc", "")
90
+
91
+ ## Drupal 6 / Drupal7 compatability
92
+ if path =~ /.*\/modules\/system\/system.module$/
93
+ acct_home = path.gsub("modules/system/system.module", "")
94
+ else
95
+ acct_home = path.gsub("includes/bootstrap.inc", "")
96
+ end
97
+
79
98
  script = "Drupal"
80
99
  end
81
100
  end
82
- "#{script} #{version}\t=>\t#{acct_home}"
101
+ if !version.empty?
102
+ output( "#{script} #{version}\t=>\t#{acct_home}" )
103
+ end
104
+
83
105
  end
84
106
 
85
-
107
+ def find_smf_version
108
+ version = ""
109
+ acct_home = ""
110
+ script = ""
111
+
112
+ File.open( @path, "r").each_line do |line|
113
+ if ( line["$forum_version"] )
114
+ version = line.split("=")[1][/([\d.]+)/]
115
+ acct_home = path.gsub("index.php", "")
116
+ script = "SMF Forum"
117
+ end
118
+ end
119
+ if !version.empty?
120
+ output( "#{script} #{version}\t=>\t#{acct_home}" )
121
+ end
122
+
123
+ end
124
+
125
+ def find_magento_version
126
+ acct_home = ""
127
+ script = ""
128
+ major = ""
129
+ minor = ""
130
+ revision = ""
131
+ patch = ""
132
+ stability = false
133
+ number = ""
134
+
135
+ File.open( @path, "r").each_line do |line|
136
+ if ( line[/'major'.*=>.*/])
137
+ major = line[/[0-9]/]
138
+ script = "Magento"
139
+ acct_home = path.gsub("app/Mage.php", "")
140
+ elsif ( line[/'minor'.*=>.*/] )
141
+ minor = line[/[0-9]/]
142
+ elsif ( line[/'revision'.*=>.*/] )
143
+ revision = line[/[0-9]/]
144
+ elsif ( line[/'patch'.*=>.*/] )
145
+ patch = line[/[0-9]/]
146
+ elsif ( line[/'stability'.*=>.*/] )
147
+ stability = line.split("=>")[1][/[a-z]+/]
148
+ elsif ( line[/'number'.*=>.*/] )
149
+ number = line.split("=>")[1][/[0-9]+/]
150
+ end
151
+ end
152
+ if !stability.nil?
153
+ output( "#{script} #{major}.#{minor}.#{revision}.#{patch}-#{stability}#{number}\t=>\t#{acct_home}" )
154
+ else
155
+ output( "#{script} #{major}.#{minor}.#{revision}.#{patch}\t=>\t#{acct_home}" )
156
+ end
157
+ end
86
158
  end
data/miko.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Miko::VERSION
9
9
  spec.authors = ["Antun Krasic"]
10
10
  spec.email = ["antun@martuna.co"]
11
- spec.description = %q{Script collection first}
12
- spec.summary = %q{It has been a fun day for everybody}
11
+ spec.description = %q{Script installation finder}
12
+ spec.summary = %q{Locates popular script installations under account}
13
13
  spec.homepage = "https://github.com/akrasic/miko"
14
14
  spec.license = "MIT"
15
15
 
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.1
4
+ version: 0.0.2
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-01 00:00:00.000000000 Z
11
+ date: 2013-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- description: Script collection first
41
+ description: Script installation finder
42
42
  email:
43
43
  - antun@martuna.co
44
44
  executables:
@@ -78,5 +78,5 @@ rubyforge_project:
78
78
  rubygems_version: 2.0.0
79
79
  signing_key:
80
80
  specification_version: 4
81
- summary: It has been a fun day for everybody
81
+ summary: Locates popular script installations under account
82
82
  test_files: []