Class: ZipFileBuilder
- Inherits:
-
Object
- Object
- ZipFileBuilder
- Defined in:
- app/services/zip_file_builder.rb
Constant Summary collapse
- THEMES_PATH =
File.join('public', 'vinsol_spree_themes')
- INVALID_DIRECTORIES =
['.', '..', 'precompiled_assets']
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
-
#input_path ⇒ Object
readonly
Returns the value of attribute input_path.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
-
#zip ⇒ Object
readonly
Returns the value of attribute zip.
Instance Method Summary collapse
- #archive ⇒ Object
-
#initialize(theme) ⇒ ZipFileBuilder
constructor
A new instance of ZipFileBuilder.
- #remove ⇒ Object
Constructor Details
#initialize(theme) ⇒ ZipFileBuilder
Returns a new instance of ZipFileBuilder.
10 11 12 13 14 15 |
# File 'app/services/zip_file_builder.rb', line 10 def initialize(theme) @theme = theme @name = name input_theme_directory_path output_zip_file_path end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
8 9 10 |
# File 'app/services/zip_file_builder.rb', line 8 def entries @entries end |
#input_path ⇒ Object (readonly)
Returns the value of attribute input_path.
8 9 10 |
# File 'app/services/zip_file_builder.rb', line 8 def input_path @input_path end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'app/services/zip_file_builder.rb', line 8 def name @name end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
8 9 10 |
# File 'app/services/zip_file_builder.rb', line 8 def output_path @output_path end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
8 9 10 |
# File 'app/services/zip_file_builder.rb', line 8 def theme @theme end |
#zip ⇒ Object (readonly)
Returns the value of attribute zip.
8 9 10 |
# File 'app/services/zip_file_builder.rb', line 8 def zip @zip end |
Instance Method Details
#archive ⇒ Object
17 18 19 20 21 22 |
# File 'app/services/zip_file_builder.rb', line 17 def archive remove @entries = get_directory_content(input_theme_directory_path) delete_non_zip_content(@entries) build_zip_file end |
#remove ⇒ Object
24 25 26 |
# File 'app/services/zip_file_builder.rb', line 24 def remove File.delete(output_path) if File.exist?(output_path) end |