Sha256: 5c5d2b168e9092ee49be1e4ab0f0bfa6677feec8b5f5c59acef5562f90849b9e

Contents?: true

Size: 1.14 KB

Versions: 13

Compression:

Stored size: 1.14 KB

Contents

module MagLove
  module Command
    class Compress
      include Commander::Methods
      
      def run
        
        task :theme, theme: "!" do |args, options|
          # archive_path("dist/themes/#{options.theme}", "**/*", "#{options.theme}.tar.gz")
          target = "themes/#{options.theme}/#{options.theme}.tar.gz"
          Dir.chdir("dist") do
            tgz = Zlib::GzipWriter.new(File.open(target, "wb"))
            Archive::Tar::Minitar::Output.open(tgz) do |tar|
              Dir["themes/#{options.theme}/**/*"].reject{|file| file == target}.each do |file|
                Archive::Tar::Minitar::pack_file(file, tar)
              end
            end
          end
          
          # Dir.chdir(path) do
          #   tgz = Zlib::GzipWriter.new(File.open(target, 'wb'))
          #   Archive::Tar::Minitar::Output.open(tgz) do |tar|
          #     Dir[pattern].reject{|file| file == target}.each do |file|
          #       Archive::Tar::Minitar::pack_file(file, tar)
          #     end
          #   end
          # end
          
          
          debug("▸ created #{options.theme}.tar.gz")
        end
        
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
maglove-0.6.3 lib/maglove/command/compress.rb
maglove-0.6.2 lib/maglove/command/compress.rb
maglove-0.6.1 lib/maglove/command/compress.rb
maglove-0.6.0 lib/maglove/command/compress.rb
maglove-0.5.9 lib/maglove/command/compress.rb
maglove-0.5.8 lib/maglove/command/compress.rb
maglove-0.5.7 lib/maglove/command/compress.rb
maglove-0.5.5 lib/maglove/command/compress.rb
maglove-0.5.4 lib/maglove/command/compress.rb
maglove-0.5.2 lib/maglove/command/compress.rb
maglove-0.5.1 lib/maglove/command/compress.rb
maglove-0.5.0 lib/maglove/command/compress.rb
maglove-0.3.0 lib/maglove/command/compress.rb