Class: Casket
- Inherits:
-
Object
- Object
- Casket
- Defined in:
- lib/casket.rb
Instance Method Summary collapse
-
#bundle ⇒ Object
Method running “bundle instal” on application.
-
#close ⇒ Object
Method that removes temporary files from system temp.
-
#initialize ⇒ Casket
constructor
Initializes enivironment configuration.
-
#pack(directory_path) ⇒ Object
Method that checks directory and packs it into a package.
-
#rake ⇒ Object
Method running “rake” on application.
-
#unpack(file_path) ⇒ Object
Method that unpacks Casket package to system temporary directory.
Constructor Details
#initialize ⇒ Casket
Initializes enivironment configuration. Constructor of Cascet instance.
8 9 10 11 |
# File 'lib/casket.rb', line 8 def initialize @fs = File::SEPARATOR @ext = "casket" end |
Instance Method Details
#bundle ⇒ Object
Method running “bundle instal” on application.
41 42 43 44 |
# File 'lib/casket.rb', line 41 def bundle Dir.chdir @temp_dir system("bundle install") end |
#close ⇒ Object
Method that removes temporary files from system temp.
36 37 38 |
# File 'lib/casket.rb', line 36 def close FileUtils.rm_rf @temp_dir end |
#pack(directory_path) ⇒ Object
Method that checks directory and packs it into a package. It uses tar algorithm. Parameter directory_path points on directory to pack.
15 16 17 18 19 20 21 22 |
# File 'lib/casket.rb', line 15 def pack directory_path Dir.chdir directory_path name = Dir.pwd.split(@fs).last files = Dir.glob "**#{@fs}*" File.open([name, @ext].join("."), "wb") do |tar| Minitar.pack(files, tar) end end |
#rake ⇒ Object
Method running “rake” on application.
47 48 49 50 |
# File 'lib/casket.rb', line 47 def rake Dir.chdir @temp_dir system("rake") end |
#unpack(file_path) ⇒ Object
Method that unpacks Casket package to system temporary directory. Parameter file_path points on Casket package.
26 27 28 29 30 31 32 33 |
# File 'lib/casket.rb', line 26 def unpack file_path name = file_path.split(@fs).last Dir.chdir Dir.tmpdir Dir.mkdir name Minitar.unpack(file_path, name) Dir.chdir name @temp_dir = Dir.pwd end |