Class: Miko::Magento
Instance Attribute Summary
Attributes inherited from Base
#acct_home, #path, #script, #version
Instance Method Summary collapse
-
#initialize(path) ⇒ Magento
constructor
A new instance of Magento.
Methods inherited from Base
Constructor Details
#initialize(path) ⇒ Magento
Returns a new instance of Magento.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/scripts/magento.rb', line 5 def initialize( path ) super( path ) magento = { 'major' => File.read( path )[/'major'.*=>.*/][/\d/], 'minor' => File.read( path )[/'minor'.*=>.*/][/\d/], 'revision' => File.read( path )[/'revision'.*=>.*/][/\d/], 'patch' => File.read( path )[/'patch'.*=>.*/][/\d/], 'stability' => File.read( path )[/'stability'.*=>.*/].split("=>")[1][/[a-z]+/], 'number' => File.read( path )[/'number'.*=>.*/][/\d/] } @acct_home = path.gsub("app/Mage.php", "") @script = "Magento" if magento["stability"].nil? @version = "#{magento["major"]}.#{magento["minor"]}.#{magento["revision"]}.#{magento["patch"]}" else @version = "#{magento["major"]}.#{magento["minor"]}.#{magento["revision"]}.#{magento["patch"]}-#{magento["stability"]}#{magento["number"]}" end end |