Class: AssUpdater::UpdateDistrib
- Inherits:
-
Object
- Object
- AssUpdater::UpdateDistrib
- Defined in:
- lib/ass_updater/update_distrib.rb
Overview
Implement work with distributives of configuration update
Instance Attribute Summary collapse
-
#ass_updater ⇒ Object
readonly
Returns the value of attribute ass_updater.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
-
#tmplt_root ⇒ Object
readonly
Returns the value of attribute tmplt_root.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
-
#version_info ⇒ Object
readonly
Returns the value of attribute version_info.
Instance Method Summary collapse
-
#file ⇒ Object
Return path to distributive zip file on http server.
-
#file_list(pattern = '*') ⇒ Object
Return files included in distributive.
-
#get(user, password) ⇒ AssUpdater::UpdateDistrib
Download <version> distributive of configuration update and uzip into tmplt_root.
-
#initialize(version, tmplt_root, ass_updater) ⇒ UpdateDistrib
constructor
A new instance of UpdateDistrib.
-
#local_path ⇒ Object
Return local path where distributive installed.
Constructor Details
#initialize(version, tmplt_root, ass_updater) ⇒ UpdateDistrib
Returns a new instance of UpdateDistrib.
11 12 13 14 15 16 17 |
# File 'lib/ass_updater/update_distrib.rb', line 11 def initialize(version, tmplt_root, ass_updater) @ass_updater = ass_updater @version = AssUpdater::AssVersion.new(version) @version_info = @ass_updater.update_history[@version] @tmplt_root = tmplt_root.to_s.force_encoding('UTF-8') @target = AssUpdater::AssVersion.convert_array version_info['target'] end |
Instance Attribute Details
#ass_updater ⇒ Object (readonly)
Returns the value of attribute ass_updater.
6 7 8 |
# File 'lib/ass_updater/update_distrib.rb', line 6 def ass_updater @ass_updater end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
6 7 8 |
# File 'lib/ass_updater/update_distrib.rb', line 6 def target @target end |
#tmplt_root ⇒ Object (readonly)
Returns the value of attribute tmplt_root.
6 7 8 |
# File 'lib/ass_updater/update_distrib.rb', line 6 def tmplt_root @tmplt_root end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
6 7 8 |
# File 'lib/ass_updater/update_distrib.rb', line 6 def version @version end |
#version_info ⇒ Object (readonly)
Returns the value of attribute version_info.
6 7 8 |
# File 'lib/ass_updater/update_distrib.rb', line 6 def version_info @version_info end |
Instance Method Details
#file ⇒ Object
Return path to distributive zip file on http server
41 42 43 |
# File 'lib/ass_updater/update_distrib.rb', line 41 def file File.join(AssUpdater::UPDATEREPO_BASE, fix_path(version_info_file)) end |
#file_list(pattern = '*') ⇒ Object
Return files included in distributive. Files find in #local_path
52 53 54 55 56 |
# File 'lib/ass_updater/update_distrib.rb', line 52 def file_list(pattern = '*') Dir.glob(File.join(local_path, pattern)).map do |f| f.force_encoding 'UTF-8' end end |
#get(user, password) ⇒ AssUpdater::UpdateDistrib
Require authorization.
Service downloads.v8.1c.ru often unavailable and it fail on timeout. Don’t worry and try again.
Download <version> distributive of configuration update and uzip into tmplt_root. Exists in template_root distrib will be overwritten.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ass_updater/update_distrib.rb', line 27 def get(user, password) zip_f = Tempfile.new('1cv8_zip') begin download_distrib(zip_f, user, password) zip_f.rewind unzip_all(zip_f) ensure zip_f.close zip_f.unlink end self end |
#local_path ⇒ Object
Return local path where distributive installed
46 47 48 |
# File 'lib/ass_updater/update_distrib.rb', line 46 def local_path File.join(tmplt_root, File.dirname(version_info_file)) end |