Class: Cejo::Floss::Archive
- Inherits:
-
Object
- Object
- Cejo::Floss::Archive
- Defined in:
- lib/cejo/floss/archive.rb
Overview
Archive FLOSS Projects
Constant Summary collapse
- ARCHIVE_THESE =
FLOSS Projects elected to be archived
%w[lar distro cejo ixi gota].freeze
- FMT =
Format to be compressed
'tar'
- ARCHIVED_FOLDER =
Folder which compressed files will be stored
Pathname.new(File.join(Dir.home, 'Downloads', 'archived'))
Instance Attribute Summary collapse
-
#archived_filename ⇒ Object
readonly
Returns the value of attribute archived_filename.
-
#folder ⇒ Object
readonly
Returns the value of attribute folder.
-
#info ⇒ Object
readonly
Returns the value of attribute info.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#utils ⇒ Object
readonly
Returns the value of attribute utils.
Instance Method Summary collapse
-
#do_archive ⇒ Object
Archiving FLOSS project.
-
#initialize(utils, name, folder, info) ⇒ Archive
constructor
A new instance of Archive.
- #run ⇒ Object
Constructor Details
#initialize(utils, name, folder, info) ⇒ Archive
Returns a new instance of Archive.
20 21 22 23 24 25 26 |
# File 'lib/cejo/floss/archive.rb', line 20 def initialize(utils, name, folder, info) @utils = utils @name = name @folder = folder @info = info @archived_filename = "#{ARCHIVED_FOLDER.join(name)}.#{FMT}" end |
Instance Attribute Details
#archived_filename ⇒ Object (readonly)
Returns the value of attribute archived_filename.
18 19 20 |
# File 'lib/cejo/floss/archive.rb', line 18 def archived_filename @archived_filename end |
#folder ⇒ Object (readonly)
Returns the value of attribute folder.
18 19 20 |
# File 'lib/cejo/floss/archive.rb', line 18 def folder @folder end |
#info ⇒ Object (readonly)
Returns the value of attribute info.
18 19 20 |
# File 'lib/cejo/floss/archive.rb', line 18 def info @info end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/cejo/floss/archive.rb', line 18 def name @name end |
#utils ⇒ Object (readonly)
Returns the value of attribute utils.
18 19 20 |
# File 'lib/cejo/floss/archive.rb', line 18 def utils @utils end |
Instance Method Details
#do_archive ⇒ Object
Archiving FLOSS project
29 30 31 32 33 34 35 36 37 |
# File 'lib/cejo/floss/archive.rb', line 29 def do_archive require 'git' utils.spin('Archiving') do repo = Git.open folder repo.archive repo.current_branch, archived_filename, format: FMT # TODO: fiber/multithread end puts end |
#run ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/cejo/floss/archive.rb', line 39 def run return unless ARCHIVE_THESE.include? name Dir.mkdir ARCHIVED_FOLDER unless ARCHIVED_FOLDER.exist? print info do_archive end |