onoma 0.7.0 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 19a7cd8318c90bfdb53f6bbd5fb73d88de2c0532
4
- data.tar.gz: 375a7d995be1f542159b52f965b37401ff35d6b2
2
+ SHA256:
3
+ metadata.gz: c96d95f1db7adabc563cbde0eea01989e9412b82d9d839e5ba03888c6195966f
4
+ data.tar.gz: 13979413ece73ecc8a89a242fc86f3cee50db574366fd7f3f950a2902387fc30
5
5
  SHA512:
6
- metadata.gz: fd6121f1ef02e4d74693083c97a405d5e0d4bace8acff8ea93605b82178f387f841050cc666b17e9a42b027a251654f98e0a1ab2adb91db8f750b9d3d16029ff
7
- data.tar.gz: dddf37403ee890d1d9e3578e29d620b6a393f1415a18c0ab7e929e49914543d7ffb37a4393efb68674deaa0336005ea91b8cbe42f43203bf2077f96414579894
6
+ metadata.gz: 7ccd446988f5855a27f1f28e4ddffdf5f9baec7e6376bbb354d9b206f4300ef9753780166124ee2229f5567f2bb28e1e1c65e6ab23667fa9b62f7e2e05d66be1
7
+ data.tar.gz: 9a0eb46edeca459558c148f5a45c91d712e7dfe618f29a0ef79ee663f07d4d9318b9248aeb0417d7088520e98ca4c9598b656b1ccdb1483ac217da4dfe101a2a
@@ -1876,6 +1876,7 @@ eng:
1876
1876
  surface_area_flow: "Surface area flow"
1877
1877
  temperature: "Temperature"
1878
1878
  time: "Time"
1879
+ unity_flow: "Unity flow"
1879
1880
  volume: "Volume"
1880
1881
  volume_area_density: "Volume area density"
1881
1882
  volume_concentration: "Volume concentration"
@@ -1946,6 +1947,7 @@ eng:
1946
1947
  phytosanitary_applicator_sheet: "Applicator sheet"
1947
1948
  phytosanitary_certification: "Phytosanitary certification"
1948
1949
  phytosanitary_register: "Phytosanitary register"
1950
+ planned_budget_sheet: "Planned budget sheet"
1949
1951
  prescription: "Prescription"
1950
1952
  products_sheet: "Products sheet"
1951
1953
  provisional_manure_management_plan: "Provisional manure management plan"
@@ -4707,6 +4709,7 @@ eng:
4707
4709
  parts_per_million: "Parts per million"
4708
4710
  pascal: "Pascal"
4709
4711
  percent: "Percent"
4712
+ plant_per_hour: "Plant per hour"
4710
4713
  quintal: "Quintal"
4711
4714
  quintal_per_hectare: "Quintal per hectare"
4712
4715
  radian: "Radian"
@@ -4726,6 +4729,7 @@ eng:
4726
4729
  ton_per_hectare: "Ton per hectare"
4727
4730
  unity: "Unity"
4728
4731
  unity_per_hectare: "Unity per hectare"
4732
+ unity_per_hour: "Unity per hour"
4729
4733
  unity_per_kilogram: "Unity per kilogram"
4730
4734
  unity_per_liter: "Unity per liter"
4731
4735
  unity_per_square_meter: "Unity per square meter"
@@ -7580,4 +7584,4 @@ eng:
7580
7584
  wine_transformers: "Wine transformers"
7581
7585
  name: "Working sets"
7582
7586
  property_natures:
7583
- expression: "Expression"
7587
+ expression: "Expression"
@@ -1948,6 +1948,7 @@ fra:
1948
1948
  surface_area_flow: "Débit surfacique"
1949
1949
  temperature: "Température"
1950
1950
  time: "Temps"
1951
+ unity_flow: "Débit unitaire"
1951
1952
  volume: "Volume"
1952
1953
  volume_area_density: "Volume par surface"
1953
1954
  volume_concentration: "Concentration volumique"
@@ -2020,6 +2021,7 @@ fra:
2020
2021
  phytosanitary_applicator_sheet: "Fiche applicateur"
