Class: Qas::Archive
- Inherits:
-
Object
- Object
- Qas::Archive
- Defined in:
- lib/qas/archive.rb
Overview
Archive FLOSS Projects
Constant Summary collapse
- ARCHIVED =
Folder to store compressed projects
Pathname.new(File.join(Dir.home, 'Downloads', 'archived'))
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Format to be compressed.
-
#names ⇒ Object
readonly
FLOSS Projects elected to be archived.
-
#project ⇒ Object
readonly
project.
Instance Method Summary collapse
-
#archive ⇒ Object
Archiving FLOSS project.
- #info ⇒ Object
-
#initialize(project, names, fmt = 'tar') ⇒ Archive
constructor
A new instance of Archive.
-
#mkfolder ⇒ Object
create archived folder.
- #run ⇒ Object
Constructor Details
Instance Attribute Details
#format ⇒ Object (readonly)
Format to be compressed
11 12 13 |
# File 'lib/qas/archive.rb', line 11 def format @format end |
#names ⇒ Object (readonly)
FLOSS Projects elected to be archived
14 15 16 |
# File 'lib/qas/archive.rb', line 14 def names @names end |
#project ⇒ Object (readonly)
project
17 18 19 |
# File 'lib/qas/archive.rb', line 17 def project @project end |
Instance Method Details
#archive ⇒ Object
Archiving FLOSS project
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/qas/archive.rb', line 30 def archive require 'git' Utils.spin(project.name) do repo = Git.open project.folder repo.archive repo.current_branch, @fullpath, format: @format # TODO: fiber/multithread end puts # a bit more of space end |
#info ⇒ Object
47 48 49 |
# File 'lib/qas/archive.rb', line 47 def info print "#{project.name} > #{@fullpath}" end |
#mkfolder ⇒ Object
create archived folder
42 43 44 45 |
# File 'lib/qas/archive.rb', line 42 def mkfolder require 'fileutils' FileUtils.mkdir_p ARCHIVED unless ARCHIVED.exist? end |
#run ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/qas/archive.rb', line 51 def run return unless names.include? project.name mkfolder info archive end |