Class: Jatai::SourcePacker
- Inherits:
-
Object
- Object
- Jatai::SourcePacker
- Defined in:
- lib/jatai/source_packer.rb
Constant Summary collapse
- IGNORE_PATTERNS =
%w[ .git node_modules tmp log .bundle vendor/bundle .env .env.* *.log coverage config/master.key config/credentials.yml.enc config/credentials config/credentials/*.yml.enc *.pem *.key storage/*.key ].freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(directory) ⇒ SourcePacker
constructor
A new instance of SourcePacker.
- #pack ⇒ Object
Constructor Details
#initialize(directory) ⇒ SourcePacker
Returns a new instance of SourcePacker.
19 20 21 |
# File 'lib/jatai/source_packer.rb', line 19 def initialize(directory) @directory = directory end |
Class Method Details
.pack(directory = Dir.pwd) ⇒ Object
15 16 17 |
# File 'lib/jatai/source_packer.rb', line 15 def self.pack(directory = Dir.pwd) new(directory).pack end |
Instance Method Details
#pack ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/jatai/source_packer.rb', line 23 def pack archive_path = File.join(Dir.tmpdir, "jatai-source-#{Time.now.to_i}-#{SecureRandom.hex(4)}.tar.gz") excludes = build_excludes cmd = [ "tar", "czf", archive_path ] + excludes + [ "-C", @directory, "." ] _out, err, status = Open3.capture3(*cmd) raise "Falha ao empacotar código: #{err}" unless status.success? archive_path end |