Class: Pocky::RubyFileSize

Inherits:
Object
  • Object
show all
Defined in:
lib/pocky/ruby_file_size.rb

Class Method Summary collapse

Class Method Details

.compute(directory) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/pocky/ruby_file_size.rb', line 4

def self.compute(directory)
  # Sum up all ruby source except for specs
  package_size = Dir[File.join(directory, '**', '*.rb').to_s].reduce(0) do |size, filename|
    size += File.size(filename) unless filename.match(/spec\.rb$/)
    size
  end

  # to kB
  (package_size / 1024).ceil
end