Class: Rokkin
- Inherits:
-
Object
- Object
- Rokkin
- Defined in:
- lib/rokkin.rb
Class Method Summary collapse
-
.containerize(path, options = {:force => false}) ⇒ Object
Copies assets from lib/assets to path.
Class Method Details
.containerize(path, options = {:force => false}) ⇒ Object
Copies assets from lib/assets to path
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rokkin.rb', line 7 def self.containerize(path, ={:force => false}) bin_path = File.(File.dirname(__FILE__)) asset_path = File.join(bin_path, "..", "lib", "assets") assets = Dir.entries(asset_path) - ['.', '..'] asset_list = assets.map do |filename| File.join(asset_path, filename) end # Are we going to overwrite an existing file? existing_files = assets - (assets - Dir.entries(path)) if [:force] || existing_files.empty? begin FileUtils.cp(asset_list, path, :preserve => true) rescue Errno::EACCES => e raise RokkinError.new(e.) end else = RokkinHelper.strip_heredoc <<-MSG Cannot overwrite the following files: #{existing_files} Remove files or retry with --force MSG raise RokkinError.new() end end |