-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrakefile.rb
44 lines (36 loc) · 956 Bytes
/
rakefile.rb
1
2
3
4
5
6
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
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true
require_relative 'get_rbs'
task :parser do
get_rbs 'parser', from: 'program_files'
end
task :table do
get_rbs 'table', from: 'program_files'
end
task test_parser: :parser do
puts Parser.new("#{__dir__}/tests/test.txt").get_hashes
end
task test_table: :table do
puts Table.new({ 'Book': 'Parrot Crown',
'Descr': 'A humorous parrot',
'Author': 'Alexandro Volta' },
{ k: 3 })
end
task get_table_from: %i[table parser] do
table = Table.new
Parser.new(ARGV[1]).hashes.each do |line|
table.add(line)
end
puts table
end
task :main do
get_rbs 'main'
workbook = RubyXL::Workbook.new
sheet = workbook.worksheets[0]
puts a = Table.new(Parser.new(TEST_FILES[:txt]).hashes)
a.lines.each_with_index do |line, i|
line.values.each_with_index do |value, j|
sheet.add_cell(i, j, value)
end
end
workbook.write(TEST_FILES[:xlsx])
end