miko 0.0.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 +7 -0
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +23 -0
- data/Rakefile +1 -0
- data/bin/miko +26 -0
- data/lib/miko/version.rb +3 -0
- data/lib/miko.rb +86 -0
- data/miko.gemspec +23 -0
- metadata +82 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e2f41acdd74230c8b45ec8c6384450be57e07cfe
|
4
|
+
data.tar.gz: 2cae96f7725a62de5c675aba4f628aa2c3c41193
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 01ebc68cde2f00c9a2be34d7e9897ccd8dabfdd16b79d50d305907b2e65e56366a21da54e5e632103070fdbd1968198769a58003d610ea44dc1b5774e7eb6ded
|
7
|
+
data.tar.gz: c8c9e0898110c1d381ab508758c058cda373c3b05f3a5bd3f90a4ea506ac280169677a7c0fadb5d25666f45d2ef9d77d161ead532d75b3de0f6032dad8fbe953
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Antun Krasic
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# Miko
|
2
|
+
|
3
|
+
Search for script installations under a cPanel account
|
4
|
+
|
5
|
+
Supported scripts ( so far ):
|
6
|
+
- Wordpress
|
7
|
+
- Joomla 1.x , 2.x, 3.x
|
8
|
+
- Drupal
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
gem install miko
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
```$ miko USERNAME``
|
16
|
+
|
17
|
+
## Contributing
|
18
|
+
|
19
|
+
1. Fork it
|
20
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
21
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
22
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
23
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/miko
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), '../lib')
|
4
|
+
require "find"
|
5
|
+
require "fileutils"
|
6
|
+
require 'miko'
|
7
|
+
|
8
|
+
if ARGV.empty?
|
9
|
+
puts "USAGE: miko USER"
|
10
|
+
else
|
11
|
+
c = Miko.new( ARGV[0] )
|
12
|
+
|
13
|
+
begin
|
14
|
+
c.run
|
15
|
+
|
16
|
+
if c.found.empty?
|
17
|
+
puts "No scripts found"
|
18
|
+
else
|
19
|
+
puts "Scripts detected"
|
20
|
+
c.found.sort.each { |script| puts script }
|
21
|
+
end
|
22
|
+
rescue Exception => e
|
23
|
+
puts e
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
data/lib/miko/version.rb
ADDED
data/lib/miko.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
|
2
|
+
class Miko
|
3
|
+
attr_accessor :user
|
4
|
+
attr_accessor :directory
|
5
|
+
attr_accessor :found
|
6
|
+
#
|
7
|
+
# Start the class
|
8
|
+
def initialize( user )
|
9
|
+
@user = user
|
10
|
+
@directory = "/home/#{@user}/public_html"
|
11
|
+
@found = []
|
12
|
+
end
|
13
|
+
|
14
|
+
def run
|
15
|
+
if File.directory?(@directory )
|
16
|
+
find_installs
|
17
|
+
else
|
18
|
+
raise "Directory doesn't exist"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def find_installs
|
24
|
+
final = []
|
25
|
+
Find.find( @directory ) do |path|
|
26
|
+
if File.readable?(path)
|
27
|
+
if path =~ /.*\/version\.php$/
|
28
|
+
@found << find_wordpress_joomla( path )
|
29
|
+
elsif path =~ /.*\/bootstrap.inc$/
|
30
|
+
@found << find_drupal( path )
|
31
|
+
end
|
32
|
+
|
33
|
+
else
|
34
|
+
raise "Error accessing #{path}"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
##
|
41
|
+
## Wp and Joomla share the same filename for its version file
|
42
|
+
def find_wordpress_joomla( path )
|
43
|
+
version = ""
|
44
|
+
acct_home = ""
|
45
|
+
script = ""
|
46
|
+
f = []
|
47
|
+
File.open( path, "r" ).each_line do |line|
|
48
|
+
if ( line["wp_version ="] )
|
49
|
+
version = line.split(" ")[2][/([\d.]+)/]
|
50
|
+
acct_home = path.gsub("/wp-includes/version.php", "")
|
51
|
+
script = "Wordpress"
|
52
|
+
elsif ( line["public $RELEASE"] )
|
53
|
+
version = line.split(" ")[3][/([\d.]+)/]
|
54
|
+
acct_home = path.gsub("libraries/cms/version/version.php", "")
|
55
|
+
script = "Joomla"
|
56
|
+
elsif (line["var $RELEASE"] )
|
57
|
+
version = line.split(" ")[3][/([\d.]+)/]
|
58
|
+
acct_home = path.gsub("libraries/joomla/version.php", "")
|
59
|
+
script = "Joomla"
|
60
|
+
elsif (line["public $DEV_LEVEL" ])
|
61
|
+
elsif (line["var $DEV_LEVEL"] )
|
62
|
+
version << "." << line.split(" ")[3][/[0-9]/].to_s
|
63
|
+
end
|
64
|
+
end
|
65
|
+
"#{script} #{version}\t=>\t#{acct_home}"
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
## Find Drupal version
|
70
|
+
def find_drupal( path )
|
71
|
+
version = ""
|
72
|
+
acct_home = ""
|
73
|
+
script = ""
|
74
|
+
|
75
|
+
File.open( path, "r").each_line do |line|
|
76
|
+
if (line["define('VERSION"] )
|
77
|
+
version = line.split(" ")[1][/([\d.]+)/]
|
78
|
+
acct_home = path.gsub("includes/bootstrap.inc", "")
|
79
|
+
script = "Drupal"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
"#{script} #{version}\t=>\t#{acct_home}"
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
end
|
data/miko.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'miko/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "miko"
|
8
|
+
spec.version = Miko::VERSION
|
9
|
+
spec.authors = ["Antun Krasic"]
|
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}
|
13
|
+
spec.homepage = "https://github.com/akrasic/miko"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: miko
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Antun Krasic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Script collection first
|
42
|
+
email:
|
43
|
+
- antun@martuna.co
|
44
|
+
executables:
|
45
|
+
- miko
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- bin/miko
|
55
|
+
- lib/miko.rb
|
56
|
+
- lib/miko/version.rb
|
57
|
+
- miko.gemspec
|
58
|
+
homepage: https://github.com/akrasic/miko
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
63
|
+
rdoc_options: []
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project:
|
78
|
+
rubygems_version: 2.0.0
|
79
|
+
signing_key:
|
80
|
+
specification_version: 4
|
81
|
+
summary: It has been a fun day for everybody
|
82
|
+
test_files: []
|