Sha256: ff4bf85a2d76d61068b938da941dd0e970400a1739858a84f510ab03e5b7f88d

Contents?: true

Size: 1.71 KB

Versions: 8

Compression:

Stored size: 1.71 KB

Contents

require_relative '../lib/rubyfromexcel'

$DEBUG = false

def convert(basename)
    # Need the original spreadsheet
    spreadsheet = File.join(File.dirname(__FILE__),'sheets',"#{basename}.xlsx")
    
    # A place to put an unzipped version of the spreadsheet (could be a tmp dir, but helpful for debugging if local)
    unzipped_spreadsheet = File.join(File.dirname(__FILE__),'unzipped-sheets',basename)
    
    # A place to put the resulting ruby version
    ruby_version = File.join(File.dirname(__FILE__),'ruby-versions',"#{basename}-ruby")

    puts "Converting #{spreadsheet} into #{ruby_version}"

    # The spreadsheet needs to be unzipped before starting
    puts `unzip -uo #{spreadsheet} -d #{unzipped_spreadsheet}`

    RubyFromExcel::Process.new do
      self.source_excel_directory = unzipped_spreadsheet
      self.target_ruby_directory = ruby_version
      self.skip_tests = false
      case basename
      when "pruning"
        self.prune_except_output_sheets = ['Outputs']
        self.convert_independent_of_input_sheets = ['Inputs']      
      when "checkpoint"
        self.checkpoint_directory =  File.join(File.dirname(__FILE__),'checkpoints','checkpoint')
        # self.debug_dont_write_checkpoint_after_stage = 1
      when "2050Model", "2050ModelCutDown"
        self.prune_except_output_sheets = ['Intermediate output','Control']
        self.convert_independent_of_input_sheets = ['Control']
        # self.checkpoint_directory =  File.join(File.dirname(__FILE__),'checkpoints','2050Model')        
      end
    end.start!

    puts
end

if ARGV[0]
  convert ARGV[0]
else
  %w{array-formulas complex-test namedReferenceTest sharedFormulaTest table-test pruning checkpoint}.each do |basename|
    convert basename
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rubyfromexcel-0.0.23 examples/create_and_test_examples.rb
rubyfromexcel-0.0.22 examples/create_and_test_examples.rb
rubyfromexcel-0.0.21 examples/create_and_test_examples.rb
rubyfromexcel-0.0.20 examples/create_and_test_examples.rb
rubyfromexcel-0.0.19 examples/create_and_test_examples.rb
rubyfromexcel-0.0.18 examples/create_and_test_examples.rb
rubyfromexcel-0.0.17 examples/create_and_test_examples.rb
rubyfromexcel-0.0.16 examples/create_and_test_examples.rb