2021
2022
  phytosanitary_certification: "Certi-Phyto"
2022
2023
  phytosanitary_register: "Registre phytosanitaire"
2024
+ planned_budget_sheet: "Budget prévisionnel"
2023
2025
  prescription: "Prescription vétérinaire"
2024
2026
  products_sheet: "Fiche des produits"
2025
2027
  provisional_manure_management_plan: "Plan prévisionnel de fumure (PPF)"
@@ -4958,6 +4960,7 @@ fra:
4958
4960
  parts_per_million: "Partie par millions (ppm)"
4959
4961
  pascal: "Pascal"
4960
4962
  percent: "Pourcent"
4963
+ plant_per_hour: "Plante/Pied par heure"
4961
4964
  quintal: "Quintal"
4962
4965
  quintal_per_hectare: "Quintal par hectare"
4963
4966
  radian: "Radian"
@@ -4977,6 +4980,7 @@ fra:
4977
4980
  ton_per_hectare: "Tonne par hectare"
4978
4981
  unity: "Unité"
4979
4982
  unity_per_hectare: "Unité par hectare"
4983
+ unity_per_hour: "Unité par heure"
4980
4984
  unity_per_kilogram: "Unité par kilogramme"
4981
4985
  unity_per_liter: "Unité par litre"
4982
4986
  unity_per_square_meter: "Unité par mètre carré"
@@ -7789,4 +7793,4 @@ fra:
7789
7793
  wine_transformers: "Produits œnologiques"
7790
7794
  name: "Ensembles de produits"
7791
7795
  property_natures:
7792
- expression: "Expression"
7796
+ expression: "Expression"
data/db/reference.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0"?>
2
- <nomenclatures xmlns="http://www.ekylibre.org/XML/2013/nomenclatures" version="20220504085540">
2
+ <nomenclatures xmlns="http://www.ekylibre.org/XML/2013/nomenclatures" version="20220809095601">
3
3
  <nomenclature name="abilities" translateable="true">
4
4
  <properties>
5
5
  <property name="parameters" type="choice_list" choices="variety, issue_nature"/>
@@ -1719,7 +1719,7 @@
1719
1719
  <property name="countries" type="item_list" choices="countries"/>
1720
1720
  <property name="number" type="string" required="true" default="2"/>
1721
1721
  <property name="precision" type="integer" required="true" default="2"/>
1722
- <property name="symbol" type="string"/>
1722
+ <property name="symbol" type="string" fallbacks="name"/>
1723
1723
  </properties>
1724
1724
  <items>
1725
1725
  <item name="AED" precision="2" active="true" countries="ae" number="784"/>
@@ -1821,7 +1821,7 @@
1821
1821
  <item name="MNT" precision="2" active="true" countries="mn" number="496"/>
1822
1822
  <item name="MOP" precision="2" active="true" countries="mo" number="446"/>
1823
1823
  <item name="MRO" precision="2" active="true" countries="mr" number="478"/>
1824
- <item name="MUR" precision="2" active="true" countries="mu" number="480"/>
1824
+ <item name="MUR" precision="2" active="true" countries="mu" number="480" symbol="Rs"/>
1825
1825
  <item name="MVR" precision="2" active="true" countries="mv" number="462"/>
1826
1826
  <item name="MWK" precision="2" active="true" countries="mw" number="454"/>
1827
1827
  <item name="MXN" precision="2" active="true" countries="mx" number="484"/>
@@ -1935,6 +1935,7 @@
1935
1935
  <item name="surface_area_flow" symbol="m&#xB2;/s"/>
1936
1936
  <item name="temperature" symbol="K"/>
1937
1937
  <item name="time" symbol="s"/>
1938
+ <item name="unity_flow" symbol="./s"/>
1938
1939
  <item name="volume" symbol="m&#xB3;"/>
1939
1940
  <item name="volume_area_density" symbol="m&#xB3;/m&#xB2;"/>
1940
1941
  <item name="volume_concentration" symbol="m&#xB3;/m&#xB3;"/>
