rggen 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rggen/builtins/bit_field/reference.rb +1 -1
- data/lib/rggen/builtins/loaders/register_map/csv_loader.rb +0 -2
- data/lib/rggen/builtins/loaders/register_map/xls_loader.rb +0 -2
- data/lib/rggen/builtins/loaders/register_map/xlsx_ods_loader.rb +5 -8
- data/lib/rggen/core_extensions/facets.rb +1 -3
- data/lib/rggen/core_extensions/roo.rb +17 -0
- data/lib/rggen/version.rb +1 -1
- data/lib/rggen.rb +4 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8557db72205fd083dafe52498b9739d454ad263472beb66607409ca4641fd0b2
|
4
|
+
data.tar.gz: e5373123cdf438cf0a8d59a8c98d80268baaa3733eb97e76ff3b9215a3e5cd3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c68809dcf02ebbc254eb88b7b54fde450213bfbbcdb18b0c83bfd319fdfa711fbda93b94108a3521a131e57b93db2ff2f689c8935a97c646a63bd6d7b40b08e9
|
7
|
+
data.tar.gz: a433ecd75b2c6ee8d2a34ecc654b0cf4672530bd5bc7f86c62e9db132cff032a757e6ad7098f8ca49573b5f6867b47335d1cdeccbbcde7824b83fcc1226a1785
|
@@ -1,6 +1,4 @@
|
|
1
1
|
loader :register_map, [:xlsx, :ods] do
|
2
|
-
require 'roo'
|
3
|
-
|
4
2
|
def load_file(file)
|
5
3
|
create_map(file) do |map|
|
6
4
|
load_spreadsheet(file).each do |sheet_name, sheet|
|
@@ -12,13 +10,12 @@ loader :register_map, [:xlsx, :ods] do
|
|
12
10
|
def load_spreadsheet(file)
|
13
11
|
sheets = {}
|
14
12
|
Roo::Spreadsheet.open(file).each_with_pagename do |sheet_name, sheet|
|
15
|
-
|
16
|
-
sheets[sheet_name] = 1.upto(sheet.last_row).map do |row|
|
17
|
-
1.upto(sheet.last_column).map do |column|
|
18
|
-
sheet.cell(row, column)
|
19
|
-
end
|
20
|
-
end
|
13
|
+
sheet.first_row && (sheets[sheet_name] = process_sheet(sheet))
|
21
14
|
end
|
22
15
|
sheets
|
23
16
|
end
|
17
|
+
|
18
|
+
def process_sheet(sheet)
|
19
|
+
sheet.to_table(from_column: 1)
|
20
|
+
end
|
24
21
|
end
|
@@ -1,18 +1,16 @@
|
|
1
1
|
require 'facets/enumerable/exclude'
|
2
2
|
require 'facets/enumerable/find_yield'
|
3
|
-
require 'facets/enumerable/sum'
|
3
|
+
require 'facets/enumerable/sum' if RUBY_VERSION < '2.4'
|
4
4
|
require 'facets/file/ext'
|
5
5
|
require 'facets/hash/symbolize_keys'
|
6
6
|
require 'facets/integer/multiple'
|
7
7
|
require 'facets/kernel/attr_singleton'
|
8
8
|
require 'facets/kernel/not'
|
9
9
|
require 'facets/kernel/not_nil'
|
10
|
-
require 'facets/method/curry' unless Method.public_method_defined?(:curry)
|
11
10
|
require 'facets/module/attr_class_accessor'
|
12
11
|
require 'facets/module/attr_setter'
|
13
12
|
require 'facets/module/lastname'
|
14
13
|
require 'facets/numeric/positive'
|
15
|
-
require 'facets/object/itself' unless Object.public_method_defined?(:itself)
|
16
14
|
require 'facets/pathname/to_path'
|
17
15
|
require 'facets/pathname/to_str'
|
18
16
|
require 'facets/range/overlap'
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Roo
|
2
|
+
module TableFormatter
|
3
|
+
def to_table(sheet = default_sheet, **options)
|
4
|
+
from_row = options[:from_row] || first_row(sheet)
|
5
|
+
to_row = options[:to_row] || last_row(sheet)
|
6
|
+
from_column = options[:from_column] || first_column(sheet)
|
7
|
+
to_column = options[:to_column] || last_column(sheet)
|
8
|
+
from_row.upto(to_row).map do |row|
|
9
|
+
from_column.upto(to_column).map { |column| cell(row, column, sheet) }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
class Base
|
15
|
+
include TableFormatter
|
16
|
+
end
|
17
|
+
end
|
data/lib/rggen/version.rb
CHANGED
data/lib/rggen.rb
CHANGED
@@ -4,6 +4,9 @@ module RgGen
|
|
4
4
|
require 'pathname'
|
5
5
|
require 'optparse'
|
6
6
|
require 'erubi'
|
7
|
+
require 'csv'
|
8
|
+
require 'roo'
|
9
|
+
require 'spreadsheet'
|
7
10
|
|
8
11
|
require_relative 'rggen/version'
|
9
12
|
require_relative 'rggen/rggen_home'
|
@@ -15,6 +18,7 @@ module RgGen
|
|
15
18
|
require_relative 'rggen/core_extensions/forwardable'
|
16
19
|
require_relative 'rggen/core_extensions/integer'
|
17
20
|
require_relative 'rggen/core_extensions/math'
|
21
|
+
require_relative 'rggen/core_extensions/roo'
|
18
22
|
|
19
23
|
require_relative 'rggen/base/hierarchical_accessors'
|
20
24
|
require_relative 'rggen/base/hierarchical_item_accessors'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rggen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taichi Ishitani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubi
|
@@ -257,6 +257,7 @@ files:
|
|
257
257
|
- lib/rggen/core_extensions/forwardable.rb
|
258
258
|
- lib/rggen/core_extensions/integer.rb
|
259
259
|
- lib/rggen/core_extensions/math.rb
|
260
|
+
- lib/rggen/core_extensions/roo.rb
|
260
261
|
- lib/rggen/exceptions.rb
|
261
262
|
- lib/rggen/generator.rb
|
262
263
|
- lib/rggen/input_base/component.rb
|
@@ -339,8 +340,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
339
340
|
- !ruby/object:Gem::Version
|
340
341
|
version: '0'
|
341
342
|
requirements: []
|
342
|
-
|
343
|
-
rubygems_version: 2.7.6
|
343
|
+
rubygems_version: 3.0.3
|
344
344
|
signing_key:
|
345
345
|
specification_version: 4
|
346
346
|
summary: Code generation tool for control registers in a SoC design.
|