Module: WebExtNativeAppPacker::Helper

Defined in:
lib/web-ext-native-app-packer.rb

Class Method Summary collapse

Class Method Details

.mkdir(out_path) ⇒ Object



220
221
222
223
224
225
# File 'lib/web-ext-native-app-packer.rb', line 220

def self.mkdir(out_path)
  dir = out_path[0, out_path.rindex('/')]
  unless File.exist?(dir)
    FileUtils.mkdir_p(dir)
  end
end

.render(v, erb_path, out_path) ⇒ Object



210
211
212
213
214
215
216
217
218
# File 'lib/web-ext-native-app-packer.rb', line 210

def self.render(v, erb_path, out_path)
  mkdir(out_path)
  @v = v
  b = binding
  erb = ::ERB.new(File.new(erb_path).read)
  File.open(out_path, 'w') do |f|
    f.write erb.result(b)
  end
end