Sha256: 014700b992fecc55c59d48cc3d91110b9db4ef6c9bbbbaab7891daf4411b0123

Contents?: true

Size: 911 Bytes

Versions: 8

Compression:

Stored size: 911 Bytes

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|
                if !(/^themes\/#{options.theme}\/(images|thumbs|templates)/.match(file))
                  Archive::Tar::Minitar::pack_file(file, tar)
                end
              end
            end
          end
          
          debug("▸ created #{options.theme}.tar.gz")
        end
        
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
maglove-0.8.1 lib/maglove/command/compress.rb
maglove-0.8.0 lib/maglove/command/compress.rb
maglove-0.7.2 lib/maglove/command/compress.rb
maglove-0.7.1 lib/maglove/command/compress.rb
maglove-0.7.0 lib/maglove/command/compress.rb
maglove-0.6.6 lib/maglove/command/compress.rb
maglove-0.6.5 lib/maglove/command/compress.rb
maglove-0.6.4 lib/maglove/command/compress.rb