@@ -2015,6 +2016,7 @@
2015
2016
  <item name="phytosanitary_applicator_sheet" category="management"/>
2016
2017
  <item name="phytosanitary_certification" category="land_parcel_management"/>
2017
2018
  <item name="phytosanitary_register" category="land_parcel_management"/>
2019
+ <item name="planned_budget_sheet" category="management"/>
2018
2020
  <item name="prescription" category="health"/>
2019
2021
  <item name="products_sheet" category="management"/>
2020
2022
  <item name="provisional_manure_management_plan" category="land_parcel_management"/>
@@ -10262,6 +10264,7 @@
10262
10264
  <item name="parts_per_million" dimension="none" symbol="ppm" d="1000000.0" base_unit="parts" base_dimension="" repartition_unit="million" repartition_dimension="none"/>
10263
10265
  <item name="pascal" dimension="pressure" symbol="Pa" base_unit="pascal" base_dimension="pressure"/>
10264
10266
  <item name="percent" dimension="none" symbol="%" d="100.0" base_unit="percent" base_dimension="none"/>
10267
+ <item name="plant_per_hour" dimension="unity_flow" symbol="plant/h" a="1.0" d="3600.0" base_unit="unity" base_dimension="none" repartition_unit="hour" repartition_dimension="time"/>
10265
10268
  <item name="quintal" dimension="mass" symbol="q" a="100.0" base_unit="quintal" base_dimension="mass"/>
10266
10269
  <item name="quintal_per_acre" dimension="mass_area_density" symbol="qt/acre" a="0.024710538146" base_unit="quintal" base_dimension="mass" repartition_unit="acre" repartition_dimension="surface_area"/>
10267
10270
  <item name="quintal_per_are" dimension="mass_area_density" symbol="qt/a" a="1.0" base_unit="quintal" base_dimension="mass" repartition_unit="are" repartition_dimension="surface_area"/>
@@ -10290,6 +10293,7 @@
10290
10293
  <item name="ton_per_square_meter" dimension="mass_area_density" symbol="t/m&#xB2;" a="1000.0" base_unit="ton" base_dimension="mass" repartition_unit="square_meter" repartition_dimension="surface_area"/>
10291
10294
  <item name="unity" dimension="none" symbol="." base_unit="unity" base_dimension="none"/>
10292
10295
  <item name="unity_per_hectare" dimension="surface_area_density" symbol="./ha" d="10000.0" base_unit="unity" base_dimension="none" repartition_unit="hectare" repartition_dimension="surface_area"/>
10296
+ <item name="unity_per_hour" dimension="unity_flow" symbol="./h" a="1.0" d="3600.0" base_unit="unity" base_dimension="none" repartition_unit="hour" repartition_dimension="time"/>
10293
10297
  <item name="unity_per_kilogram" dimension="mass_density" symbol="./kg" base_unit="unity" base_dimension="none" repartition_unit="kilogram" repartition_dimension="mass"/>
10294
10298
  <item name="unity_per_liter" dimension="concentration" symbol="./l" d="0.001" base_unit="unity" base_dimension="none" repartition_unit="liter" repartition_dimension="volume"/>
10295
10299
  <item name="unity_per_square_meter" dimension="surface_area_density" symbol="./m&#xB2;" base_unit="unity" base_dimension="none" repartition_unit="square_meter" repartition_dimension="surface_area"/>
data/lib/onoma/item.rb CHANGED
@@ -279,6 +279,7 @@ module Onoma
279
279
  if property
280
280
  if value.nil? && property.fallbacks
281
281
  property.fallbacks.each do |fallback|
282
+ value ||= @name if fallback == :name
282
283
  value ||= @attributes[fallback]
283
284
  break if value
284
285
  end
