Class: Miko::Applications

Inherits:
Object
  • Object
show all
Defined in:
lib/miko/applications.rb

Direct Known Subclasses

Traveler

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(option) ⇒ Applications

Returns a new instance of Applications.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/miko/applications.rb', line 24

def initialize(option)
  @option = option
  ## Add to applist
  ## name => /regxp
  @applist= { 'wordpress' =>  /.*\/wp-includes\/version.php$/,
              'joomla15'  =>  /.*\/libraries\/joomla\/version.php$/,
              'joomla25'  =>  /.*\/libraries\/cms\/version\/version.php$/,
              'drupal'    =>  /.*\/CHANGELOG.txt$/,
              'smf'       =>  /.*\/index.php$/,
              'magento'   =>  /.*\/app\/Mage.php$/,
              'phpbb'     =>  /.*\/styles\/prosilver\/template\/template.cfg$/,
              'mybb'      =>  /.*\/inc\/class_core.php$/,
              'moodle'    =>  /.*\/version.php$/,
              'concrete5' =>  /.*\/concrete\/config\/version.php$/,
              'e107'      =>  /.*\/e107_admin\/ver.php$/,
              'modx'      =>  /.*\/core\/docs\/changelog.txt$/,
              'bbpress'   =>  /.*\/bbpress.php$/
              }
end

Instance Attribute Details

#applistObject

Returns the value of attribute applist.



21
22
23
# File 'lib/miko/applications.rb', line 21

def applist
  @applist
end

#directoryObject

Returns the value of attribute directory.



22
23
24
# File 'lib/miko/applications.rb', line 22

def directory
  @directory
end

#foundObject

Returns the value of attribute found.



22
23
24
# File 'lib/miko/applications.rb', line 22

def found
  @found
end

#optionObject

Returns the value of attribute option.



21
22
23
# File 'lib/miko/applications.rb', line 21

def option
  @option
end

#pathObject

Returns the value of attribute path.



22
23
24
# File 'lib/miko/applications.rb', line 22

def path
  @path
end

#userObject

Returns the value of attribute user.



22
23
24
# File 'lib/miko/applications.rb', line 22

def user
  @user
end

#verboseObject

Returns the value of attribute verbose.



22
23
24
# File 'lib/miko/applications.rb', line 22

def verbose
  @verbose
end

Instance Method Details

#checkScripts(path) ⇒ Object

Loops trough the defined @applist checking if the provided path wouldn’t match once of defined regex definitions



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/miko/applications.rb', line 98

def checkScripts( path )
  if @option[:script].empty? 
    @applist.each do |sc, val|
      if !val.match(path).nil?
        f =  final_find(sc, path)
        @found << f if !f.nil?
      end
    end
  else
    @option[:script].each do |sc|
      if !@applist[sc].match(path).nil?
        f = final_find(sc, path)
        @found << f if !f.nil?
      end
    end
  end



end

#final_find(script, file) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/miko/applications.rb', line 46

def final_find( script, file )
  case script
  when 'wordpress'
    wp =  Miko::Wordpress.new( file )
    wp.showVersion()
  when  'joomla15', 'joomla25'
    j = Miko::Joomla.new( file )
    j.showVersion()

  when "drupal"
    drupal  = Miko::Drupal.new( file )
    drupal.showVersion()

  when "smf"
    smf   = Miko::SMF.new( file )
    smf.showVersion()

  when "magento"
    magento = Miko::Magento.new( file )
    magento.showVersion()

  when "phpbb"
    phpbb = Miko::PHPBB.new( file )
    phpbb.showVersion()

  when "mybb"
    mybb  = Miko::MyBB.new(file)
    mybb.showVersion()

  when "moodle"
    moodle  = Miko::Moodle.new( file )
    moodle.showVersion()

  when "concrete5"
    c5  = Miko::Concrete5.new(file)
    c5.showVersion()
  when "e107"
    e   = Miko::E107.new(file)
    e.showVersion()
  when "bbpress"
    b   = Miko::BBPress.new(file)
    b.showVersion()
  when "modx"
    modx  = Miko::ModX.new(file)
    modx.showVersion()
  end
end