onoma 0.1.1 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/README.md +13 -1
- data/config/locales/arb.yml +77 -278
- data/config/locales/cmn.yml +69 -178
- data/config/locales/deu.yml +61 -1098
- data/config/locales/eng.yml +3166 -2984
- data/config/locales/fra.yml +705 -423
- data/config/locales/ita.yml +63 -1153
- data/config/locales/jpn.yml +80 -217
- data/config/locales/por.yml +63 -960
- data/config/locales/spa.yml +70 -601
- data/db/migrate/20170904223101_add_cultivable_zone_registry.xml +4 -0
- data/db/migrate/20170914083358_add_new_product_nature_variants.xml +14 -0
- data/db/migrate/20170927144852_add_kiwi_varieties.xml +7 -0
- data/db/migrate/20171106085357_update_account_numbers.xml +431 -0
- data/db/migrate/20171212081801_add_fiscal_positions.xml +12 -0
- data/db/migrate/20180408190101_add_new_plant_variants.xml +7 -0
- data/db/migrate/20180409130101_add_common_crop.xml +4 -0
- data/db/migrate/20180418085027_add-hour-counter-indicator.xml +9 -0
- data/db/migrate/20180709134310_add_centralizing_field_to_accounts.xml +22 -0
- data/db/migrate/20180711093131_review_all_accounts_number_and_fallbacks.xml +431 -0
- data/db/migrate/20180806080646_edit_centralizing_field_accounts.xml +17 -0
- data/db/migrate/20180814184001_add_missing_categories.xml +12 -0
- data/db/migrate/20180907160001_edit_accounts_to_unlock_first_run.xml +21 -0
- data/db/migrate/20181004220301_add_journal_ledger.xml +4 -0
- data/db/migrate/20181205162401_add_intra_vat.xml +6 -0
- data/db/migrate/20181213153405_fix_accounting_systems.xml +7 -0
- data/db/migrate/20181217155149_fiscal_position_refers_to_accounting_system.xml +10 -0
- data/db/migrate/20181217173101_fiscal_position_reference_typo.xml +4 -0
- data/db/migrate/20190315154040_add_suspense_account.xml +4 -0
- data/db/migrate/20190326110849_add_asset_fixable_to_product_nature_categories.xml +25 -0
- data/db/migrate/20190326135443_change_product_nature_category_cultivable_zone_into_land.xml +21 -0
- data/db/migrate/20190329133808_change_land_fixed_assets_account_usage.xml +7 -0
- data/db/migrate/20190405120711_delete_land_sales_account_and_assign_land_parcels_sell_revenues_to_land.xml +5 -0
- data/db/migrate/20190412071057_add_new_fixed_assets_andn_depreciable_accounts.xml +22 -0
- data/db/migrate/20190509092804_add_account_exceptional_depreciations_imputations_expenses_for_fixed_assets.xml +4 -0
- data/db/migrate/20190514084753_add_approved_input_volume.xml +9 -0
- data/db/migrate/20190520072403_add_new_accounts.xml +58 -0
- data/db/migrate/20190521170601_add_missing_taxes.xml +7 -0
- data/db/migrate/20190611101014_change_deductible_vat_account.xml +5 -0
- data/db/migrate/20190620092151_fix_conflicts_in_new_accounts.xml +6 -0
- data/db/migrate/20190625152636_change_mixture_seed_product_nature_variant.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/20190823091727_fix-cubic-meter-per-hectare-symbol.xml +5 -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/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/20200305160358_add_varieties_for_phytosanitary.xml +11 -0
- data/db/reference.xml +1170 -900
- data/lib/onoma.rb +9 -26
- data/lib/onoma/database.rb +1 -1
- data/lib/onoma/item.rb +3 -1
- data/lib/onoma/migration/actions/item_creation.rb +1 -1
- data/lib/onoma/migration/actions/property_creation.rb +1 -1
- data/lib/onoma/nomenclature.rb +7 -11
- data/lib/onoma/version.rb +1 -1
- data/onoma.gemspec +5 -4
- metadata +73 -17
data/lib/onoma.rb
CHANGED
@@ -43,21 +43,6 @@ module Onoma
|
|
43
43
|
database_path.join('reference.xml')
|
44
44
|
end
|
45
45
|
|
46
|
-
# # Returns version of DB
|
47
|
-
# def reference_version
|
48
|
-
# return 0 unless reference_path.exist?
|
49
|
-
# reference_document.root['version'].to_i
|
50
|
-
# end
|
51
|
-
|
52
|
-
# def reference_document
|
53
|
-
# f = File.open(reference_path, 'rb')
|
54
|
-
# document = Nokogiri::XML(f) do |config|
|
55
|
-
# config.strict.nonet.noblanks.noent
|
56
|
-
# end
|
57
|
-
# f.close
|
58
|
-
# document
|
59
|
-
# end
|
60
|
-
|
61
46
|
def connection
|
62
47
|
load_database unless database_loaded?
|
63
48
|
@@set
|
@@ -68,16 +53,13 @@ module Onoma
|
|
68
53
|
set.nomenclature_names
|
69
54
|
end
|
70
55
|
|
71
|
-
def all
|
72
|
-
set.nomenclatures
|
73
|
-
end
|
74
|
-
|
75
56
|
# Give access to named nomenclatures
|
76
|
-
delegate :[], to: :set
|
57
|
+
delegate :[], :nomenclatures, to: :set
|
58
|
+
alias all nomenclatures
|
77
59
|
|
78
60
|
# Give access to named nomenclatures
|
79
61
|
def find(*args)
|
80
|
-
|
62
|
+
args.extract_options!
|
81
63
|
name = args.shift
|
82
64
|
if args.empty?
|
83
65
|
return set[name]
|
@@ -87,17 +69,18 @@ module Onoma
|
|
87
69
|
nil
|
88
70
|
end
|
89
71
|
|
90
|
-
def find_or_initialize(name)
|
91
|
-
set[name] || set.load_data_from_xml(name)
|
92
|
-
end
|
93
|
-
|
94
72
|
# Browse all nomenclatures
|
95
73
|
def each(&block)
|
96
74
|
set.each(&block)
|
97
75
|
end
|
98
76
|
|
99
77
|
def set
|
100
|
-
@@set ||= Database.
|
78
|
+
@@set ||= Database.open(reference_path)
|
79
|
+
end
|
80
|
+
|
81
|
+
def load_locales
|
82
|
+
I18n.load_path.concat(Dir.glob(root.join('config', 'locales', '**', '*.yml')))
|
101
83
|
end
|
102
84
|
end
|
103
85
|
end
|
86
|
+
|
data/lib/onoma/database.rb
CHANGED
data/lib/onoma/item.rb
CHANGED
@@ -11,6 +11,8 @@ module Onoma
|
|
11
11
|
@name = name.to_s
|
12
12
|
@left, @right = @nomenclature.new_boundaries
|
13
13
|
@depth = 0
|
14
|
+
@parent = nil
|
15
|
+
@parent_name = nil
|
14
16
|
parent = options.delete(:parent)
|
15
17
|
if parent.is_a?(Symbol) || parent.is_a?(String)
|
16
18
|
@parent_name = parent.to_s
|
@@ -176,7 +178,7 @@ module Onoma
|
|
176
178
|
|
177
179
|
# Return human name of item
|
178
180
|
def human_name(options = {})
|
179
|
-
"nomenclatures.#{nomenclature.name}.items.#{name}"
|
181
|
+
I18n.translate("nomenclatures.#{nomenclature.name}.items.#{name}", options.merge(default: ["items.#{name}".to_sym, "enumerize.#{nomenclature.name}.#{name}".to_sym, "labels.#{name}".to_sym, name.humanize]))
|
180
182
|
end
|
181
183
|
alias humanize human_name
|
182
184
|
alias localize human_name
|
data/lib/onoma/nomenclature.rb
CHANGED
@@ -4,8 +4,8 @@ require 'bigdecimal/util'
|
|
4
4
|
module Onoma
|
5
5
|
# This class represents a nomenclature
|
6
6
|
class Nomenclature
|
7
|
-
attr_reader :properties, :items, :name
|
8
|
-
attr_accessor :
|
7
|
+
attr_reader :properties, :items, :name
|
8
|
+
attr_accessor :notions, :translateable, :forest_right
|
9
9
|
alias property_natures properties
|
10
10
|
|
11
11
|
# Instanciate a new nomenclature
|
@@ -225,7 +225,7 @@ module Onoma
|
|
225
225
|
end
|
226
226
|
|
227
227
|
def remove_item(name)
|
228
|
-
|
228
|
+
find!(name)
|
229
229
|
@items.delete(name)
|
230
230
|
end
|
231
231
|
|
@@ -292,12 +292,7 @@ module Onoma
|
|
292
292
|
|
293
293
|
# Returns hash with items in tree: {a => nil, b => {c => nil}}
|
294
294
|
def tree
|
295
|
-
|
296
|
-
return x
|
297
|
-
i.attributes.merge(parent: i.parent_name, name: i.name, left: i.left, right: i.right, depth: i.depth).deep_stringify_keys
|
298
|
-
return x
|
299
|
-
@roots.map do |_i|
|
300
|
-
end
|
295
|
+
@roots.collect(&:tree).join
|
301
296
|
end
|
302
297
|
|
303
298
|
def translateable?
|
@@ -306,7 +301,8 @@ module Onoma
|
|
306
301
|
|
307
302
|
# Return human name
|
308
303
|
def human_name(options = {})
|
309
|
-
"nomenclatures.#{name}.name"
|
304
|
+
I18n.translate("nomenclatures.#{name}.name",
|
305
|
+
options.merge(default: ["labels.#{name}".to_sym, name.to_s.humanize]))
|
310
306
|
end
|
311
307
|
alias humanize human_name
|
312
308
|
|
@@ -495,7 +491,7 @@ module Onoma
|
|
495
491
|
|
496
492
|
def cast_options(options)
|
497
493
|
return {} if options.nil?
|
498
|
-
|
494
|
+
options.each_with_object({}) do |(k, v), h|
|
499
495
|
h[k.to_sym] = if properties[k]
|
500
496
|
cast_property(k, v.to_s)
|
501
497
|
else
|
data/lib/onoma/version.rb
CHANGED
data/onoma.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
|
2
2
|
lib = File.expand_path('../lib', __FILE__)
|
3
3
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
4
|
require 'onoma/version'
|
@@ -19,10 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ['lib']
|
21
21
|
|
22
|
-
spec.add_development_dependency 'bundler', '
|
22
|
+
spec.add_development_dependency 'bundler', '> 1.15'
|
23
23
|
spec.add_development_dependency 'colored'
|
24
|
-
spec.add_development_dependency 'rake', '
|
24
|
+
spec.add_development_dependency 'rake', '> 12.0'
|
25
25
|
spec.add_development_dependency 'minitest'
|
26
|
+
spec.add_development_dependency 'i18n-tasks'
|
26
27
|
spec.add_dependency 'activesupport'
|
27
|
-
spec.add_dependency 'nokogiri'
|
28
|
+
spec.add_dependency 'nokogiri', '>= 1.10.4'
|
28
29
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onoma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.3
|
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
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.15'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: colored
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '12.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '12.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: minitest
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: i18n-tasks
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: activesupport
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +100,14 @@ dependencies:
|
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
103
|
+
version: 1.10.4
|
90
104
|
type: :runtime
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
110
|
+
version: 1.10.4
|
97
111
|
description: Actual support Open-Nomenclature data and gem for use
|
98
112
|
email:
|
99
113
|
- brice@ekylibre.com
|
@@ -304,6 +318,49 @@ files:
|
|
304
318
|
- db/migrate/20170627081533_add_pending_deposit_payments_account_number_for_pt_accounting_system.xml
|
305
319
|
- db/migrate/20170718131724_add_issue_natures.xml
|
306
320
|
- db/migrate/20170803164344_add_procedure_nature_and_category.xml
|
321
|
+
- db/migrate/20170904223101_add_cultivable_zone_registry.xml
|
322
|
+
- db/migrate/20170914083358_add_new_product_nature_variants.xml
|
323
|
+
- db/migrate/20170927144852_add_kiwi_varieties.xml
|
324
|
+
- db/migrate/20171106085357_update_account_numbers.xml
|
325
|
+
- db/migrate/20171212081801_add_fiscal_positions.xml
|
326
|
+
- db/migrate/20180408190101_add_new_plant_variants.xml
|
327
|
+
- db/migrate/20180409130101_add_common_crop.xml
|
328
|
+
- db/migrate/20180418085027_add-hour-counter-indicator.xml
|
329
|
+
- db/migrate/20180709134310_add_centralizing_field_to_accounts.xml
|
330
|
+
- db/migrate/20180711093131_review_all_accounts_number_and_fallbacks.xml
|
331
|
+
- db/migrate/20180806080646_edit_centralizing_field_accounts.xml
|
332
|
+
- db/migrate/20180814184001_add_missing_categories.xml
|
333
|
+
- db/migrate/20180907160001_edit_accounts_to_unlock_first_run.xml
|
334
|
+
- db/migrate/20181004220301_add_journal_ledger.xml
|
335
|
+
- db/migrate/20181205162401_add_intra_vat.xml
|
336
|
+
- db/migrate/20181213153405_fix_accounting_systems.xml
|
337
|
+
- db/migrate/20181217155149_fiscal_position_refers_to_accounting_system.xml
|
338
|
+
- db/migrate/20181217173101_fiscal_position_reference_typo.xml
|
339
|
+
- db/migrate/20190315154040_add_suspense_account.xml
|
340
|
+
- db/migrate/20190326110849_add_asset_fixable_to_product_nature_categories.xml
|
341
|
+
- db/migrate/20190326135443_change_product_nature_category_cultivable_zone_into_land.xml
|
342
|
+
- db/migrate/20190329133808_change_land_fixed_assets_account_usage.xml
|
343
|
+
- db/migrate/20190405120711_delete_land_sales_account_and_assign_land_parcels_sell_revenues_to_land.xml
|
344
|
+
- db/migrate/20190412071057_add_new_fixed_assets_andn_depreciable_accounts.xml
|
345
|
+
- db/migrate/20190509092804_add_account_exceptional_depreciations_imputations_expenses_for_fixed_assets.xml
|
346
|
+
- db/migrate/20190514084753_add_approved_input_volume.xml
|
347
|
+
- db/migrate/20190520072403_add_new_accounts.xml
|
348
|
+
- db/migrate/20190521170601_add_missing_taxes.xml
|
349
|
+
- db/migrate/20190611101014_change_deductible_vat_account.xml
|
350
|
+
- db/migrate/20190620092151_fix_conflicts_in_new_accounts.xml
|
351
|
+
- db/migrate/20190625152636_change_mixture_seed_product_nature_variant.xml
|
352
|
+
- db/migrate/20190718130243_remove_services_expenses.xml
|
353
|
+
- db/migrate/20190801142431_remove_accounts_from_pcg82.xml
|
354
|
+
- db/migrate/20190823091727_fix-cubic-meter-per-hectare-symbol.xml
|
355
|
+
- db/migrate/20190917161215_add_missing_mass_area_density_units.xml
|
356
|
+
- db/migrate/20190917161216_update_quintal_symbol.xml
|
357
|
+
- db/migrate/20190917161217_adds_more_info_to_units.xml
|
358
|
+
- db/migrate/20190918074757_add_new_accounts.xml
|
359
|
+
- db/migrate/20191001122750_add_accounts_fixed_assets_related.xml
|
360
|
+
- db/migrate/20191028175001_add_short_balance_sheet.xml
|
361
|
+
- db/migrate/20191029131921_add_vine_equipments.xml
|
362
|
+
- db/migrate/20191112132413_remove_roller_from_product_natures.xml
|
363
|
+
- db/migrate/20200305160358_add_varieties_for_phytosanitary.xml
|
307
364
|
- db/reference.xml
|
308
365
|
- lib/onoma.rb
|
309
366
|
- lib/onoma/database.rb
|
@@ -330,7 +387,7 @@ homepage: https://github.com/ekylibre/onoma
|
|
330
387
|
licenses:
|
331
388
|
- MIT
|
332
389
|
metadata: {}
|
333
|
-
post_install_message:
|
390
|
+
post_install_message:
|
334
391
|
rdoc_options: []
|
335
392
|
require_paths:
|
336
393
|
- lib
|
@@ -345,9 +402,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
345
402
|
- !ruby/object:Gem::Version
|
346
403
|
version: '0'
|
347
404
|
requirements: []
|
348
|
-
|
349
|
-
|
350
|
-
signing_key:
|
405
|
+
rubygems_version: 3.0.3
|
406
|
+
signing_key:
|
351
407
|
specification_version: 4
|
352
408
|
summary: Provides open nomenclature data in a gem
|
353
409
|
test_files: []
|