@@ -0,0 +1,36 @@
1
+ module Onoma
2
+ module Migration
3
+ module Actions
4
+ class PropertyChange < Onoma::Migration::Actions::Base
5
+ attr_reader :nomenclature, :name, :changes
6
+ def initialize(element)
7
+ name = element['property'].split('.')
8
+ @nomenclature = name.first
9
+ @name = name.second
10
+
11
+ @changes = {}
12
+ if element.has_attribute?('type')
13
+ changes[:type] = element.attr('type').to_sym
14
+ end
15
+ if element.has_attribute?('fallbacks')
16
+ @changes[:fallbacks] = element.attr('fallbacks').to_s.strip.split(/[[:space:]]*\,[[:space:]]*/).map(&:to_sym)
17
+ end
18
+ if element.has_attribute?('default')
19
+ @changes[:default] = element.attr('default').to_sym
20
+ end
21
+ if element.has_attribute?('required')
22
+ @changes[:required] = element.attr('required').to_s == 'true'
23
+ end
24
+ # @changes[:inherit] = !!(element.attr('inherit').to_s == 'true')
25
+ if element.has_attribute?('choices')
26
+ if type == :choice || type == :choice_list
27
+ @changes[:choices] = element.attr('choices').to_s.strip.split(/[[:space:]]*\,[[:space:]]*/).map(&:to_sym)
28
+ elsif type == :item || type == :item_list
29
+ @changes[:choices] = element.attr('choices').to_s.strip.to_sym
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -48,7 +48,7 @@ module Onoma
48
48
  end
49
49
 
50
50
  def property_change(action)
51
- @set.add_property(action.nomenclature, action.name, action.changes)
51
+ @set.change_property(action.nomenclature, action.name, action.changes)
52
52
  end
53
53
 
54
54
  def item_creation(action)
@@ -256,6 +256,22 @@ module Onoma
256
256
  p
257
257
  end
258
258
 
259
+ def change_property(name, updates = {})
260
+ property = property_natures[name]
261
+
262
+ unless property
263
+ raise "Property #{p.name} doesn't exist in nomenclature #{@name}"
264
+ end
265
+
266
+ updates.each do |k, v|
267
+ begin
268
+ property.send("#{k}=", v)
269
+ rescue NoMethodError => e
270
+ "#{k} attribute doesn't exist for property nature"
271
+ end
272
+ end
273
+ end
274
+
259
275
  def sibling(name)
260
276
  @set.find(name)
261
277
  end
@@ -151,8 +151,9 @@ module Onoma
151
151
  nomenclature.add_property(property_name, type, options)
152
152
  end
153
153
 
154
- def change_property(_nomenclature_name, _property_name, _updates = {})
155
- raise NotImplementedError
154
+ def change_property(nomenclature_name, property_name, updates = {})
155
+ nomenclature = find!(nomenclature_name)
156
+ nomenclature.change_property(property_name, updates)
156
157
  end
157
158
 
158
159
  def remove_property(_nomenclature_name, _property_name, _options = {})
@@ -1,6 +1,7 @@
1
1
  module Onoma
2
2
  class PropertyNature
3
- attr_reader :nomenclature, :name, :type, :fallbacks, :default, :source
3
+ attr_reader :nomenclature
4
+ attr_accessor :name, :type, :fallbacks, :default, :source
4
5
 
5
6
  # New item
6
7
  def initialize(nomenclature, name, type, options = {})
data/lib/onoma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Onoma
4
- VERSION = '0.7.0'
4
+ VERSION = '0.8.2'
5
5
  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.7.0
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ekylibre developers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-12 00:00:00.000000000 Z
11
+ date: 2022-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -153,6 +153,7 @@ files:
153
153
  - lib/onoma/migration/actions/nomenclature_change.rb
154
154
  - lib/onoma/migration/actions/nomenclature_creation.rb
155
155
  - lib/onoma/migration/actions/nomenclature_removal.rb
156
+ - lib/onoma/migration/actions/property_change.rb
156
157
  - lib/onoma/migration/actions/property_creation.rb
157
158
  - lib/onoma/migration/base.rb
158
159
  - lib/onoma/migrator.rb
@@ -246,8 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
246
247
  - !ruby/object:Gem::Version
247
248
  version: '0'
248
249
  requirements: []
249
- rubyforge_project:
250
- rubygems_version: 2.6.14.1
250
+ rubygems_version: 3.0.3
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: Provides open nomenclature data in a gem