miko 0.0.5 → 0.0.6

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 (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/miko +5 -1
  4. data/lib/miko.rb +42 -29
  5. data/lib/miko/version.rb +1 -1
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6df3d5a11fae7254d94389930a0c0eccbff22ad
4
- data.tar.gz: f3eccbb051b3dee59f67a6afd446b55186fce22d
3
+ metadata.gz: 2ac248b2ba97d2d9957c7f30b626d0344de3a8e8
4
+ data.tar.gz: 8c498939cce18f2b2d67cf1b7c0588bbf716e2ad
5
5
  SHA512:
6
- metadata.gz: 51467ffc393fde6f9222b160c47a7c3ba0aeb27a743c997415562d9a917c5d1a78edbf84b93707aceb452386992637bc0cb7943a50da17a313644f81523930c0
7
- data.tar.gz: 620deed9aa4cc30b8425c2a99d49df7c81715f17d96de900cbebef20853bcc68d34bec7ec6c2f206edac5bacd4e707d6a217744c527c145914d26f351701d69f
6
+ metadata.gz: f2bcf73556fa3f2ba5ebb43aa4864614bba3ac2959534ec0724eac91b8101cec3a1b9bcf1a5fd9161a71a93d02d2c6c903e573c04c7e077ccda03dd277f2c320
7
+ data.tar.gz: d551393581a0efe23a2cd6714b08747a7640e5544437ca5486485a91a4050b58656e9c4922cd3fba73465bb5bf78a0b4b68588624b58b1625af69e8b61f40c75
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Miko 0.0.5
1
+ # Miko 0.0.6
2
2
 
3
3
  Search for script installations versions under a account.
4
4
 
data/bin/miko CHANGED
@@ -8,7 +8,7 @@ require 'optparse'
8
8
 
9
9
  options = {}
10
10
  optparse = OptionParser.new do |opts|
11
- opts.banner = "Usage: miko [OPTIONS]"
11
+ opts.banner = "Usage: miko [options]"
12
12
 
13
13
  opts.on( "-u user", "--user USER", "Username - translates into /home/USER/") do |user|
14
14
  options[:user] = user
@@ -18,6 +18,10 @@ optparse = OptionParser.new do |opts|
18
18
  options[:directory] = dir
19
19
  end
20
20
 
21
+ opts.on("-v", "--verbose", "Be verbose and display errors" ) do |ver|
22
+ options[:verbose] = ver
23
+ end
24
+
21
25
  opts.on( "-h", "--help", "Display Help") do
22
26
  puts opts
23
27
  exit
data/lib/miko.rb CHANGED
@@ -4,6 +4,7 @@ class Miko
4
4
  attr_accessor :directory
5
5
  attr_accessor :found
6
6
  attr_accessor :path
7
+ attr_accessor :verbose
7
8
 
8
9
  def initialize( option )
9
10
  unless option[:user].nil?
@@ -14,40 +15,54 @@ class Miko
14
15
  unless option[:directory].nil?
15
16
  @directory = option[:directory]
16
17
  end
18
+
19
+ unless option[:verbose]
20
+ @verbose = option[:verbose]
21
+ end
22
+
17
23
  @found = []
18
24
  end
19
25
 
20
26
  def run
21
- if File.directory?(@directory )
27
+ if File.directory?(@directory ) and File.readable?(@directory)
22
28
  find_installs
29
+
23
30
  else
24
- raise "Directory doesn't exist"
31
+ unless defined?(@verbose).nil?
32
+ raise "Problem accessing directory"
33
+ end
25
34
  end
26
35
  end
27
36
 
28
37
  private
38
+ ##
39
+ ## Skip /home/virtfs
29
40
  def find_installs
30
41
  Find.find( @directory ) do |path|
31
42
  @path = path
32
- if File.readable?(path)
33
- if path =~ /.*\/version\.php$/
34
- find_wordpress_joomla
35
- find_moodle
36
- elsif path =~ /.*\/bootstrap.inc$/
37
- find_drupal
38
- elsif path =~ /.*\/modules\/system\/system.module$/
39
- find_drupal
40
- elsif path =~ /.*\/index.php$/
41
- find_smf_version
42
- elsif path =~ /.*\/app\/Mage.php$/
43
- find_magento_version
44
- elsif path =~ /.*\/styles\/prosilver\/template\/template.cfg$/
45
- find_phpbb_version
46
- elsif path =~/.*\/inc\/class_core.php$/
47
- find_mybb_version
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
48
61
  end
49
62
  else
50
- puts "Problem accessing #{path}"
63
+ unless defined?( @verbose).nil?
64
+ puts "Problem accessing #{path}"
65
+ end
51
66
  end
52
67
  end
53
68
  end
@@ -67,14 +82,12 @@ class Miko
67
82
  version = line.split(" ")[2][/([\d.]+)/]
68
83
  acct_home = path.gsub("/wp-includes/version.php", "")
69
84
  script = "Wordpress"
70
- elsif ( line["public $RELEASE"] )
71
- version = line[/([\d.]+)/]+ "."+ joomla_devlevel
72
- acct_home = path.gsub("libraries/cms/version/version.php", "")
73
- script = "Joomla"
74
- elsif (line["var $RELEASE"] )
75
- version = line[/([\d.]+)/]+ "."+ joomla_devlevel
76
- acct_home = path.gsub("libraries/joomla/version.php", "")
77
- script = "Joomla"
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
78
91
  end
79
92
  # Output ony when we has a defined variable
80
93
  unless defined?(version).nil?
@@ -84,9 +97,9 @@ class Miko
84
97
  end
85
98
 
86
99
  def joomla_devlevel
87
- fi = File.read( @path )
88
- fi[/DEV_LEVEL.*'/][/\d+/]
100
+ File.read( @path )[/DEV_LEVEL.*'/][/\d+/]
89
101
  end
102
+
90
103
  ## Find Drupal version
91
104
  def find_drupal
92
105
  File.open( @path, "r").each_line do |line|
data/lib/miko/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Miko
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  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.5
4
+ version: 0.0.6
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-03 00:00:00.000000000 Z
11
+ date: 2013-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler