onoma 0.3.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +3 -0
- data/.gitlab-ci.yml +14 -0
- data/Gemfile +2 -0
- data/Rakefile +3 -6
- data/bin/rake +29 -0
- data/config/locales/arb.yml +0 -35
- data/config/locales/cmn.yml +0 -32
- data/config/locales/deu.yml +0 -15
- data/config/locales/eng.yml +178 -84
- data/config/locales/fra.yml +273 -283
- data/config/locales/ita.yml +0 -22
- data/config/locales/jpn.yml +0 -32
- data/config/locales/por.yml +0 -21
- data/config/locales/spa.yml +0 -30
- data/db/migrate/20170904223101_add_cultivable_zone_registry.xml +4 -0
- data/db/migrate/20190718130243_remove_services_expenses.xml +5 -0
- data/db/migrate/20190801142431_remove_accounts_from_pcg82.xml +5 -0
- data/db/migrate/20190807125202_add_nature_to_product_natures.xml +326 -0
- data/db/migrate/20190823091727_fix-cubic-meter-per-hectare-symbol.xml +5 -0
- data/db/migrate/20190909150402_add_staff_supply_stock_account.xml +4 -0
- data/db/migrate/20190913102036_add_caliber_indicator.xml +4 -0
- data/db/migrate/20190917161215_add_missing_mass_area_density_units.xml +21 -0
- data/db/migrate/20190917161216_update_quintal_symbol.xml +4 -0
- data/db/migrate/20190917161217_adds_more_info_to_units.xml +133 -0
- data/db/migrate/20190918074757_add_new_accounts.xml +8 -0
- data/db/migrate/20191001122750_add_accounts_fixed_assets_related.xml +10 -0
- data/db/migrate/20191016152118_add_missing_document_templates.xml +6 -0
- data/db/migrate/20191028175001_add_short_balance_sheet.xml +4 -0
- data/db/migrate/20191029131921_add_vine_equipments.xml +117 -0
- data/db/migrate/20191112132413_remove_roller_from_product_natures.xml +5 -0
- data/db/migrate/20191113134626_add_nature_to_new_product_natures.xml +11 -0
- data/db/migrate/20191125133327_add_missing_units_and_indicators.xml +5 -0
- data/db/migrate/20200107095554_add_signed_field_to_document_nature.xml +9 -0
- data/db/migrate/20200305160358_add_varieties_for_phytosanitary.xml +11 -0
- data/db/migrate/20200421123503_add_type_to_categories_and_variants.xml +1136 -0
- data/db/migrate/20200514092205_add_liter_per_hectoliter_unit.xml +4 -0
- data/db/migrate/20200722091859_triticale_derivative_of.xml +5 -0
- data/db/migrate/20200826000010_add_area_units.xml +4 -0
- data/db/migrate/20200826000020_change_trailer_indicators.xml +5 -0
- data/db/migrate/20200826000030_add_new_production_systems.xml +6 -0
- data/db/migrate/20200826000040_add_viti_abilities.xml +6 -0
- data/db/migrate/20200826000060_create_vine_farming_activity_famillies.xml +4 -0
- data/db/migrate/20200826000070_remove_certifications_and_vitis_varieties.xml +55 -0
- data/db/migrate/20200826000080_add_new_indicators.xml +14 -0
- data/db/migrate/20200826000100_add_viti_procedure_actions.xml +19 -0
- data/db/migrate/20200826000110_add_vine_puning_systems.xml +9 -0
- data/db/migrate/20200826000120_add_vine_procedure_categories.xml +10 -0
- data/db/migrate/20200826000130_update_viti_product_nauture_variant.xml +10 -0
- data/db/reference.xml +1479 -1356
- data/lib/onoma.rb +82 -24
- data/lib/onoma/item.rb +19 -3
- data/lib/onoma/migration/actions/base.rb +1 -5
- data/lib/onoma/migration/actions/item_change.rb +1 -5
- data/lib/onoma/migration/actions/item_creation.rb +2 -6
- data/lib/onoma/migration/actions/item_merging.rb +1 -5
- data/lib/onoma/migration/actions/item_removal.rb +1 -1
- data/lib/onoma/migration/actions/nomenclature_change.rb +1 -1
- data/lib/onoma/migration/actions/nomenclature_creation.rb +1 -1
- data/lib/onoma/migration/actions/nomenclature_removal.rb +1 -5
- data/lib/onoma/migration/actions/property_creation.rb +4 -4
- data/lib/onoma/migration/base.rb +38 -0
- data/lib/onoma/migrator.rb +13 -0
- data/lib/onoma/migrator/reference.rb +71 -0
- data/lib/onoma/migrator/translation.rb +76 -0
- data/lib/onoma/models/ability.rb +4 -0
- data/lib/onoma/models/account.rb +4 -0
- data/lib/onoma/models/accounting_system.rb +12 -0
- data/lib/onoma/models/activity_family.rb +4 -0
- data/lib/onoma/models/administrative_area.rb +4 -0
- data/lib/onoma/models/administrative_area_nature.rb +4 -0
- data/lib/onoma/models/analysis_nature.rb +4 -0
- data/lib/onoma/models/animal_life_state.rb +4 -0
- data/lib/onoma/models/cation_exchange_capacity_analysis_method.rb +4 -0
- data/lib/onoma/models/chemical_classification.rb +4 -0
- data/lib/onoma/models/chemical_element.rb +4 -0
- data/lib/onoma/models/country.rb +4 -0
- data/lib/onoma/models/crop_set.rb +4 -0
- data/lib/onoma/models/currency.rb +4 -0
- data/lib/onoma/models/delivery_mode.rb +4 -0
- data/lib/onoma/models/dimension.rb +4 -0
- data/lib/onoma/models/document_category.rb +4 -0
- data/lib/onoma/models/document_nature.rb +4 -0
- data/lib/onoma/models/entity_link_nature.rb +4 -0
- data/lib/onoma/models/event_nature.rb +4 -0
- data/lib/onoma/models/fence_perimeter.rb +4 -0
- data/lib/onoma/models/figure.rb +4 -0
- data/lib/onoma/models/fiscal_position.rb +4 -0
- data/lib/onoma/models/guide_nature.rb +4 -0
- data/lib/onoma/models/identifier_nature.rb +4 -0
- data/lib/onoma/models/indicator.rb +7 -0
- data/lib/onoma/models/issue_nature.rb +4 -0
- data/lib/onoma/models/language.rb +4 -0
- data/lib/onoma/models/mammalia_birth_condition.rb +4 -0
- data/lib/onoma/models/mammalia_reproduction_state.rb +4 -0
- data/lib/onoma/models/molecule.rb +4 -0
- data/lib/onoma/models/net_service.rb +4 -0
- data/lib/onoma/models/opportunity_origin.rb +4 -0
- data/lib/onoma/models/phosphorus_analysis_method.rb +4 -0
- data/lib/onoma/models/plant_life_state.rb +4 -0
- data/lib/onoma/models/plant_reproduction_state.rb +4 -0
- data/lib/onoma/models/plants_growth_level.rb +4 -0
- data/lib/onoma/models/procedure_action.rb +4 -0
- data/lib/onoma/models/procedure_category.rb +4 -0
- data/lib/onoma/models/procedure_nature.rb +4 -0
- data/lib/onoma/models/procedure_role.rb +4 -0
- data/lib/onoma/models/product_nature.rb +4 -0
- data/lib/onoma/models/product_nature_category.rb +4 -0
- data/lib/onoma/models/product_nature_variant.rb +4 -0
- data/lib/onoma/models/production_nature.rb +4 -0
- data/lib/onoma/models/production_system.rb +4 -0
- data/lib/onoma/models/production_usage.rb +4 -0
- data/lib/onoma/models/residue_elimination_method.rb +4 -0
- data/lib/onoma/models/role.rb +4 -0
- data/lib/onoma/models/running_cost.rb +4 -0
- data/lib/onoma/models/sex.rb +4 -0
- data/lib/onoma/models/soil_cultural_state.rb +4 -0
- data/lib/onoma/models/soil_nature.rb +4 -0
- data/lib/onoma/models/spatial_reference_system.rb +4 -0
- data/lib/onoma/models/tax.rb +4 -0
- data/lib/onoma/models/tax_nature.rb +4 -0
- data/lib/onoma/models/unit.rb +4 -0
- data/lib/onoma/models/variety.rb +31 -0
- data/lib/onoma/models/working_set.rb +4 -0
- data/lib/onoma/nomenclature.rb +19 -23
- data/lib/onoma/{database.rb → nomenclature_set.rb} +25 -57
- data/lib/onoma/{property.rb → property_nature.rb} +5 -8
- data/lib/onoma/record/base.rb +15 -0
- data/lib/onoma/reflection.rb +3 -3
- data/lib/onoma/version.rb +3 -1
- data/onoma.gemspec +16 -17
- metadata +126 -30
- data/db/db.xml +0 -0
- data/lib/onoma/migration.rb +0 -122
- data/lib/onoma/migration/actions.rb +0 -9
data/lib/onoma/nomenclature.rb
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
require 'bigdecimal'
|
2
|
-
require 'bigdecimal/util'
|
3
|
-
|
4
1
|
module Onoma
|
5
2
|
# This class represents a nomenclature
|
6
3
|
class Nomenclature
|
@@ -12,10 +9,10 @@ module Onoma
|
|
12
9
|
def initialize(name, options = {})
|
13
10
|
@name = name.to_sym
|
14
11
|
@set = options.delete(:set)
|
15
|
-
@items =
|
12
|
+
@items = HashWithIndifferentAccess.new
|
16
13
|
@forest_right = 0
|
17
14
|
@roots = []
|
18
|
-
@properties =
|
15
|
+
@properties = {}.with_indifferent_access
|
19
16
|
@translateable = !options[:translateable].is_a?(FalseClass)
|
20
17
|
@notions = options[:notions] || []
|
21
18
|
end
|
@@ -116,7 +113,7 @@ module Onoma
|
|
116
113
|
if element.has_attribute?('default')
|
117
114
|
options[:default] = element.attr('default').to_sym
|
118
115
|
end
|
119
|
-
options[:required] =
|
116
|
+
options[:required] = element.attr('required').to_s == 'true'
|
120
117
|
# options[:inherit] = !!(element.attr('inherit').to_s == 'true')
|
121
118
|
if type == :list
|
122
119
|
type = element.has_attribute?('nomenclature') ? :item_list : :choice_list
|
@@ -138,7 +135,7 @@ module Onoma
|
|
138
135
|
raise MissingChoices, "[#{@name}] Property #{name} must have nomenclature as choices"
|
139
136
|
end
|
140
137
|
end
|
141
|
-
unless
|
138
|
+
unless Onoma::PROPERTY_TYPES.include?(type)
|
142
139
|
raise ArgumentError, "Property #{name} type is unknown: #{type.inspect}"
|
143
140
|
end
|
144
141
|
add_property(name, type, options)
|
@@ -231,7 +228,7 @@ module Onoma
|
|
231
228
|
|
232
229
|
# Add an property to the nomenclature
|
233
230
|
def add_property(name, type, options = {})
|
234
|
-
p =
|
231
|
+
p = PropertyNature.new(self, name, type, options)
|
235
232
|
if @properties[p.name]
|
236
233
|
raise "Property #{p.name} is already defined in nomenclature #{@name}"
|
237
234
|
end
|
@@ -248,11 +245,11 @@ module Onoma
|
|
248
245
|
# Check properties
|
249
246
|
@properties.values.each do |property|
|
250
247
|
if property.choices_nomenclature && !property.inline_choices? && !Onoma[property.choices_nomenclature.to_s]
|
251
|
-
raise
|
248
|
+
raise InvalidPropertyNature, "[#{name}] #{property.name} nomenclature property must refer to an existing nomenclature. Got #{property.choices_nomenclature.inspect}. Expecting: #{Onoma.names.inspect}"
|
252
249
|
end
|
253
250
|
next unless property.type == :choice && property.default
|
254
251
|
unless property.choices.include?(property.default)
|
255
|
-
raise
|
252
|
+
raise InvalidPropertyNature, "The default choice #{property.default.inspect} is invalid (in #{name}##{property.name}). Pick one from #{property.choices.sort.inspect}."
|
256
253
|
end
|
257
254
|
end
|
258
255
|
|
@@ -283,7 +280,7 @@ module Onoma
|
|
283
280
|
end
|
284
281
|
|
285
282
|
def inspect
|
286
|
-
"
|
283
|
+
"Onoma::#{name.to_s.classify}"
|
287
284
|
end
|
288
285
|
|
289
286
|
def table_name
|
@@ -301,8 +298,7 @@ module Onoma
|
|
301
298
|
|
302
299
|
# Return human name
|
303
300
|
def human_name(options = {})
|
304
|
-
I18n.
|
305
|
-
options.merge(default: ["labels.#{name}".to_sym, name.to_s.humanize]))
|
301
|
+
I18n.t("nomenclatures.#{Onoma.escape_key(name)}.name", options.merge(default: ["labels.#{Onoma.escape_key(name)}".to_sym, name.to_s.humanize]))
|
306
302
|
end
|
307
303
|
alias humanize human_name
|
308
304
|
|
@@ -370,7 +366,7 @@ module Onoma
|
|
370
366
|
|
371
367
|
# Returns a list for select, without specified items
|
372
368
|
def select_without(already_imported)
|
373
|
-
ActiveSupport::Deprecation.warn '
|
369
|
+
ActiveSupport::Deprecation.warn 'Onoma::Nomenclature#select_without method is deprecated. Please use Onoma::Nomenclature#without method instead.'
|
374
370
|
select_options = @items.values.collect do |item|
|
375
371
|
[item.human_name, item.name.to_s] unless already_imported[item.name.to_s]
|
376
372
|
end
|
@@ -401,7 +397,7 @@ module Onoma
|
|
401
397
|
end
|
402
398
|
alias item find
|
403
399
|
|
404
|
-
# Return the Item for the given name. Raises
|
400
|
+
# Return the Item for the given name. Raises Onoma::ItemNotFound if no item
|
405
401
|
# found in nomenclature
|
406
402
|
def find!(item_name)
|
407
403
|
i = find(item_name)
|
@@ -412,7 +408,7 @@ module Onoma
|
|
412
408
|
# Returns +true+ if an item exists in the nomenclature that matches the
|
413
409
|
# name, or +false+ otherwise. The argument can take two forms:
|
414
410
|
# * String/Symbol - Find an item with this primary name
|
415
|
-
# *
|
411
|
+
# * Onoma::Item - Find an item with the same name of the item
|
416
412
|
def exists?(item)
|
417
413
|
@items[item.respond_to?(:name) ? item.name : item].present?
|
418
414
|
end
|
@@ -433,8 +429,8 @@ module Onoma
|
|
433
429
|
end
|
434
430
|
|
435
431
|
# List items with properties filtering
|
436
|
-
def where(properties)
|
437
|
-
|
432
|
+
def where(properties, collection = list)
|
433
|
+
collection.select do |item|
|
438
434
|
valid = true
|
439
435
|
properties.each do |name, value|
|
440
436
|
item_value = item.property(name)
|
@@ -461,7 +457,7 @@ module Onoma
|
|
461
457
|
def without(*names)
|
462
458
|
excluded = names.flatten.compact.map(&:to_sym)
|
463
459
|
list.reject do |item|
|
464
|
-
excluded.include?(item.name)
|
460
|
+
excluded.include?(item.name.to_sym)
|
465
461
|
end
|
466
462
|
end
|
467
463
|
|
@@ -505,7 +501,7 @@ module Onoma
|
|
505
501
|
if property = properties[name]
|
506
502
|
if property.type == :choice || property.type == :item
|
507
503
|
if value =~ /\,/
|
508
|
-
raise
|
504
|
+
raise InvalidPropertyNature, 'A property nature of choice type cannot contain commas'
|
509
505
|
end
|
510
506
|
value = value.strip.to_sym
|
511
507
|
elsif property.list?
|
@@ -513,14 +509,14 @@ module Onoma
|
|
513
509
|
elsif property.type == :boolean
|
514
510
|
value = (value == 'true' ? true : value == 'false' ? false : nil)
|
515
511
|
elsif property.type == :decimal
|
516
|
-
value = value
|
512
|
+
value = BigDecimal(value)
|
517
513
|
elsif property.type == :integer
|
518
514
|
value = value.to_i
|
519
515
|
elsif property.type == :date
|
520
|
-
value = (value.blank? ? nil : value
|
516
|
+
value = (value.blank? ? nil : Date.parse(value))
|
521
517
|
elsif property.type == :symbol
|
522
518
|
unless value =~ /\A\w+\z/
|
523
|
-
raise
|
519
|
+
raise InvalidPropertyNature, "A property '#{name}' must contains a symbol. /[a-z0-9_]/ accepted. No spaces. Got #{value.inspect}"
|
524
520
|
end
|
525
521
|
value = value.to_sym
|
526
522
|
end
|
@@ -1,27 +1,34 @@
|
|
1
1
|
module Onoma
|
2
2
|
# This class represents a set of nomenclature like the reference DB
|
3
|
-
class
|
3
|
+
class NomenclatureSet
|
4
4
|
attr_accessor :version
|
5
|
-
attr_reader :path
|
6
5
|
|
7
|
-
def initialize
|
8
|
-
@
|
9
|
-
@nomenclatures = ActiveSupport::HashWithIndifferentAccess.new
|
6
|
+
def initialize
|
7
|
+
@nomenclatures = {}.with_indifferent_access
|
10
8
|
@version = 0
|
11
9
|
end
|
12
10
|
|
13
|
-
def
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
File.write(@path, to_xml)
|
11
|
+
def load_data_from_xml(nomenclature_name)
|
12
|
+
Rails.logger.info "Loading #{nomenclature_name}..."
|
13
|
+
start = Time.now
|
14
|
+
element = Onoma.reference_document.xpath("/xmlns:nomenclatures/xmlns:nomenclature[@name='#{nomenclature_name}']")
|
15
|
+
nomenclature = harvest_nomenclature(element)
|
16
|
+
Rails.logger.info "Loaded #{nomenclature_name} in #{(Time.now - start).round(2)} seconds..."
|
17
|
+
nomenclature
|
21
18
|
end
|
22
19
|
|
23
|
-
def
|
24
|
-
|
20
|
+
def self.load_file(file)
|
21
|
+
set = new
|
22
|
+
f = File.open(file, 'rb')
|
23
|
+
document = Nokogiri::XML(f) do |config|
|
24
|
+
config.strict.nonet.noblanks.noent
|
25
|
+
end
|
26
|
+
f.close
|
27
|
+
document.root.children.each do |nomenclature|
|
28
|
+
set.harvest_nomenclature(nomenclature)
|
29
|
+
end
|
30
|
+
set.version = document.root['version'].to_i
|
31
|
+
set
|
25
32
|
end
|
26
33
|
|
27
34
|
def nomenclature_names
|
@@ -105,29 +112,9 @@ module Onoma
|
|
105
112
|
builder.to_xml
|
106
113
|
end
|
107
114
|
|
108
|
-
def
|
109
|
-
|
110
|
-
|
111
|
-
add_nomenclature(action.name, action.options)
|
112
|
-
when :nomenclature_change
|
113
|
-
change_nomenclature(action.nomenclature, action.changes)
|
114
|
-
when :nomenclature_removal
|
115
|
-
remove_nomenclature(action.nomenclature)
|
116
|
-
when :property_creation
|
117
|
-
add_property(action.nomenclature, action.name, action.type, action.options)
|
118
|
-
when :property_change
|
119
|
-
add_property(action.nomenclature, action.name, action.changes)
|
120
|
-
when :item_creation
|
121
|
-
add_item(action.nomenclature, action.name, action.options)
|
122
|
-
when :item_change
|
123
|
-
change_item(action.nomenclature, action.name, action.changes)
|
124
|
-
when :item_merging
|
125
|
-
merge_item(action.nomenclature, action.name, action.into)
|
126
|
-
when :item_removal
|
127
|
-
remove_item(action.nomenclature, action.name)
|
128
|
-
else
|
129
|
-
raise "Unknown action: #{action.action_name}"
|
130
|
-
end
|
115
|
+
def harvest_nomenclature(element)
|
116
|
+
nomenclature = Nomenclature.harvest(element, set: self)
|
117
|
+
@nomenclatures[nomenclature.name] = nomenclature
|
131
118
|
end
|
132
119
|
|
133
120
|
def add_nomenclature(name, options = {})
|
@@ -193,24 +180,5 @@ module Onoma
|
|
193
180
|
nomenclature = find!(nomenclature_name)
|
194
181
|
nomenclature.remove_item(item_name)
|
195
182
|
end
|
196
|
-
|
197
|
-
protected
|
198
|
-
|
199
|
-
def harvest_nomenclature(element)
|
200
|
-
nomenclature = Nomenclature.harvest(element, set: self)
|
201
|
-
@nomenclatures[nomenclature.name] = nomenclature
|
202
|
-
end
|
203
|
-
|
204
|
-
def parse_file(file)
|
205
|
-
f = File.open(file, 'rb')
|
206
|
-
document = Nokogiri::XML(f) do |config|
|
207
|
-
config.strict.nonet.noblanks.noent
|
208
|
-
end
|
209
|
-
f.close
|
210
|
-
document.root.children.each do |nomenclature|
|
211
|
-
harvest_nomenclature(nomenclature)
|
212
|
-
end
|
213
|
-
self.version = document.root.attr('version').to_i
|
214
|
-
end
|
215
183
|
end
|
216
184
|
end
|
@@ -1,8 +1,5 @@
|
|
1
1
|
module Onoma
|
2
|
-
class
|
3
|
-
TYPES = %i[boolean item item_list choice choice_list string_list
|
4
|
-
date decimal integer nomenclature string symbol].freeze
|
5
|
-
|
2
|
+
class PropertyNature
|
6
3
|
attr_reader :nomenclature, :name, :type, :fallbacks, :default, :source
|
7
4
|
|
8
5
|
# New item
|
@@ -10,14 +7,14 @@ module Onoma
|
|
10
7
|
@nomenclature = nomenclature
|
11
8
|
@name = name.to_sym
|
12
9
|
@type = type
|
13
|
-
raise "Invalid type: #{@type.inspect}" unless
|
10
|
+
raise "Invalid type: #{@type.inspect}" unless Onoma::PROPERTY_TYPES.include?(@type)
|
14
11
|
@fallbacks = options[:fallbacks] if options[:fallbacks]
|
15
12
|
@default = options[:default] if options[:default]
|
16
13
|
@required = !!options[:required]
|
17
14
|
@source = options[:choices] if reference? && options[:choices]
|
18
15
|
end
|
19
16
|
|
20
|
-
|
17
|
+
Onoma::PROPERTY_TYPES.each do |type|
|
21
18
|
define_method "#{type}?" do
|
22
19
|
@type == type
|
23
20
|
end
|
@@ -77,7 +74,7 @@ module Onoma
|
|
77
74
|
def selection
|
78
75
|
if inline_choices?
|
79
76
|
choices.collect do |c|
|
80
|
-
[c, c]
|
77
|
+
["nomenclatures.#{@nomenclature.name}.choices.#{name}.#{c}".t, c]
|
81
78
|
end
|
82
79
|
elsif item_reference?
|
83
80
|
@nomenclature.sibling(@source).selection
|
@@ -86,7 +83,7 @@ module Onoma
|
|
86
83
|
|
87
84
|
# Return human name of property
|
88
85
|
def human_name
|
89
|
-
"nomenclatures.#{nomenclature.name}.
|
86
|
+
I18n.t("nomenclatures.#{nomenclature.name}.property_natures.#{name}", default: ["nomenclatures.#{nomenclature.name}.properties.#{name}".to_sym, "properties.#{name}".to_sym, "enumerize.#{nomenclature.name}.#{name}".to_sym, "labels.#{name}".to_sym, name.humanize])
|
90
87
|
end
|
91
88
|
|
92
89
|
alias humanize human_name
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Onoma
|
2
|
+
module Record
|
3
|
+
class Base
|
4
|
+
class << self
|
5
|
+
def method_missing(*args, &block)
|
6
|
+
Onoma.find_or_initialize(name.tableize.sub(/\Aonoma\//, '')).send(*args, &block)
|
7
|
+
end
|
8
|
+
|
9
|
+
def respond_to?(method_name)
|
10
|
+
Onoma.find_or_initialize(name.tableize.sub(/\Aonoma\//, '')).respond_to?(method_name) || super
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/onoma/reflection.rb
CHANGED
@@ -4,7 +4,7 @@ module Onoma
|
|
4
4
|
|
5
5
|
# name: things
|
6
6
|
# class_name: Thing
|
7
|
-
# klass:
|
7
|
+
# klass: Onoma::Thing
|
8
8
|
def initialize(active_record, name, options = {})
|
9
9
|
@options = options
|
10
10
|
@name = name.to_s
|
@@ -12,8 +12,8 @@ module Onoma
|
|
12
12
|
@class_name = options[:class_name] || name.to_s.classify
|
13
13
|
@foreign_key = (options[:foreign_key] || name).to_s
|
14
14
|
@scope = options[:scope]
|
15
|
-
@nomenclature = class_name.
|
16
|
-
@klass = Onoma.
|
15
|
+
@nomenclature = class_name.tableize
|
16
|
+
@klass = "Onoma::#{@class_name}".constantize
|
17
17
|
end
|
18
18
|
|
19
19
|
alias model active_record
|
data/lib/onoma/version.rb
CHANGED
data/onoma.gemspec
CHANGED
@@ -1,29 +1,28 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'onoma/version'
|
1
|
+
require_relative 'lib/onoma/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name
|
8
|
-
spec.version
|
9
|
-
spec.
|
10
|
-
spec.
|
4
|
+
spec.name = 'onoma'
|
5
|
+
spec.version = Onoma::VERSION
|
6
|
+
spec.required_ruby_version = '>= 2.4.4'
|
7
|
+
spec.authors = ['Brice TEXIER']
|
8
|
+
spec.email = ['brice@ekylibre.com']
|
11
9
|
|
12
|
-
spec.summary
|
13
|
-
spec.description
|
14
|
-
spec.homepage
|
15
|
-
spec.license
|
10
|
+
spec.summary = 'Provides open nomenclature data in a gem'
|
11
|
+
spec.description = 'Actual support Open-Nomenclature data and gem for use'
|
12
|
+
spec.homepage = 'https://gitlab.com/ekylibre/onoma'
|
13
|
+
spec.license = 'MIT'
|
16
14
|
|
17
|
-
spec.files
|
18
|
-
spec.bindir
|
19
|
-
spec.executables
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
16
|
+
spec.bindir = 'exe'
|
17
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
18
|
spec.require_paths = ['lib']
|
21
19
|
|
22
20
|
spec.add_development_dependency 'bundler', '> 1.15'
|
23
|
-
spec.add_development_dependency 'colored'
|
24
21
|
spec.add_development_dependency 'rake', '> 12.0'
|
25
22
|
spec.add_development_dependency 'minitest'
|
26
23
|
spec.add_development_dependency 'i18n-tasks'
|
27
|
-
|
24
|
+
|
25
|
+
spec.add_dependency 'activesupport', '>= 4.2'
|
26
|
+
spec.add_dependency 'zeitwerk', '~> 2.4.0'
|
28
27
|
spec.add_dependency 'nokogiri', '>= 1.10.4'
|
29
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onoma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brice TEXIER
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.15'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: colored
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rake
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +72,28 @@ dependencies:
|
|
86
72
|
requirements:
|
87
73
|
- - ">="
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
75
|
+
version: '4.2'
|
90
76
|
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - ">="
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
82
|
+
version: '4.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: zeitwerk
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.4.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.4.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: nokogiri
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,6 +116,7 @@ extensions: []
|
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
118
|
- ".gitignore"
|
119
|
+
- ".gitlab-ci.yml"
|
119
120
|
- ".travis.yml"
|
120
121
|
- CODE_OF_CONDUCT.md
|
121
122
|
- Gemfile
|
@@ -123,6 +124,7 @@ files:
|
|
123
124
|
- README.md
|
124
125
|
- Rakefile
|
125
126
|
- bin/console
|
127
|
+
- bin/rake
|
126
128
|
- bin/setup
|
127
129
|
- config/locales/arb.yml
|
128
130
|
- config/locales/cmn.yml
|
@@ -133,7 +135,6 @@ files:
|
|
133
135
|
- config/locales/jpn.yml
|
134
136
|
- config/locales/por.yml
|
135
137
|
- config/locales/spa.yml
|
136
|
-
- db/db.xml
|
137
138
|
- db/migrate/20150813022423_add_data.xml
|
138
139
|
- db/migrate/20150813224145_fix_zea.xml
|
139
140
|
- db/migrate/20150813224155_fix_hordeum.xml
|
@@ -319,6 +320,7 @@ files:
|
|
319
320
|
- db/migrate/20170627081533_add_pending_deposit_payments_account_number_for_pt_accounting_system.xml
|
320
321
|
- db/migrate/20170718131724_add_issue_natures.xml
|
321
322
|
- db/migrate/20170803164344_add_procedure_nature_and_category.xml
|
323
|
+
- db/migrate/20170904223101_add_cultivable_zone_registry.xml
|
322
324
|
- db/migrate/20170914083358_add_new_product_nature_variants.xml
|
323
325
|
- db/migrate/20170927144852_add_kiwi_varieties.xml
|
324
326
|
- db/migrate/20171106085357_update_account_numbers.xml
|
@@ -349,12 +351,42 @@ files:
|
|
349
351
|
- db/migrate/20190611101014_change_deductible_vat_account.xml
|
350
352
|
- db/migrate/20190620092151_fix_conflicts_in_new_accounts.xml
|
351
353
|
- db/migrate/20190625152636_change_mixture_seed_product_nature_variant.xml
|
354
|
+
- db/migrate/20190718130243_remove_services_expenses.xml
|
355
|
+
- db/migrate/20190801142431_remove_accounts_from_pcg82.xml
|
356
|
+
- db/migrate/20190807125202_add_nature_to_product_natures.xml
|
357
|
+
- db/migrate/20190823091727_fix-cubic-meter-per-hectare-symbol.xml
|
358
|
+
- db/migrate/20190909150402_add_staff_supply_stock_account.xml
|
359
|
+
- db/migrate/20190913102036_add_caliber_indicator.xml
|
360
|
+
- db/migrate/20190917161215_add_missing_mass_area_density_units.xml
|
361
|
+
- db/migrate/20190917161216_update_quintal_symbol.xml
|
362
|
+
- db/migrate/20190917161217_adds_more_info_to_units.xml
|
363
|
+
- db/migrate/20190918074757_add_new_accounts.xml
|
364
|
+
- db/migrate/20191001122750_add_accounts_fixed_assets_related.xml
|
365
|
+
- db/migrate/20191016152118_add_missing_document_templates.xml
|
366
|
+
- db/migrate/20191028175001_add_short_balance_sheet.xml
|
367
|
+
- db/migrate/20191029131921_add_vine_equipments.xml
|
368
|
+
- db/migrate/20191112132413_remove_roller_from_product_natures.xml
|
369
|
+
- db/migrate/20191113134626_add_nature_to_new_product_natures.xml
|
370
|
+
- db/migrate/20191125133327_add_missing_units_and_indicators.xml
|
371
|
+
- db/migrate/20200107095554_add_signed_field_to_document_nature.xml
|
372
|
+
- db/migrate/20200305160358_add_varieties_for_phytosanitary.xml
|
373
|
+
- db/migrate/20200421123503_add_type_to_categories_and_variants.xml
|
374
|
+
- db/migrate/20200514092205_add_liter_per_hectoliter_unit.xml
|
375
|
+
- db/migrate/20200722091859_triticale_derivative_of.xml
|
376
|
+
- db/migrate/20200826000010_add_area_units.xml
|
377
|
+
- db/migrate/20200826000020_change_trailer_indicators.xml
|
378
|
+
- db/migrate/20200826000030_add_new_production_systems.xml
|
379
|
+
- db/migrate/20200826000040_add_viti_abilities.xml
|
380
|
+
- db/migrate/20200826000060_create_vine_farming_activity_famillies.xml
|
381
|
+
- db/migrate/20200826000070_remove_certifications_and_vitis_varieties.xml
|
382
|
+
- db/migrate/20200826000080_add_new_indicators.xml
|
383
|
+
- db/migrate/20200826000100_add_viti_procedure_actions.xml
|
384
|
+
- db/migrate/20200826000110_add_vine_puning_systems.xml
|
385
|
+
- db/migrate/20200826000120_add_vine_procedure_categories.xml
|
386
|
+
- db/migrate/20200826000130_update_viti_product_nauture_variant.xml
|
352
387
|
- db/reference.xml
|
353
388
|
- lib/onoma.rb
|
354
|
-
- lib/onoma/database.rb
|
355
389
|
- lib/onoma/item.rb
|
356
|
-
- lib/onoma/migration.rb
|
357
|
-
- lib/onoma/migration/actions.rb
|
358
390
|
- lib/onoma/migration/actions/base.rb
|
359
391
|
- lib/onoma/migration/actions/item_change.rb
|
360
392
|
- lib/onoma/migration/actions/item_creation.rb
|
@@ -364,18 +396,83 @@ files:
|
|
364
396
|
- lib/onoma/migration/actions/nomenclature_creation.rb
|
365
397
|
- lib/onoma/migration/actions/nomenclature_removal.rb
|
366
398
|
- lib/onoma/migration/actions/property_creation.rb
|
399
|
+
- lib/onoma/migration/base.rb
|
400
|
+
- lib/onoma/migrator.rb
|
401
|
+
- lib/onoma/migrator/reference.rb
|
402
|
+
- lib/onoma/migrator/translation.rb
|
403
|
+
- lib/onoma/models/ability.rb
|
404
|
+
- lib/onoma/models/account.rb
|
405
|
+
- lib/onoma/models/accounting_system.rb
|
406
|
+
- lib/onoma/models/activity_family.rb
|
407
|
+
- lib/onoma/models/administrative_area.rb
|
408
|
+
- lib/onoma/models/administrative_area_nature.rb
|
409
|
+
- lib/onoma/models/analysis_nature.rb
|
410
|
+
- lib/onoma/models/animal_life_state.rb
|
411
|
+
- lib/onoma/models/cation_exchange_capacity_analysis_method.rb
|
412
|
+
- lib/onoma/models/chemical_classification.rb
|
413
|
+
- lib/onoma/models/chemical_element.rb
|
414
|
+
- lib/onoma/models/country.rb
|
415
|
+
- lib/onoma/models/crop_set.rb
|
416
|
+
- lib/onoma/models/currency.rb
|
417
|
+
- lib/onoma/models/delivery_mode.rb
|
418
|
+
- lib/onoma/models/dimension.rb
|
419
|
+
- lib/onoma/models/document_category.rb
|
420
|
+
- lib/onoma/models/document_nature.rb
|
421
|
+
- lib/onoma/models/entity_link_nature.rb
|
422
|
+
- lib/onoma/models/event_nature.rb
|
423
|
+
- lib/onoma/models/fence_perimeter.rb
|
424
|
+
- lib/onoma/models/figure.rb
|
425
|
+
- lib/onoma/models/fiscal_position.rb
|
426
|
+
- lib/onoma/models/guide_nature.rb
|
427
|
+
- lib/onoma/models/identifier_nature.rb
|
428
|
+
- lib/onoma/models/indicator.rb
|
429
|
+
- lib/onoma/models/issue_nature.rb
|
430
|
+
- lib/onoma/models/language.rb
|
431
|
+
- lib/onoma/models/mammalia_birth_condition.rb
|
432
|
+
- lib/onoma/models/mammalia_reproduction_state.rb
|
433
|
+
- lib/onoma/models/molecule.rb
|
434
|
+
- lib/onoma/models/net_service.rb
|
435
|
+
- lib/onoma/models/opportunity_origin.rb
|
436
|
+
- lib/onoma/models/phosphorus_analysis_method.rb
|
437
|
+
- lib/onoma/models/plant_life_state.rb
|
438
|
+
- lib/onoma/models/plant_reproduction_state.rb
|
439
|
+
- lib/onoma/models/plants_growth_level.rb
|
440
|
+
- lib/onoma/models/procedure_action.rb
|
441
|
+
- lib/onoma/models/procedure_category.rb
|
442
|
+
- lib/onoma/models/procedure_nature.rb
|
443
|
+
- lib/onoma/models/procedure_role.rb
|
444
|
+
- lib/onoma/models/product_nature.rb
|
445
|
+
- lib/onoma/models/product_nature_category.rb
|
446
|
+
- lib/onoma/models/product_nature_variant.rb
|
447
|
+
- lib/onoma/models/production_nature.rb
|
448
|
+
- lib/onoma/models/production_system.rb
|
449
|
+
- lib/onoma/models/production_usage.rb
|
450
|
+
- lib/onoma/models/residue_elimination_method.rb
|
451
|
+
- lib/onoma/models/role.rb
|
452
|
+
- lib/onoma/models/running_cost.rb
|
453
|
+
- lib/onoma/models/sex.rb
|
454
|
+
- lib/onoma/models/soil_cultural_state.rb
|
455
|
+
- lib/onoma/models/soil_nature.rb
|
456
|
+
- lib/onoma/models/spatial_reference_system.rb
|
457
|
+
- lib/onoma/models/tax.rb
|
458
|
+
- lib/onoma/models/tax_nature.rb
|
459
|
+
- lib/onoma/models/unit.rb
|
460
|
+
- lib/onoma/models/variety.rb
|
461
|
+
- lib/onoma/models/working_set.rb
|
367
462
|
- lib/onoma/nomenclature.rb
|
368
|
-
- lib/onoma/
|
463
|
+
- lib/onoma/nomenclature_set.rb
|
464
|
+
- lib/onoma/property_nature.rb
|
465
|
+
- lib/onoma/record/base.rb
|
369
466
|
- lib/onoma/reference.rb
|
370
467
|
- lib/onoma/reflection.rb
|
371
468
|
- lib/onoma/relation.rb
|
372
469
|
- lib/onoma/version.rb
|
373
470
|
- onoma.gemspec
|
374
|
-
homepage: https://
|
471
|
+
homepage: https://gitlab.com/ekylibre/onoma
|
375
472
|
licenses:
|
376
473
|
- MIT
|
377
474
|
metadata: {}
|
378
|
-
post_install_message:
|
475
|
+
post_install_message:
|
379
476
|
rdoc_options: []
|
380
477
|
require_paths:
|
381
478
|
- lib
|
@@ -383,16 +480,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
383
480
|
requirements:
|
384
481
|
- - ">="
|
385
482
|
- !ruby/object:Gem::Version
|
386
|
-
version:
|
483
|
+
version: 2.4.4
|
387
484
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
388
485
|
requirements:
|
389
486
|
- - ">="
|
390
487
|
- !ruby/object:Gem::Version
|
391
488
|
version: '0'
|
392
489
|
requirements: []
|
393
|
-
|
394
|
-
|
395
|
-
signing_key:
|
490
|
+
rubygems_version: 3.0.3
|
491
|
+
signing_key:
|
396
492
|
specification_version: 4
|
397
493
|
summary: Provides open nomenclature data in a gem
|
398
494
|
test_files: []
|